The QtSvgButton class provides a Button, that can change the display style. More...
#include <qtsvgbutton.h>
Public Member Functions | |
QtSvgButton (QWidget *parent=0) | |
~QtSvgButton () | |
void | setSkin (const QString &skin) |
QString | skin () const |
virtual QSize | sizeHint () const |
Protected Member Functions | |
virtual void | paintEvent (QPaintEvent *event) |
Properties | |
QString | skin |
The QtSvgButton class provides a Button, that can change the display style.
The description of the QtSvgButton.
The QtSvgButton is an example to show the capabilities of the Qt Framework related to customized controls.
Here is a possible implementation shown
// Create a QtSvgButton QWidget * widget = new QWidget(this) QtSvgButton * button = new QtSvgButton(widget); butten->setSkin("Beryl"); widget->addWidget(button); 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.
No Signals are defined.
No Slots are defined.
QtSvgButton::QtSvgButton | ( | QWidget * | parent = 0 |
) | [explicit] |
Constructor of the QtSvgButton. The parent object holds the Parent of the Widget.
QtSvgButton::~QtSvgButton | ( | ) |
Destructor
void QtSvgButton::paintEvent | ( | QPaintEvent * | event | ) | [protected, virtual] |
void QtSvgButton::setSkin | ( | const QString & | skin | ) |
With this function you can set the skin that will be displayed in the widget.
QtSvgButton * button = new QtSvgButton(this); button->setSkin("Beryl");
This function has to be called before using the QSvgButton.
QSize QtSvgButton::sizeHint | ( | ) | const [virtual] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Return size hint provided by the SVG graphics. Can be changed during runtime.
QString QtSvgButton::skin [read, write] |
This function returns the actual skin name. If no skin has been set the return value is "".
QtSvgButton * button = new QtSvgButton(this); button->setSkin("Beryl"); qDebug() << button->skin();