1 /*---------------------------------------------------------------------\
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
11 \----------------------------------------------------------------------/
13 File: YQMultiProgressMeter.h
15 Author: Stefan Hundhammer <sh@suse.de>
20 #ifndef YQMultiProgressMeter_h
21 #define YQMultiProgressMeter_h
24 #include "YMultiProgressMeter.h"
36 class YQMultiProgressMeter : public QWidget, public YMultiProgressMeter
45 YQMultiProgressMeter( YWidget * parent,
47 const vector<float> & maxValues );
51 virtual ~YQMultiProgressMeter();
54 * Overall thickness (in pixels) of the MultiProgressMeter.
59 * Overall length (in pixels) of the MultiProgressMeter.
64 * Returns the margin around the widget contents.
66 int margin() const { return _margin; }
69 * Sets the margin around the widget contents.
70 * Does not trigger an update.
72 void setMargin( int value ) { _margin = value; }
75 * Returns the spacing between segments in pixels.
77 int spacing() const { return _spacing; }
80 * Sets the spacing between segments in pixels.
81 * Does not trigger an update.
83 void setSpacing( int value ) { _spacing = value; }
86 * Returns the minimal length of a segment in pixels.
88 int segmentMinLength() const { return _segmentMinLength; }
91 * Set the minimal length of a segment in pixels.
93 void setSegmentMinLength( int val ) { _segmentMinLength = val; }
96 * Returns the thickness (base to point) of the small triangles next to the
97 * spacing between individual segments. The base length of those small
98 * triangles is double this value minus one. A value <1 indicates no
99 * such triangles will be drawn.
101 int triThickness() const { return _triThickness; }
104 * Set the thickness (base to point) of the small triangles next to the
105 * spacing between individual segments. The base length of those small
106 * triangles is double this value minus one.
108 * Use -1 to switch off those triangles - in which case triSpacing (see
109 * below) will be set to 0.
111 * This call does not trigger a screen update.
113 void setTriThickness( int value );
116 * Returns the spacing between the segment indicators and the small
117 * triangles next to the spacing between segments.
119 int triSpacing() const { return _triSpacing; }
122 * Sets the spacing between the segment indicators and the small
123 * triangles next to the spacing between segments.
125 void setTriSpacing( int value ) { _triSpacing = value; }
128 * Returns "true" if the segments of this widget are triangular shaped.
130 bool triangularShaped() const { return _triangularShaped; }
133 * Set triangular shape (true) or normal rectangular shape.
134 * This call does not trigger a screen update.
136 void setTriangularShaped( bool triangular = true );
139 * Set enabled/disabled state.
141 * Reimplemented from YWidget.
143 virtual void setEnabled( bool enabled );
146 * Preferred width of the widget.
148 * Reimplemented from YWidget.
150 virtual int preferredWidth();
153 * Preferred height of the widget.
155 * Reimplemented from YWidget.
157 virtual int preferredHeight();
160 * Set the new size of the widget.
162 * Reimplemented from YWidget.
164 virtual void setSize( int newWidth, int newHeight );
170 * Common initialization
175 * Perform a visual update on the screen.
176 * Reimplemented from YMultiProgressMeter.
178 virtual void doUpdate();
181 * Paint the widget's contents.
182 * Reimplemented from QWidget.
184 virtual void paintEvent ( QPaintEvent * );
187 * Mouse double click -
189 * reimplemented from QWidget.
191 virtual void mouseDoubleClickEvent ( QMouseEvent * e );
194 * Draw segment number 'segment' with pixel length 'length' from pixel
195 * coordinate 'offset' on and fill it according to that segment's current
196 * value. 'painter' is set up previously to take rotating into account
197 * (horizontal / vertical).
199 void drawSegment( int segment,
207 * Draw markers between segments (or beside that spacing).
209 void drawMarkers( QPainter & painter, int offset, int thickness );
214 bool _triangularShaped;
217 int _segmentMinLength;
223 #endif // YQMultiProgressMeter_h