diff options
author | Mitch Curtis <mitch.curtis@theqtcompany.com> | 2016-04-26 15:51:50 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-04-27 16:02:50 +0000 |
commit | d6b32468667a4890cef6061f08c353a0d0cba43e (patch) | |
tree | 270287bd5725b4de6a8edc1b2809eb4adbd51e65 /src/quicktemplates2/qquickbutton.cpp | |
parent | 9e79b19a305960a3df7bd1c90675ba00cd972153 (diff) |
Move highlighted to subclasses that actually use it
Change-Id: I70468b35b2a3a03c6e2d557a67443291697c8b42
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickbutton.cpp')
-rw-r--r-- | src/quicktemplates2/qquickbutton.cpp | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquickbutton.cpp b/src/quicktemplates2/qquickbutton.cpp index 5f702818..cb5b2963 100644 --- a/src/quicktemplates2/qquickbutton.cpp +++ b/src/quicktemplates2/qquickbutton.cpp @@ -90,7 +90,23 @@ QT_BEGIN_NAMESPACE \sa {Customizing Button}, {Button Controls} */ -QQuickButton::QQuickButton(QQuickItem *parent) : QQuickAbstractButton(parent) +class QQuickButtonPrivate : public QQuickAbstractButtonPrivate +{ + Q_DECLARE_PUBLIC(QQuickButton) + +public: + QQuickButtonPrivate(); + + bool highlighted; +}; + +QQuickButtonPrivate::QQuickButtonPrivate() : + highlighted(false) +{ +} + +QQuickButton::QQuickButton(QQuickItem *parent) : + QQuickAbstractButton(*(new QQuickButtonPrivate), parent) { } @@ -124,4 +140,30 @@ QFont QQuickButton::defaultFont() const return QQuickControlPrivate::themeFont(QPlatformTheme::PushButtonFont); } +/*! + \qmlproperty bool QtQuick.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) + return; + + d->highlighted = highlighted; + emit highlightedChanged(); +} + QT_END_NAMESPACE |