aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@theqtcompany.com>2015-11-13 11:35:16 +0100
committerMitch Curtis <mitch.curtis@theqtcompany.com>2015-11-13 14:57:52 +0000
commit4cd3cd7cbec2a6713ba146b7036652f6916cab1e (patch)
tree7e7e599a735d623f9987b5a8f27ac037a394664d /src
parenta6dc0e2462086b42e878a3f4e94216dd1c8bcc63 (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')
-rw-r--r--src/templates/qquickbutton.cpp34
-rw-r--r--src/templates/qquickbutton_p.h7
2 files changed, 41 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
diff --git a/src/templates/qquickbutton_p.h b/src/templates/qquickbutton_p.h
index 1ee96a07..7ca0252b 100644
--- a/src/templates/qquickbutton_p.h
+++ b/src/templates/qquickbutton_p.h
@@ -57,10 +57,17 @@ class QQuickButtonPrivate;
class Q_LABSTEMPLATES_EXPORT QQuickButton : public QQuickAbstractButton
{
Q_OBJECT
+ Q_PROPERTY(bool highlighted READ isHighlighted WRITE setHighlighted NOTIFY highlightedChanged FINAL)
public:
explicit QQuickButton(QQuickItem *parent = Q_NULLPTR);
+ bool isHighlighted() const;
+ void setHighlighted(bool highlighted);
+
+Q_SIGNALS:
+ void highlightedChanged();
+
private:
Q_DISABLE_COPY(QQuickButton)
Q_DECLARE_PRIVATE(QQuickButton)