diff options
author | Mitch Curtis <mitch.curtis@theqtcompany.com> | 2015-11-13 11:35:16 +0100 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@theqtcompany.com> | 2015-11-13 14:57:52 +0000 |
commit | 4cd3cd7cbec2a6713ba146b7036652f6916cab1e (patch) | |
tree | 7e7e599a735d623f9987b5a8f27ac037a394664d /src/templates/qquickbutton.cpp | |
parent | a6dc0e2462086b42e878a3f4e94216dd1c8bcc63 (diff) |
Button: add highlighted property
Since our focus is on embedded, this will be used as an alternative to
the "isDefault" property that exists in Qt Quick Controls.
Change-Id: I9b6612e3c3b30040295aeea6d217e90a17af4ebe
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/templates/qquickbutton.cpp')
-rw-r--r-- | src/templates/qquickbutton.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/templates/qquickbutton.cpp b/src/templates/qquickbutton.cpp index 179e5bcd..7ec87cbf 100644 --- a/src/templates/qquickbutton.cpp +++ b/src/templates/qquickbutton.cpp @@ -83,11 +83,45 @@ QT_BEGIN_NAMESPACE class QQuickButtonPrivate : public QQuickAbstractButtonPrivate { +public: + QQuickButtonPrivate(); + + bool highlighted; }; +QQuickButtonPrivate::QQuickButtonPrivate() : + highlighted(false) +{ +} + QQuickButton::QQuickButton(QQuickItem *parent) : QQuickAbstractButton(*(new QQuickButtonPrivate), parent) { } +/*! + \qmlproperty bool Qt.labs.controls::Button::highlighted + + This property holds whether the button is highlighted. + + A button can be highlighted in order to draw the user's attention towards + it. It has no effect on keyboard interaction. + + The default value is \c false. +*/ +bool QQuickButton::isHighlighted() const +{ + Q_D(const QQuickButton); + return d->highlighted; +} + +void QQuickButton::setHighlighted(bool highlighted) +{ + Q_D(QQuickButton); + if (highlighted != d->highlighted) { + d->highlighted = highlighted; + emit highlightedChanged(); + } +} + QT_END_NAMESPACE |