The QtSvgSlideSwitch class provides a slide switch with SVG graphics. More...
#include <qtsvgslideswitch.h>
Public Member Functions | |
QtSvgSlideSwitch (QWidget *parent=0) | |
QtSvgSlideSwitch (const QString &text, QWidget *parent=0) | |
QtSvgSlideSwitch (const QIcon &icon, const QString &text, QWidget *parent=0) | |
virtual | ~QtSvgSlideSwitch () |
void | setSkin (const QString &skin) |
QString | skin () const |
Properties | |
QString | skin |
The QtSvgSlideSwitch class provides a slide switch with SVG graphics.
The description of the QtSvgSlideSwitch.
The QtSvgSlideSwitch is an example to show the capabilities of the Qt Framework related to customized controls.
Here is a possible implementation shown
// Create a QtSvgSlideSwitch QWidget * widget = new QWidget(this) QtBasicGraph * button = new QtSvgSlideSwitch(widget); button->setSkin("Beryl"); widget->addWidget(button); widget->show();
The QtSvgSlideSwitch is a Button that can be dragged and moved to one diffrent state. It is like an on/off Button and a inherited QAbstractButton.
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.
No Signals are defined.
private Slots:
QtSvgSlideSwitch::QtSvgSlideSwitch | ( | QWidget * | parent = 0 |
) | [explicit] |
Constructor of the widget with parent
as Parent.
QtSvgSlideSwitch::~QtSvgSlideSwitch | ( | ) | [virtual] |
Destructor
void QtSvgSlideSwitch::setSkin | ( | const QString & | skin | ) |
With this function you can set the skin that will be displayed in the widget.
QtSvgSlideSwitch * button = new QtSvgSlideSwitch(this); button->setSkin("Beryl");
This function has to be called before using the QtSvgSlideSwitch.
QString QtSvgSlideSwitch::skin [read, write] |
This function returns the actual skin name. If no skin has been set the return value is "".
QtSvgSlideSwitch * button = new QtSvgSlideSwitch(this); button->setSkin("Beryl"); qDebug() << button->skin();