Qt5WayButton Class Reference

The Qt5WayButton provides a button group with SVG graphics. More...

Collaboration diagram for Qt5WayButton:
[legend]

List of all members.

Public Member Functions

 Qt5WayButton (QWidget *parent=0)
virtual ~Qt5WayButton ()
QAbstractButton * upButton ()
QAbstractButton * downButton ()
QAbstractButton * leftButton ()
QAbstractButton * rightButton ()
QAbstractButton * centerButton ()
void setSkin (const QString &skin)
QString skin () const

Protected Member Functions

virtual void resizeEvent (QResizeEvent *event)
virtual void paintEvent (QPaintEvent *event)
virtual int heightForWidth (int w) const

Properties

QString skin

Detailed Description

The Qt5WayButton provides a button group with SVG graphics.

Qt5WayButton is a widget that consists of five Buttons, one on any edge and one in the middle of the widget. Each button is represented as a QAbstractButton and can be accessed with the methods upButton(), downButton(), leftButton(), rightButton(), centerButton(). The returned buttons can then be used to connect signals and slots or to change properties like the checkable state.

Example Usage

The following example shows how to create a Qt5WayButton.

    Qt5WayButton* button = new Qt5WayButton(parent);
    button->setSkin("Beryl");
    QObject::connect(button->upButton(), SIGNAL(clicked()), this, SLOT(moveUp()));

Setting a Skin

After creating a new Qt5WayButton a skin needs to be set by calling setSkin(). Without a skin set, a Qt5WayButton will not have any visible content. skin() returns the current skin. Further details about skinning the Qt5WayButton can be found in the widget description.


Constructor & Destructor Documentation

Qt5WayButton::Qt5WayButton ( QWidget *  parent = 0  )  [explicit]

Constructor of the widget with parent as Parent.

Qt5WayButton::~Qt5WayButton (  )  [virtual]

Destructor


Member Function Documentation

QAbstractButton * Qt5WayButton::centerButton (  ) 

This function returns the actual pointer from the centerButton. Here you can connect to the Signals/Slots from QAbstractButton

        Qt5WayButton * button = new Qt5WayButton(this);
        QObject::connect(button->upButton(), (pressed()), button->centerButton(), (clicked()));
QAbstractButton * Qt5WayButton::downButton (  ) 

This function returns the actual pointer from the downButton. Here you can connect to the Signals/Slots from QAbstractButton

        Qt5WayButton * button = new Qt5WayButton(this);
        QObject::connect(button->upButton(), (pressed()), button->downButton(), (clicked()));
int Qt5WayButton::heightForWidth ( int  w  )  const [protected, virtual]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. To be sure that the width and the height are always the same size.

QAbstractButton * Qt5WayButton::leftButton (  ) 

This function returns the actual pointer from the leftButton. Here you can connect to the Signals/Slots from QAbstractButton

        Qt5WayButton * button = new Qt5WayButton(this);
        QObject::connect(button->leftButton(), (pressed()), button->rightButton(), (clicked()));
void Qt5WayButton::paintEvent ( QPaintEvent *  event  )  [protected, virtual]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. The paintEvent() draws the Qt5WayButton and shows the actual state "normal", "hovered", "clicked" from the button.

void Qt5WayButton::resizeEvent ( QResizeEvent *  event  )  [protected, virtual]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

QAbstractButton * Qt5WayButton::rightButton (  ) 

This function returns the actual pointer from the rightButton. Here you can connect to the Signals/Slots from QAbstractButton

        Qt5WayButton * button = new Qt5WayButton(this);
        QObject::connect(button->leftButton(), (pressed()), button->rightButton(), (clicked()));
void Qt5WayButton::setSkin ( const QString &  skin  ) 

With this function you can set the skin that will be displayed in the widget.

        Qt5WayButton * button = new Qt5WayButton(this);
        button->setSkin("Beryl");

This function has to be called before using the Qt5WayButton.

See also:
skin()
QAbstractButton * Qt5WayButton::upButton (  ) 

This function returns the actual pointer from the upButton. Here you can connect to the Signals/Slots from QAbstractButton

        Qt5WayButton * button = new Qt5WayButton(this);
        QObject::connect(button->upButton(), (pressed()), button->downButton(), (clicked()));

Property Documentation

QString Qt5WayButton::skin [read, write]

This function returns the actual skin name. If no skin has been set the return value is "".

        Qt5WayButton * button = new Qt5WayButton(this);
        button->setSkin("Beryl");
        qDebug() << button->skin();
See also:
setSkin()

The documentation for this class was generated from the following files:

Generated on Wed Nov 25 17:57:34 2009 for Embedded Widgets by  doxygen 1.6.1