diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/imports/controls/plugins.qmltypes | 3 | ||||
-rw-r--r-- | src/imports/templates/plugins.qmltypes | 3 | ||||
-rw-r--r-- | src/quicktemplates2/qquickabstractbutton.cpp | 23 | ||||
-rw-r--r-- | src/quicktemplates2/qquickabstractbutton_p.h | 2 | ||||
-rw-r--r-- | src/quicktemplates2/qquickbutton.cpp | 22 | ||||
-rw-r--r-- | src/quicktemplates2/qquickbutton_p.h | 3 | ||||
-rw-r--r-- | src/quicktemplates2/qquickmenuitem.cpp | 16 | ||||
-rw-r--r-- | src/quicktemplates2/qquickmenuitem_p.h | 3 |
8 files changed, 22 insertions, 53 deletions
diff --git a/src/imports/controls/plugins.qmltypes b/src/imports/controls/plugins.qmltypes index 0a89a8b0..de4e26f8 100644 --- a/src/imports/controls/plugins.qmltypes +++ b/src/imports/controls/plugins.qmltypes @@ -508,6 +508,7 @@ Module { Property { name: "down"; type: "bool" } Property { name: "pressed"; type: "bool"; isReadonly: true } Property { name: "checked"; type: "bool" } + Property { name: "checkable"; type: "bool" } Property { name: "autoExclusive"; type: "bool" } Property { name: "indicator"; type: "QQuickItem"; isPointer: true } Signal { name: "pressed" } @@ -559,7 +560,6 @@ Module { prototype: "QQuickAbstractButton" exports: ["QtQuick.Templates/Button 2.0"] exportMetaObjectRevisions: [0] - Property { name: "checkable"; type: "bool" } Property { name: "autoRepeat"; type: "bool" } Property { name: "highlighted"; type: "bool" } Property { name: "flat"; type: "bool" } @@ -894,7 +894,6 @@ Module { prototype: "QQuickAbstractButton" exports: ["QtQuick.Templates/MenuItem 2.0"] exportMetaObjectRevisions: [0] - Property { name: "checkable"; type: "bool" } Property { name: "highlighted"; type: "bool" } Signal { name: "triggered" } } diff --git a/src/imports/templates/plugins.qmltypes b/src/imports/templates/plugins.qmltypes index 31267ce2..6b644437 100644 --- a/src/imports/templates/plugins.qmltypes +++ b/src/imports/templates/plugins.qmltypes @@ -18,6 +18,7 @@ Module { Property { name: "down"; type: "bool" } Property { name: "pressed"; type: "bool"; isReadonly: true } Property { name: "checked"; type: "bool" } + Property { name: "checkable"; type: "bool" } Property { name: "autoExclusive"; type: "bool" } Property { name: "indicator"; type: "QQuickItem"; isPointer: true } Signal { name: "pressed" } @@ -69,7 +70,6 @@ Module { prototype: "QQuickAbstractButton" exports: ["QtQuick.Templates/Button 2.0"] exportMetaObjectRevisions: [0] - Property { name: "checkable"; type: "bool" } Property { name: "autoRepeat"; type: "bool" } Property { name: "highlighted"; type: "bool" } Property { name: "flat"; type: "bool" } @@ -404,7 +404,6 @@ Module { prototype: "QQuickAbstractButton" exports: ["QtQuick.Templates/MenuItem 2.0"] exportMetaObjectRevisions: [0] - Property { name: "checkable"; type: "bool" } Property { name: "highlighted"; type: "bool" } Signal { name: "triggered" } } diff --git a/src/quicktemplates2/qquickabstractbutton.cpp b/src/quicktemplates2/qquickabstractbutton.cpp index e7c34065..2615608f 100644 --- a/src/quicktemplates2/qquickabstractbutton.cpp +++ b/src/quicktemplates2/qquickabstractbutton.cpp @@ -330,6 +330,8 @@ void QQuickAbstractButton::setPressed(bool isPressed) \qmlproperty bool QtQuick.Controls::AbstractButton::checked This property holds whether the button is checked. + + \sa checkable */ bool QQuickAbstractButton::isChecked() const { @@ -352,11 +354,21 @@ void QQuickAbstractButton::setChecked(bool checked) emit checkedChanged(); } -// We define these in QQuickAbstractButton without exposing checkable as a -// property, and instead expose it as a property in QQuickButton. -// QQuickRadioButton, QQuickSwitch and QQuickCheckBox are checkable by default, -// but if we removed the checkable code from here, they'd each have to -// duplicate it. +/*! + \qmlproperty bool QtQuick.Controls::AbstractButton::checkable + + This property holds whether the button is checkable. + + A checkable button toggles between checked (on) and unchecked (off) when + the user clicks on it or presses the space bar while the button has active + focus. + + Setting \l checked to \c true forces this property to \c true. + + The default value is \c false. + + \sa checked +*/ bool QQuickAbstractButton::isCheckable() const { Q_D(const QQuickAbstractButton); @@ -372,6 +384,7 @@ void QQuickAbstractButton::setCheckable(bool checkable) d->checkable = checkable; setAccessibleProperty("checkable", checkable); checkableChange(); + emit checkableChanged(); } /*! diff --git a/src/quicktemplates2/qquickabstractbutton_p.h b/src/quicktemplates2/qquickabstractbutton_p.h index 779739de..97b5c06b 100644 --- a/src/quicktemplates2/qquickabstractbutton_p.h +++ b/src/quicktemplates2/qquickabstractbutton_p.h @@ -61,6 +61,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickAbstractButton : public QQuickContr Q_PROPERTY(bool down READ isDown WRITE setDown NOTIFY downChanged RESET resetDown FINAL) Q_PROPERTY(bool pressed READ isPressed NOTIFY pressedChanged FINAL) Q_PROPERTY(bool checked READ isChecked WRITE setChecked NOTIFY checkedChanged FINAL) + Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable NOTIFY checkableChanged FINAL) Q_PROPERTY(bool autoExclusive READ autoExclusive WRITE setAutoExclusive NOTIFY autoExclusiveChanged FINAL) Q_PROPERTY(QQuickItem *indicator READ indicator WRITE setIndicator NOTIFY indicatorChanged FINAL) @@ -107,6 +108,7 @@ Q_SIGNALS: void downChanged(); void pressedChanged(); void checkedChanged(); + void checkableChanged(); void autoExclusiveChanged(); void indicatorChanged(); diff --git a/src/quicktemplates2/qquickbutton.cpp b/src/quicktemplates2/qquickbutton.cpp index 3d00e40c..b11d2179 100644 --- a/src/quicktemplates2/qquickbutton.cpp +++ b/src/quicktemplates2/qquickbutton.cpp @@ -96,28 +96,6 @@ QQuickButton::QQuickButton(QQuickButtonPrivate &dd, QQuickItem *parent) : } /*! - \qmlproperty bool QtQuick.Controls::Button::checkable - - This property holds whether the button is checkable. - - A checkable button toggles between checked (on) and unchecked (off) when - the user clicks on it or presses the space bar while the button has active - focus. - - Setting \l {AbstractButton::}{checked} to \c true forces this property to - \c true. - - The default value is \c false. - - \sa CheckBox, Switch -*/ - -void QQuickButton::checkableChange() -{ - emit checkableChanged(); -} - -/*! \qmlproperty bool QtQuick.Controls::Button::autoRepeat This property holds whether the button repeats diff --git a/src/quicktemplates2/qquickbutton_p.h b/src/quicktemplates2/qquickbutton_p.h index 95f94f10..5edbbe4e 100644 --- a/src/quicktemplates2/qquickbutton_p.h +++ b/src/quicktemplates2/qquickbutton_p.h @@ -57,7 +57,6 @@ class QQuickButtonPrivate; class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickButton : public QQuickAbstractButton { Q_OBJECT - 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) @@ -72,7 +71,6 @@ public: void setFlat(bool flat); Q_SIGNALS: - void checkableChanged(); void autoRepeatChanged(); void highlightedChanged(); void flatChanged(); @@ -80,7 +78,6 @@ Q_SIGNALS: protected: QQuickButton(QQuickButtonPrivate &dd, QQuickItem *parent); - void checkableChange() override; void autoRepeatChange() override; QFont defaultFont() const override; diff --git a/src/quicktemplates2/qquickmenuitem.cpp b/src/quicktemplates2/qquickmenuitem.cpp index 564d3f38..cb23df07 100644 --- a/src/quicktemplates2/qquickmenuitem.cpp +++ b/src/quicktemplates2/qquickmenuitem.cpp @@ -110,22 +110,6 @@ QQuickMenuItem::QQuickMenuItem(QQuickItem *parent) : connect(this, &QQuickAbstractButton::clicked, this, &QQuickMenuItem::triggered); } -/*! - \qmlproperty bool QtQuick.Controls::MenuItem::checkable - - This property holds whether the menu item is checkable. - - A checkable menu item toggles between checked (on) and unchecked (off) when - the user clicks on it or interacts with it via the keyboard. - - \sa {AbstractButton::}{checked} -*/ - -void QQuickMenuItem::checkableChange() -{ - emit checkableChanged(); -} - QFont QQuickMenuItem::defaultFont() const { return QQuickControlPrivate::themeFont(QPlatformTheme::MenuItemFont); diff --git a/src/quicktemplates2/qquickmenuitem_p.h b/src/quicktemplates2/qquickmenuitem_p.h index 6c717e13..258a096f 100644 --- a/src/quicktemplates2/qquickmenuitem_p.h +++ b/src/quicktemplates2/qquickmenuitem_p.h @@ -57,7 +57,6 @@ class QQuickMenuItemPrivate; class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickMenuItem : public QQuickAbstractButton { Q_OBJECT - Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable NOTIFY checkableChanged FINAL) Q_PROPERTY(bool highlighted READ isHighlighted WRITE setHighlighted NOTIFY highlightedChanged FINAL) public: @@ -67,12 +66,10 @@ public: void setHighlighted(bool highlighted); Q_SIGNALS: - void checkableChanged(); void triggered(); void highlightedChanged(); protected: - void checkableChange() override; QFont defaultFont() const override; #ifndef QT_NO_ACCESSIBILITY |