The QtSvgDialGauge class provides a dial gauge with SVG graphics. More...
#include <qtsvgdialgauge.h>
Public Slots | |
void | setValue (int value) |
Public Member Functions | |
QtSvgDialGauge (QWidget *parent=0) | |
~QtSvgDialGauge () | |
void | setSkin (const QString &skin) |
QString | skin () const |
void | setMinimum (int minimum) |
void | setMaximum (int maximum) |
void | setNeedleOrigin (qreal x, qreal y) |
void | setStartAngle (qreal angle) |
void | setEndAngle (qreal angle) |
int | value () const |
int | minimum () const |
int | maximum () const |
qreal | needleOriginX () const |
qreal | needleOriginY () const |
qreal | startAngle () const |
qreal | endAngle () const |
virtual QSize | minimumSizeHint () const |
virtual QSize | sizeHint () const |
void | setShowOverlay (bool) |
Protected Member Functions | |
void | paintEvent (QPaintEvent *event) |
Properties | |
QString | skin |
int | minimum |
int | maximum |
qreal | startAngle |
qreal | endAngle |
The QtSvgDialGauge class provides a dial gauge with SVG graphics.
The description of the QtSvgDialGauge.
The QtSvgDialGauge is an example to show the capabilities of the Qt Framework related to customized controls.
Here is a possible implementation shown
// Create a QtSvgDialGauge QWidget * widget = new QWidget(this) QtSvgDialGauge * gauge = new QtSvgDialGauge(widget); gauge->setSkin("Beryl"); gauge->setNeedleOrigin(0.486, 0.466); gauge->setMinimum(0); gauge->setMaximum(360); gauge->setStartAngle(-130); gauge->setEndAngle(133); gauge->setValue(0); gauge->setMaximumSize(64, 64); widget->addWidget(gauge); widget->show();
It is important to call the function setSkin() to load a skin. If setSkin() is not called the Button will not have any visible content. The parameter skin
has the skin name. The skins are in the resource file defined in the project file. The name scheme in the resource file is "Skin Name"/"unique picture name.svg".
The setSkin() function loads the diffrent skins over the "Skin name". The needed realised graphics for this control are "normal.svg", "hovered.svg" and "pressed.svg". If you want to add new skins, they have to follow the name scheme to work.
The actual skin can be read over the skin() function.
The function setNeedleOrigin() sets the origin position of the needle. With setMinimum() the smallest possible value can be set. With setMaximum() the biggest possible value can be set. The possible angle can be set over the start angle setStartAngle() to the end angle setEndAngle(). The actual value is set over setValue(). The maximum size of the widget is set with the function setMaximumSize().
No Signals are defined.
Slots
QtSvgDialGauge::QtSvgDialGauge | ( | QWidget * | parent = 0 |
) | [explicit] |
Constructor of the widget with parent
as Parent.
QtSvgDialGauge::~QtSvgDialGauge | ( | ) |
Destructor
qreal QtSvgDialGauge::needleOriginX | ( | ) | const |
The function returns the needle origin x.
qreal QtSvgDialGauge::needleOriginY | ( | ) | const |
The function returns the needle origin y.
void QtSvgDialGauge::setEndAngle | ( | qreal | angle | ) |
The function sets the end angle, the highest possible angle.
void QtSvgDialGauge::setMaximum | ( | int | maximum | ) |
The function sets the bigest possible value.
void QtSvgDialGauge::setMinimum | ( | int | minimum | ) |
The function sets the smallest possible value.
void QtSvgDialGauge::setNeedleOrigin | ( | qreal | x, | |
qreal | y | |||
) |
The function sets the needle origin in the widget.
void QtSvgDialGauge::setSkin | ( | const QString & | skin | ) |
With this function you can set the skin that will be displayed in the widget.
QtSvgDialGauge * gauge = new QtSvgDialGauge(this); gauge->setSkin("Beryl");
This function has to be called before using the QtSvgDialGauge.
void QtSvgDialGauge::setStartAngle | ( | qreal | angle | ) |
The function sets the start angle, the smallest possible angle.
void QtSvgDialGauge::setValue | ( | int | value | ) | [slot] |
With the parameter value
the actual value is set.
int QtSvgDialGauge::value | ( | ) | const |
The function returns the actual set value.
qreal QtSvgDialGauge::endAngle [read, write] |
The function returns the end angle.
int QtSvgDialGauge::maximum [read, write] |
The function returns the current maximum value.
int QtSvgDialGauge::minimum [read, write] |
The function returns the current minimum value.
QString QtSvgDialGauge::skin [read, write] |
This function returns the actual skin name. If no skin has been set the return value is empty.
QtSvgDialGauge * gauge = new QtSvgDialGauge(this); gauge->setSkin("Beryl"); qDebug() << gauge->skin();
qreal QtSvgDialGauge::startAngle [read, write] |
The function returns the start angle.