#include <QY2BarGraph.h>
Public Member Functions | |
QY2BarGraph (QWidget *parent=0, const char *name=0) | |
void | addSegment (const QString &label=QString(), int value=0) |
void | setSegments (int segmentCount) |
void | setValue (int segmentNo, int newValue) |
void | setLabel (int segmentNo, const QString &newLabel) |
int | segments () const |
int | value (int segmentNo) const |
const QString | label (int segmentNo) const |
int | sumValues () const |
const QColor | segmentBackgroundColor (int segmentNo) |
const QColor | segmentForegroundColor (int segmentNo) |
virtual QSize | sizeHint () const |
Protected Member Functions | |
virtual void | drawContents (QPainter *) |
bool | index_invalid (int i, const char *function_name) const |
Private Attributes | |
vector< int > | _values |
vector< QString > | _labels |
|
|
|
Add one segment to the bar graph. |
|
Draw the graph bar contents. Inherited from QFrame. |
|
Sanity check for segment index. Returns true if invalid, false if OK. |
|
Return the label of segment no. segmentNo. Any occurence of "%d" etc. will not be expanded here but returned as passed to setLabel(). |
|
Choose a background color suitable for segment no. segmentNo. Only a defined number of different colors are available. After that, previously used colors will be recycled. |
|
Choose a foreground color suitable for segment no. segmentNo. that results in good contrast to the corresponding background color ( see abore ) |
|
Return the current number of segments. |
|
Set the label of segment no. segmentNo ( beginning with 0 ) to newLabel. May contain newlines or d for a reference to the current value. |
|
Set the number of segments. Initialize all values and labels to zero values. |
|
Set the value of segment no. segmentNo ( beginning with 0 ) to value newValue. |
|
Return a suitable size for the widget. |
|
Return the sum of all values, |
|
Return the current value of segment no. segmentNo. |
|
|
|
|