aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2
diff options
context:
space:
mode:
Diffstat (limited to 'src/quicktemplates2')
-rw-r--r--src/quicktemplates2/qquickbutton.cpp28
-rw-r--r--src/quicktemplates2/qquickbutton_p.h5
2 files changed, 32 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquickbutton.cpp b/src/quicktemplates2/qquickbutton.cpp
index cb5b2963..465e82de 100644
--- a/src/quicktemplates2/qquickbutton.cpp
+++ b/src/quicktemplates2/qquickbutton.cpp
@@ -97,11 +97,12 @@ class QQuickButtonPrivate : public QQuickAbstractButtonPrivate
public:
QQuickButtonPrivate();
+ bool flat;
bool highlighted;
};
QQuickButtonPrivate::QQuickButtonPrivate() :
- highlighted(false)
+ flat(false), highlighted(false)
{
}
@@ -166,4 +167,29 @@ void QQuickButton::setHighlighted(bool highlighted)
emit highlightedChanged();
}
+/*!
+ \qmlproperty bool QtQuick.Controls::Button::flat
+
+ This property holds whether the button is flat.
+
+ A flat button typically does not draw a background unless it is pressed or checked.
+
+ The default value is \c false.
+*/
+bool QQuickButton::isFlat() const
+{
+ Q_D(const QQuickButton);
+ return d->flat;
+}
+
+void QQuickButton::setFlat(bool flat)
+{
+ Q_D(QQuickButton);
+ if (flat == d->flat)
+ return;
+
+ d->flat = flat;
+ emit flatChanged();
+}
+
QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickbutton_p.h b/src/quicktemplates2/qquickbutton_p.h
index 36eb4359..fafce150 100644
--- a/src/quicktemplates2/qquickbutton_p.h
+++ b/src/quicktemplates2/qquickbutton_p.h
@@ -60,6 +60,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickButton : public QQuickAbstractButto
Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable NOTIFY checkableChanged FINAL)
Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat NOTIFY autoRepeatChanged FINAL)
Q_PROPERTY(bool highlighted READ isHighlighted WRITE setHighlighted NOTIFY highlightedChanged FINAL)
+ Q_PROPERTY(bool flat READ isFlat WRITE setFlat NOTIFY flatChanged FINAL)
public:
explicit QQuickButton(QQuickItem *parent = nullptr);
@@ -67,10 +68,14 @@ public:
bool isHighlighted() const;
void setHighlighted(bool highlighted);
+ bool isFlat() const;
+ void setFlat(bool flat);
+
Q_SIGNALS:
void checkableChanged();
void autoRepeatChanged();
void highlightedChanged();
+ void flatChanged();
protected:
void checkableChange() override;