The QtSvgToggleSwitch class provides a toggle switch. More...
#include <qtsvgtoggleswitch.h>
Public Member Functions | |
QtSvgToggleSwitch (QWidget *parent=0) | |
virtual | ~QtSvgToggleSwitch () |
void | setSkin (const QString &skin) |
QString | skin () const |
virtual QSize | sizeHint () const |
Protected Member Functions | |
void | paintEvent (QPaintEvent *event) |
Properties | |
QString | skin |
The QtSvgToggleSwitch class provides a toggle switch.
The description of the QtSvgToggleSwitch.
The QtSvgToggleSwitch is an example to show the capabilities of the Qt Framework related to customized controls.
Here is a possible implementation shown
// Create a QtSvgToggleSwitch QWidget * widget = new QWidget(this) QtSvgToggleSwitch * switch = new QtSvgToggleSwitch(widget); switch->setSkin("Beryl"); widget->addWidget(switch); widget->show();
It is important to call the function setSkin() to load a skin. If setSkin() is not called the QtSvgToggleSwitch 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.
No Signals defined.
No Slots defined.
QtSvgToggleSwitch::QtSvgToggleSwitch | ( | QWidget * | parent = 0 |
) | [explicit] |
Constructor of the QtMultiSliderHelper. The parent object holds the Parent of the QAbstractButton.
QtSvgToggleSwitch::~QtSvgToggleSwitch | ( | ) | [virtual] |
Destructor
void QtSvgToggleSwitch::setSkin | ( | const QString & | skin | ) |
With this function you can set the skin that will be displayed in the widget.
QtSvgToggleSwitch * switch = new QtSvgToggleSwitch(this); switch->setSkin("Beryl");
This function has to be called before using the QtSvgToggleSwitch.
QString QtSvgToggleSwitch::skin [read, write] |
This function returns the actual skin name. If no skin has been set the return value is "".
QtSvgToggleSwitch * switch = new QtSvgToggleSwitch(this); switch->setSkin("Beryl"); qDebug() << switch->skin();