5 #include "graphaxiswidget.h"
6 #include "graphlabelwidget.h"
11 * The generic GraphWidget class which combines the elements of a graph,
12 * the axis, view, scrollbars and label.
14 class GraphWidget : public QWidget {
25 GraphWidget(QWidget* parent = 0);
26 virtual ~GraphWidget(){}
29 GraphLabelWidget* label();
30 GraphAxisWidget* axis(AxisPosition pos);
32 void setView(GraphView* view);
33 void setLabel(GraphLabelWidget* label);
34 void setAxis(AxisPosition pos, GraphAxisWidget* axis);
36 void setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy policy);
37 void setVerticalScrollBarPolicy(Qt::ScrollBarPolicy policy);
39 virtual void resizeEvent(QResizeEvent *e);
42 /* Used if a selection would be shared between graphs with different axis */
43 virtual SelectionState transformSelectionIn(SelectionState state);
44 virtual SelectionState transformSelectionOut(SelectionState state);
46 /* Update the scrollbars based on current view */
47 void updateScrollbars();
49 /* Update all signal / slot connections */
50 void updateConnections();
52 /* Recalculate child widget layout */
56 void setSelection(SelectionState state);
59 void setHorizontalView(qint64 start, qint64 end);
60 void setVerticalView(qint64 start, qint64 end);
63 /* View changed by translation / zooming */
64 void verticalViewChange(qint64 start, qint64 end);
65 void verticalRangeChange(qint64 start, qint64 end);
66 void horizontalViewChange(qint64 start, qint64 end);
67 void horizontalRangeChange(qint64 start, qint64 end);
69 /* User interaction with scroll bars */
70 void horizontalScrollAction(int action);
71 void verticalScrollAction(int action);
73 /* Update child elements when selection changes */
74 void updateSelection(bool emitSignal = true);
77 void selectionChanged(SelectionState state);
79 void verticalViewChanged(qint64 start, qint64 end);
80 void verticalRangeChanged(qint64 start, qint64 end);
82 void horizontalViewChanged(qint64 start, qint64 end);
83 void horizontalRangeChanged(qint64 start, qint64 end);
86 SelectionState m_selection;
90 GraphLabelWidget* m_label;
92 GraphAxisWidget* m_axisTop;
93 GraphAxisWidget* m_axisLeft;
94 GraphAxisWidget* m_axisRight;
95 GraphAxisWidget* m_axisBottom;
97 QScrollBar* m_horizontalScrollbar;
98 qint64 m_horizontalMin;
99 qint64 m_horizontalMax;
100 qint64 m_horizontalStart;
101 qint64 m_horizontalEnd;
102 Qt::ScrollBarPolicy m_horizontalScrollbarPolicy;
104 QScrollBar* m_verticalScrollbar;
105 qint64 m_verticalMin;
106 qint64 m_verticalMax;
107 qint64 m_verticalStart;
108 qint64 m_verticalEnd;
109 Qt::ScrollBarPolicy m_verticalScrollbarPolicy;