| Home · All Classes · Main Classes · Deprecated |
View class for standard push buttons. More...


Public Member Functions | |
| MButtonView (MButton *controller) | |
| virtual | ~MButtonView () |
Protected Member Functions | |
| virtual void | drawIcon (QPainter *painter, const QRectF &iconRect) const |
View class for standard push buttons.
|
|
MButtonView is used to visualize push buttons and toggle buttons. The view draws a fixed background and an icon, text or both on top of it. If the view is for a checkable button, it uses a different background and different text color for the checked state.
The outlook of button can be changed using the styling attributes defined in MButtonStyle and MWidgetStyle. MWidgetStyle::backgroundImage, MWidgetStyle::backgroundColor and MWidgetStyle::backgroundOpacity can be used to change appearance of the button itself. If background image is not defined then the background is drawn with solid color. The icon and text position and outlook can be changed through MButtonStyle. Following rules apply:
A button can be in one of the following functional states:
The Push Button does not support long press functionality, so it makes no difference how long the button is held down. If user presses a button and drags while it is in a pannable area, then button follows the finger and tactile feedback is cancel. When releasing the finger after panning, the button interaction is not activated.
Definition at line 105 of file views/mbuttonview.h.
| MButtonView::MButtonView | ( | MButton * | controller | ) |
Constructs the view.
| Pointer | to the controller. |
Definition at line 369 of file mbuttonview.cpp.
:
MWidgetView(* new MButtonViewPrivate, controller)
{
Q_D(MButtonView);
d->label = new MLabel(controller);
d->label->setParentItem(controller);
d->label->setTextElide(true);
d->label->setObjectName("ButtonLabel");
d->label->setMinimumSize(0,0);
d->styleModeChangeTimer = new QTimer(this);
d->styleModeChangeTimer->setSingleShot(true);
connect(d->styleModeChangeTimer, SIGNAL(timeout()), SLOT(_q_applyQueuedStyleModeChange()));
}

| MButtonView::~MButtonView | ( | ) | [virtual] |
Destructs the view.
Definition at line 399 of file mbuttonview.cpp.
{
Q_D(MButtonView);
if (d->label) {
delete d->label;
d->label = 0;
}
}
| void MButtonView::drawIcon | ( | QPainter * | painter, | |
| const QRectF & | iconRect | |||
| ) | const [protected, virtual] |
Draws the button icon (toggled or normal depending on the state of the button) into the given iconRect.
Definition at line 427 of file mbuttonview.cpp.
{
if (model()->iconVisible()) {
Q_D(const MButtonView);
bool toggleState = d->toggleState();
const QPixmap *pixmap = NULL;
if (toggleState && d->toggledIcon)
pixmap = d->toggledIcon->pixmap;
else if (d->icon)
pixmap = d->icon->pixmap;
if (pixmap)
painter->drawPixmap(iconRect, *pixmap, QRectF(pixmap->rect()));
}
}

| Copyright © 2010 Nokia Corporation | Generated on Thu Nov 4 2010 18:14:24 (PDT) Doxygen 1.7.1 |
MeeGo Touch |