diff options
Diffstat (limited to 'src')
28 files changed, 469 insertions, 396 deletions
diff --git a/src/quicktemplates2/qquickabstractbutton_p.h b/src/quicktemplates2/qquickabstractbutton_p.h index 72038ee4..71884bf6 100644 --- a/src/quicktemplates2/qquickabstractbutton_p.h +++ b/src/quicktemplates2/qquickabstractbutton_p.h @@ -102,7 +102,6 @@ Q_SIGNALS: void released(); void canceled(); void clicked(); - Q_REVISION(2) void toggled(); void pressAndHold(); void doubleClicked(); void textChanged(); @@ -112,6 +111,8 @@ Q_SIGNALS: void checkableChanged(); void autoExclusiveChanged(); void indicatorChanged(); + // 2.2 (Qt 5.9) + Q_REVISION(2) void toggled(); protected: QQuickAbstractButton(QQuickAbstractButtonPrivate &dd, QQuickItem *parent); diff --git a/src/quicktemplates2/qquickbuttongroup_p.h b/src/quicktemplates2/qquickbuttongroup_p.h index 21deb035..bb32ed5c 100644 --- a/src/quicktemplates2/qquickbuttongroup_p.h +++ b/src/quicktemplates2/qquickbuttongroup_p.h @@ -83,6 +83,7 @@ public Q_SLOTS: Q_SIGNALS: void checkedButtonChanged(); void buttonsChanged(); + // 2.1 (Qt 5.8) Q_REVISION(1) void clicked(QQuickAbstractButton *button); private: diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp index 00785598..d22e09d5 100644 --- a/src/quicktemplates2/qquickcombobox.cpp +++ b/src/quicktemplates2/qquickcombobox.cpp @@ -759,124 +759,6 @@ QQmlInstanceModel *QQuickComboBox::delegateModel() const return d->delegateModel; } -/*! - \since QtQuick.Controls 2.2 (Qt 5.9) - \qmlproperty bool QtQuick.Controls::ComboBox::editable - - This property holds whether the combo box is editable. - - The default value is \c false. - - \sa validator -*/ -bool QQuickComboBox::isEditable() const -{ - Q_D(const QQuickComboBox); - return d->extra.isAllocated() && d->extra->editable; -} - -void QQuickComboBox::setEditable(bool editable) -{ - Q_D(QQuickComboBox); - if (editable == isEditable()) - return; - - if (d->contentItem) { - if (editable) { - d->contentItem->installEventFilter(this); - if (QQuickTextInput *input = qobject_cast<QQuickTextInput *>(d->contentItem)) { - QObjectPrivate::connect(input, &QQuickTextInput::textChanged, d, &QQuickComboBoxPrivate::updateEditText); - QObjectPrivate::connect(input, &QQuickTextInput::accepted, d, &QQuickComboBoxPrivate::acceptInput); - } -#if QT_CONFIG(cursor) - d->contentItem->setCursor(Qt::IBeamCursor); -#endif - } else { - d->contentItem->removeEventFilter(this); - if (QQuickTextInput *input = qobject_cast<QQuickTextInput *>(d->contentItem)) { - QObjectPrivate::disconnect(input, &QQuickTextInput::textChanged, d, &QQuickComboBoxPrivate::updateEditText); - QObjectPrivate::disconnect(input, &QQuickTextInput::accepted, d, &QQuickComboBoxPrivate::acceptInput); - } -#if QT_CONFIG(cursor) - d->contentItem->unsetCursor(); -#endif - } - } - - d->extra.value().editable = editable; - setAccessibleProperty("editable", editable); - emit editableChanged(); -} - -/*! - \since QtQuick.Controls 2.1 (Qt 5.8) - \qmlproperty bool QtQuick.Controls::ComboBox::flat - - This property holds whether the combo box button is flat. - - A flat combo box button does not draw a background unless it is interacted - with. In comparison to normal combo boxes, flat combo boxes provide looks - that make them stand out less from the rest of the UI. For instance, when - placing a combo box into a tool bar, it may be desirable to make the combo - box flat so it matches better with the flat looks of tool buttons. - - The default value is \c false. -*/ -bool QQuickComboBox::isFlat() const -{ - Q_D(const QQuickComboBox); - return d->flat; -} - -void QQuickComboBox::setFlat(bool flat) -{ - Q_D(QQuickComboBox); - if (d->flat == flat) - return; - - d->flat = flat; - emit flatChanged(); -} - -/*! - \since QtQuick.Controls 2.2 (Qt 5.9) - \qmlproperty bool QtQuick.Controls::ComboBox::down - - This property holds whether the combo box button is visually down. - - Unless explicitly set, this property is \c true when either \c pressed - or \c popup.visible is \c true. To return to the default value, set this - property to \c undefined. - - \sa pressed, popup -*/ -bool QQuickComboBox::isDown() const -{ - Q_D(const QQuickComboBox); - return d->down; -} - -void QQuickComboBox::setDown(bool down) -{ - Q_D(QQuickComboBox); - d->hasDown = true; - - if (d->down == down) - return; - - d->down = down; - emit downChanged(); -} - -void QQuickComboBox::resetDown() -{ - Q_D(QQuickComboBox); - if (!d->hasDown) - return; - - setDown(d->pressed || d->isPopupVisible()); - d->hasDown = false; -} /*! \qmlproperty bool QtQuick.Controls::ComboBox::pressed @@ -1006,34 +888,6 @@ void QQuickComboBox::resetDisplayText() d->updateCurrentText(); } -/*! - \since QtQuick.Controls 2.2 (Qt 5.9) - \qmlproperty string QtQuick.Controls::ComboBox::editText - - This property holds the text in the text field of an editable combo box. - - \sa editable -*/ -QString QQuickComboBox::editText() const -{ - Q_D(const QQuickComboBox); - return d->extra.isAllocated() ? d->extra->editText : QString(); -} - -void QQuickComboBox::setEditText(const QString &text) -{ - Q_D(QQuickComboBox); - if (text == editText()) - return; - - d->extra.value().editText = text; - emit editTextChanged(); -} - -void QQuickComboBox::resetEditText() -{ - setEditText(QString()); -} /*! \qmlproperty string QtQuick.Controls::ComboBox::textRole @@ -1173,6 +1027,154 @@ void QQuickComboBox::setPopup(QQuickPopup *popup) } /*! + \since QtQuick.Controls 2.1 (Qt 5.8) + \qmlproperty bool QtQuick.Controls::ComboBox::flat + + This property holds whether the combo box button is flat. + + A flat combo box button does not draw a background unless it is interacted + with. In comparison to normal combo boxes, flat combo boxes provide looks + that make them stand out less from the rest of the UI. For instance, when + placing a combo box into a tool bar, it may be desirable to make the combo + box flat so it matches better with the flat looks of tool buttons. + + The default value is \c false. +*/ +bool QQuickComboBox::isFlat() const +{ + Q_D(const QQuickComboBox); + return d->flat; +} + +void QQuickComboBox::setFlat(bool flat) +{ + Q_D(QQuickComboBox); + if (d->flat == flat) + return; + + d->flat = flat; + emit flatChanged(); +} + +/*! + \since QtQuick.Controls 2.2 (Qt 5.9) + \qmlproperty bool QtQuick.Controls::ComboBox::down + + This property holds whether the combo box button is visually down. + + Unless explicitly set, this property is \c true when either \c pressed + or \c popup.visible is \c true. To return to the default value, set this + property to \c undefined. + + \sa pressed, popup +*/ +bool QQuickComboBox::isDown() const +{ + Q_D(const QQuickComboBox); + return d->down; +} + +void QQuickComboBox::setDown(bool down) +{ + Q_D(QQuickComboBox); + d->hasDown = true; + + if (d->down == down) + return; + + d->down = down; + emit downChanged(); +} + +void QQuickComboBox::resetDown() +{ + Q_D(QQuickComboBox); + if (!d->hasDown) + return; + + setDown(d->pressed || d->isPopupVisible()); + d->hasDown = false; +} + +/*! + \since QtQuick.Controls 2.2 (Qt 5.9) + \qmlproperty bool QtQuick.Controls::ComboBox::editable + + This property holds whether the combo box is editable. + + The default value is \c false. + + \sa validator +*/ +bool QQuickComboBox::isEditable() const +{ + Q_D(const QQuickComboBox); + return d->extra.isAllocated() && d->extra->editable; +} + +void QQuickComboBox::setEditable(bool editable) +{ + Q_D(QQuickComboBox); + if (editable == isEditable()) + return; + + if (d->contentItem) { + if (editable) { + d->contentItem->installEventFilter(this); + if (QQuickTextInput *input = qobject_cast<QQuickTextInput *>(d->contentItem)) { + QObjectPrivate::connect(input, &QQuickTextInput::textChanged, d, &QQuickComboBoxPrivate::updateEditText); + QObjectPrivate::connect(input, &QQuickTextInput::accepted, d, &QQuickComboBoxPrivate::acceptInput); + } +#if QT_CONFIG(cursor) + d->contentItem->setCursor(Qt::IBeamCursor); +#endif + } else { + d->contentItem->removeEventFilter(this); + if (QQuickTextInput *input = qobject_cast<QQuickTextInput *>(d->contentItem)) { + QObjectPrivate::disconnect(input, &QQuickTextInput::textChanged, d, &QQuickComboBoxPrivate::updateEditText); + QObjectPrivate::disconnect(input, &QQuickTextInput::accepted, d, &QQuickComboBoxPrivate::acceptInput); + } +#if QT_CONFIG(cursor) + d->contentItem->unsetCursor(); +#endif + } + } + + d->extra.value().editable = editable; + setAccessibleProperty("editable", editable); + emit editableChanged(); +} + +/*! + \since QtQuick.Controls 2.2 (Qt 5.9) + \qmlproperty string QtQuick.Controls::ComboBox::editText + + This property holds the text in the text field of an editable combo box. + + \sa editable +*/ +QString QQuickComboBox::editText() const +{ + Q_D(const QQuickComboBox); + return d->extra.isAllocated() ? d->extra->editText : QString(); +} + +void QQuickComboBox::setEditText(const QString &text) +{ + Q_D(QQuickComboBox); + if (text == editText()) + return; + + d->extra.value().editText = text; + emit editTextChanged(); +} + +void QQuickComboBox::resetEditText() +{ + setEditText(QString()); +} + +/*! \since QtQuick.Controls 2.2 (Qt 5.9) \qmlproperty Validator QtQuick.Controls::ComboBox::validator diff --git a/src/quicktemplates2/qquickcombobox_p.h b/src/quicktemplates2/qquickcombobox_p.h index 851392aa..030d068b 100644 --- a/src/quicktemplates2/qquickcombobox_p.h +++ b/src/quicktemplates2/qquickcombobox_p.h @@ -63,19 +63,21 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickComboBox : public QQuickControl Q_PROPERTY(int count READ count NOTIFY countChanged FINAL) Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged FINAL) Q_PROPERTY(QQmlInstanceModel *delegateModel READ delegateModel NOTIFY delegateModelChanged FINAL) - Q_PROPERTY(bool editable READ isEditable WRITE setEditable NOTIFY editableChanged FINAL REVISION 2) - Q_PROPERTY(bool flat READ isFlat WRITE setFlat NOTIFY flatChanged FINAL REVISION 1) - Q_PROPERTY(bool down READ isDown WRITE setDown RESET resetDown NOTIFY downChanged FINAL REVISION 2) Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL) // ### Qt 6: should not be writable Q_PROPERTY(int highlightedIndex READ highlightedIndex NOTIFY highlightedIndexChanged FINAL) Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL) Q_PROPERTY(QString currentText READ currentText NOTIFY currentTextChanged FINAL) Q_PROPERTY(QString displayText READ displayText WRITE setDisplayText RESET resetDisplayText NOTIFY displayTextChanged FINAL) - Q_PROPERTY(QString editText READ editText WRITE setEditText RESET resetEditText NOTIFY editTextChanged FINAL REVISION 2) Q_PROPERTY(QString textRole READ textRole WRITE setTextRole NOTIFY textRoleChanged FINAL) Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL) Q_PROPERTY(QQuickItem *indicator READ indicator WRITE setIndicator NOTIFY indicatorChanged FINAL) Q_PROPERTY(QQuickPopup *popup READ popup WRITE setPopup NOTIFY popupChanged FINAL) + // 2.1 (Qt 5.8) + Q_PROPERTY(bool flat READ isFlat WRITE setFlat NOTIFY flatChanged FINAL REVISION 1) + // 2.2 (Qt 5.9) + Q_PROPERTY(bool down READ isDown WRITE setDown RESET resetDown NOTIFY downChanged FINAL REVISION 2) + Q_PROPERTY(bool editable READ isEditable WRITE setEditable NOTIFY editableChanged FINAL REVISION 2) + Q_PROPERTY(QString editText READ editText WRITE setEditText RESET resetEditText NOTIFY editTextChanged FINAL REVISION 2) Q_PROPERTY(QValidator *validator READ validator WRITE setValidator NOTIFY validatorChanged FINAL REVISION 2) Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints NOTIFY inputMethodHintsChanged FINAL REVISION 2) Q_PROPERTY(bool inputMethodComposing READ isInputMethodComposing NOTIFY inputMethodComposingChanged FINAL REVISION 2) @@ -91,16 +93,6 @@ public: void setModel(const QVariant &model); QQmlInstanceModel *delegateModel() const; - bool isEditable() const; - void setEditable(bool editable); - - bool isFlat() const; - void setFlat(bool flat); - - bool isDown() const; - void setDown(bool down); - void resetDown(); - bool isPressed() const; void setPressed(bool pressed); @@ -115,10 +107,6 @@ public: void setDisplayText(const QString &text); void resetDisplayText(); - QString editText() const; - void setEditText(const QString &text); - void resetEditText(); - QString textRole() const; void setTextRole(const QString &role); @@ -131,6 +119,25 @@ public: QQuickPopup *popup() const; void setPopup(QQuickPopup *popup); + Q_INVOKABLE QString textAt(int index) const; + Q_INVOKABLE int find(const QString &text, Qt::MatchFlags flags = Qt::MatchExactly) const; + + // 2.1 (Qt 5.8) + bool isFlat() const; + void setFlat(bool flat); + + // 2.2 (Qt 5.9) + bool isDown() const; + void setDown(bool down); + void resetDown(); + + bool isEditable() const; + void setEditable(bool editable); + + QString editText() const; + void setEditText(const QString &text); + void resetEditText(); + QValidator *validator() const; void setValidator(QValidator *validator); @@ -140,40 +147,38 @@ public: bool isInputMethodComposing() const; bool hasAcceptableInput() const; - Q_INVOKABLE QString textAt(int index) const; - Q_INVOKABLE int find(const QString &text, Qt::MatchFlags flags = Qt::MatchExactly) const; - public Q_SLOTS: void incrementCurrentIndex(); void decrementCurrentIndex(); Q_REVISION(2) void selectAll(); Q_SIGNALS: + void activated(int index); + void highlighted(int index); void countChanged(); void modelChanged(); void delegateModelChanged(); - Q_REVISION(2) void editableChanged(); - Q_REVISION(1) void flatChanged(); - Q_REVISION(2) void downChanged(); void pressedChanged(); void highlightedIndexChanged(); void currentIndexChanged(); void currentTextChanged(); void displayTextChanged(); - Q_REVISION(2) void editTextChanged(); void textRoleChanged(); void delegateChanged(); void indicatorChanged(); void popupChanged(); + // 2.1 (Qt 5.8) + Q_REVISION(1) void flatChanged(); + // 2.2 (Qt 5.9) + Q_REVISION(2) void accepted(); + Q_REVISION(2) void downChanged(); + Q_REVISION(2) void editableChanged(); + Q_REVISION(2) void editTextChanged(); Q_REVISION(2) void validatorChanged(); Q_REVISION(2) void inputMethodHintsChanged(); Q_REVISION(2) void inputMethodComposingChanged(); Q_REVISION(2) void acceptableInputChanged(); - void activated(int index); - void highlighted(int index); - Q_REVISION(2) void accepted(); - protected: bool eventFilter(QObject *object, QEvent *event) override; void focusInEvent(QFocusEvent *event) override; diff --git a/src/quicktemplates2/qquickcontainer_p.h b/src/quicktemplates2/qquickcontainer_p.h index 59f85b49..3aa1f13e 100644 --- a/src/quicktemplates2/qquickcontainer_p.h +++ b/src/quicktemplates2/qquickcontainer_p.h @@ -86,6 +86,7 @@ public: public Q_SLOTS: void setCurrentIndex(int index); + // 2.1 (Qt 5.8) Q_REVISION(1) void incrementCurrentIndex(); Q_REVISION(1) void decrementCurrentIndex(); diff --git a/src/quicktemplates2/qquickdial.cpp b/src/quicktemplates2/qquickdial.cpp index 93ad0b5a..c0e2c8ed 100644 --- a/src/quicktemplates2/qquickdial.cpp +++ b/src/quicktemplates2/qquickdial.cpp @@ -514,6 +514,34 @@ void QQuickDial::setPressed(bool pressed) } /*! + \qmlproperty Item QtQuick.Controls::Dial::handle + + This property holds the handle of the dial. + + The handle acts as a visual indicator of the position of the dial. + + \sa {Customizing Dial} +*/ +QQuickItem *QQuickDial::handle() const +{ + Q_D(const QQuickDial); + return d->handle; +} + +void QQuickDial::setHandle(QQuickItem *handle) +{ + Q_D(QQuickDial); + if (handle == d->handle) + return; + + QQuickControlPrivate::destroyDelegate(d->handle, this); + d->handle = handle; + if (d->handle && !d->handle->parentItem()) + d->handle->setParentItem(this); + emit handleChanged(); +} + +/*! \since QtQuick.Controls 2.2 (Qt 5.9) \qmlproperty bool QtQuick.Controls::Dial::live @@ -568,34 +596,6 @@ void QQuickDial::decrease() setValue(d->value - step); } -/*! - \qmlproperty Item QtQuick.Controls::Dial::handle - - This property holds the handle of the dial. - - The handle acts as a visual indicator of the position of the dial. - - \sa {Customizing Dial} -*/ -QQuickItem *QQuickDial::handle() const -{ - Q_D(const QQuickDial); - return d->handle; -} - -void QQuickDial::setHandle(QQuickItem *handle) -{ - Q_D(QQuickDial); - if (handle == d->handle) - return; - - QQuickControlPrivate::destroyDelegate(d->handle, this); - d->handle = handle; - if (d->handle && !d->handle->parentItem()) - d->handle->setParentItem(this); - emit handleChanged(); -} - void QQuickDial::keyPressEvent(QKeyEvent *event) { Q_D(QQuickDial); diff --git a/src/quicktemplates2/qquickdial_p.h b/src/quicktemplates2/qquickdial_p.h index 959cb154..296f7986 100644 --- a/src/quicktemplates2/qquickdial_p.h +++ b/src/quicktemplates2/qquickdial_p.h @@ -69,8 +69,9 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickDial : public QQuickControl Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged FINAL) Q_PROPERTY(bool wrap READ wrap WRITE setWrap NOTIFY wrapChanged FINAL) Q_PROPERTY(bool pressed READ isPressed NOTIFY pressedChanged FINAL) - Q_PROPERTY(bool live READ live WRITE setLive NOTIFY liveChanged FINAL REVISION 2) Q_PROPERTY(QQuickItem *handle READ handle WRITE setHandle NOTIFY handleChanged FINAL) + // 2.2 (Qt 5.9) + Q_PROPERTY(bool live READ live WRITE setLive NOTIFY liveChanged FINAL REVISION 2) public: explicit QQuickDial(QQuickItem *parent = nullptr); @@ -107,12 +108,13 @@ public: bool isPressed() const; void setPressed(bool pressed); - bool live() const; - void setLive(bool live); - QQuickItem *handle() const; void setHandle(QQuickItem *handle); + // 2.2 (Qt 5.9) + bool live() const; + void setLive(bool live); + public Q_SLOTS: void increase(); void decrease(); @@ -127,9 +129,10 @@ Q_SIGNALS: void snapModeChanged(); void wrapChanged(); void pressedChanged(); - Q_REVISION(2) void liveChanged(); void handleChanged(); + // 2.2 (Qt 5.9) Q_REVISION(2) void moved(); + Q_REVISION(2) void liveChanged(); protected: void keyPressEvent(QKeyEvent *event) override; diff --git a/src/quicktemplates2/qquickdrawer_p.h b/src/quicktemplates2/qquickdrawer_p.h index 3ec007df..f0fc1b4c 100644 --- a/src/quicktemplates2/qquickdrawer_p.h +++ b/src/quicktemplates2/qquickdrawer_p.h @@ -60,6 +60,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickDrawer : public QQuickPopup Q_PROPERTY(Qt::Edge edge READ edge WRITE setEdge NOTIFY edgeChanged FINAL) Q_PROPERTY(qreal position READ position WRITE setPosition NOTIFY positionChanged FINAL) Q_PROPERTY(qreal dragMargin READ dragMargin WRITE setDragMargin RESET resetDragMargin NOTIFY dragMarginChanged FINAL) + // 2.2 (Qt 5.9) Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive NOTIFY interactiveChanged FINAL REVISION 2) public: @@ -75,6 +76,7 @@ public: void setDragMargin(qreal margin); void resetDragMargin(); + // 2.2 (Qt 5.9) bool isInteractive() const; void setInteractive(bool interactive); @@ -82,6 +84,7 @@ Q_SIGNALS: void edgeChanged(); void positionChanged(); void dragMarginChanged(); + // 2.2 (Qt 5.9) Q_REVISION(2) void interactiveChanged(); protected: diff --git a/src/quicktemplates2/qquickpage.cpp b/src/quicktemplates2/qquickpage.cpp index ecc5a9c9..50050df3 100644 --- a/src/quicktemplates2/qquickpage.cpp +++ b/src/quicktemplates2/qquickpage.cpp @@ -233,6 +233,51 @@ void QQuickPage::setFooter(QQuickItem *footer) } /*! + \qmlproperty list<Object> QtQuick.Controls::Page::contentData + \default + + This property holds the list of content data. + + The list contains all objects that have been declared in QML as children + of the container. + + \note Unlike \c contentChildren, \c contentData does include non-visual QML + objects. + + \sa Item::data, contentChildren +*/ +QQmlListProperty<QObject> QQuickPage::contentData() +{ + return QQmlListProperty<QObject>(contentItem(), nullptr, + QQuickItemPrivate::data_append, + QQuickItemPrivate::data_count, + QQuickItemPrivate::data_at, + QQuickItemPrivate::data_clear); +} + +/*! + \qmlproperty list<Item> QtQuick.Controls::Page::contentChildren + + This property holds the list of content children. + + The list contains all items that have been declared in QML as children + of the page. + + \note Unlike \c contentData, \c contentChildren does not include non-visual + QML objects. + + \sa Item::children, contentData +*/ +QQmlListProperty<QQuickItem> QQuickPage::contentChildren() +{ + return QQmlListProperty<QQuickItem>(contentItem(), nullptr, + QQuickItemPrivate::children_append, + QQuickItemPrivate::children_count, + QQuickItemPrivate::children_at, + QQuickItemPrivate::children_clear); +} + +/*! \qmlproperty real QtQuick.Controls::Page::contentWidth \since QtQuick.Controls 2.1 (Qt 5.8) @@ -282,51 +327,6 @@ void QQuickPage::setContentHeight(qreal height) emit contentHeightChanged(); } -/*! - \qmlproperty list<Object> QtQuick.Controls::Page::contentData - \default - - This property holds the list of content data. - - The list contains all objects that have been declared in QML as children - of the container. - - \note Unlike \c contentChildren, \c contentData does include non-visual QML - objects. - - \sa Item::data, contentChildren -*/ -QQmlListProperty<QObject> QQuickPage::contentData() -{ - return QQmlListProperty<QObject>(contentItem(), nullptr, - QQuickItemPrivate::data_append, - QQuickItemPrivate::data_count, - QQuickItemPrivate::data_at, - QQuickItemPrivate::data_clear); -} - -/*! - \qmlproperty list<Item> QtQuick.Controls::Page::contentChildren - - This property holds the list of content children. - - The list contains all items that have been declared in QML as children - of the page. - - \note Unlike \c contentData, \c contentChildren does not include non-visual - QML objects. - - \sa Item::children, contentData -*/ -QQmlListProperty<QQuickItem> QQuickPage::contentChildren() -{ - return QQmlListProperty<QQuickItem>(contentItem(), nullptr, - QQuickItemPrivate::children_append, - QQuickItemPrivate::children_count, - QQuickItemPrivate::children_at, - QQuickItemPrivate::children_clear); -} - void QQuickPage::componentComplete() { Q_D(QQuickPage); diff --git a/src/quicktemplates2/qquickpage_p.h b/src/quicktemplates2/qquickpage_p.h index 1b14588a..0789e996 100644 --- a/src/quicktemplates2/qquickpage_p.h +++ b/src/quicktemplates2/qquickpage_p.h @@ -61,10 +61,11 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickPage : public QQuickControl Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL) Q_PROPERTY(QQuickItem *header READ header WRITE setHeader NOTIFY headerChanged FINAL) Q_PROPERTY(QQuickItem *footer READ footer WRITE setFooter NOTIFY footerChanged FINAL) - Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth NOTIFY contentWidthChanged FINAL REVISION 1) - Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight NOTIFY contentHeightChanged FINAL REVISION 1) Q_PROPERTY(QQmlListProperty<QObject> contentData READ contentData FINAL) Q_PROPERTY(QQmlListProperty<QQuickItem> contentChildren READ contentChildren NOTIFY contentChildrenChanged FINAL) + // 2.1 (Qt 5.8) + Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth NOTIFY contentWidthChanged FINAL REVISION 1) + Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight NOTIFY contentHeightChanged FINAL REVISION 1) Q_CLASSINFO("DefaultProperty", "contentData") public: @@ -79,22 +80,24 @@ public: QQuickItem *footer() const; void setFooter(QQuickItem *footer); + QQmlListProperty<QObject> contentData(); + QQmlListProperty<QQuickItem> contentChildren(); + + // 2.1 (Qt 5.8) qreal contentWidth() const; void setContentWidth(qreal width); qreal contentHeight() const; void setContentHeight(qreal height); - QQmlListProperty<QObject> contentData(); - QQmlListProperty<QQuickItem> contentChildren(); - Q_SIGNALS: void titleChanged(); void headerChanged(); void footerChanged(); + void contentChildrenChanged(); + // 2.1 (Qt 5.8) Q_REVISION(1) void contentWidthChanged(); Q_REVISION(1) void contentHeightChanged(); - void contentChildrenChanged(); protected: void componentComplete() override; diff --git a/src/quicktemplates2/qquickpopup_p.h b/src/quicktemplates2/qquickpopup_p.h index 04179f08..199f7e4c 100644 --- a/src/quicktemplates2/qquickpopup_p.h +++ b/src/quicktemplates2/qquickpopup_p.h @@ -84,7 +84,6 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickPopup : public QObject, public QQml Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight NOTIFY contentHeightChanged FINAL) Q_PROPERTY(qreal availableWidth READ availableWidth NOTIFY availableWidthChanged FINAL) Q_PROPERTY(qreal availableHeight READ availableHeight NOTIFY availableHeightChanged FINAL) - Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing RESET resetSpacing NOTIFY spacingChanged FINAL REVISION 1) Q_PROPERTY(qreal margins READ margins WRITE setMargins RESET resetMargins NOTIFY marginsChanged FINAL) Q_PROPERTY(qreal topMargin READ topMargin WRITE setTopMargin RESET resetTopMargin NOTIFY topMarginChanged FINAL) Q_PROPERTY(qreal leftMargin READ leftMargin WRITE setLeftMargin RESET resetLeftMargin NOTIFY leftMarginChanged FINAL) @@ -114,6 +113,8 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickPopup : public QObject, public QQml Q_PROPERTY(TransformOrigin transformOrigin READ transformOrigin WRITE setTransformOrigin) Q_PROPERTY(QQuickTransition *enter READ enter WRITE setEnter NOTIFY enterChanged FINAL) Q_PROPERTY(QQuickTransition *exit READ exit WRITE setExit NOTIFY exitChanged FINAL) + // 2.1 (Qt 5.8) + Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing RESET resetSpacing NOTIFY spacingChanged FINAL REVISION 1) Q_CLASSINFO("DefaultProperty", "contentData") public: @@ -155,10 +156,6 @@ public: qreal availableWidth() const; qreal availableHeight() const; - qreal spacing() const; - void setSpacing(qreal spacing); - void resetSpacing(); - qreal margins() const; void setMargins(qreal margins); void resetMargins(); @@ -282,11 +279,20 @@ public: Q_INVOKABLE void forceActiveFocus(Qt::FocusReason reason = Qt::OtherFocusReason); + // 2.1 (Qt 5.8) + qreal spacing() const; + void setSpacing(qreal spacing); + void resetSpacing(); + public Q_SLOTS: void open(); void close(); Q_SIGNALS: + void opened(); + void closed(); + void aboutToShow(); + void aboutToHide(); void xChanged(); void yChanged(); void zChanged(); @@ -298,7 +304,6 @@ Q_SIGNALS: void contentHeightChanged(); void availableWidthChanged(); void availableHeightChanged(); - Q_REVISION(1) void spacingChanged(); void marginsChanged(); void topMarginChanged(); void leftMarginChanged(); @@ -327,11 +332,8 @@ Q_SIGNALS: void enterChanged(); void exitChanged(); void windowChanged(QQuickWindow *window); - - void aboutToShow(); - void aboutToHide(); - void opened(); - void closed(); + // 2.1 (Qt 5.8) + Q_REVISION(1) void spacingChanged(); protected: QQuickPopup(QQuickPopupPrivate &dd, QObject *parent); diff --git a/src/quicktemplates2/qquickrangeslider.cpp b/src/quicktemplates2/qquickrangeslider.cpp index db2d74e6..274c887d 100644 --- a/src/quicktemplates2/qquickrangeslider.cpp +++ b/src/quicktemplates2/qquickrangeslider.cpp @@ -808,33 +808,6 @@ void QQuickRangeSlider::setOrientation(Qt::Orientation orientation) } /*! - \since QtQuick.Controls 2.2 (Qt 5.9) - \qmlproperty bool QtQuick.Controls::RangeSlider::live - - This property holds whether the slider provides live updates for the \l first.value - and \l second.value properties while the respective handles are dragged. - - The default value is \c true. - - \sa first.value, second.value -*/ -bool QQuickRangeSlider::live() const -{ - Q_D(const QQuickRangeSlider); - return d->live; -} - -void QQuickRangeSlider::setLive(bool live) -{ - Q_D(QQuickRangeSlider); - if (d->live == live) - return; - - d->live = live; - emit liveChanged(); -} - -/*! \qmlmethod void QtQuick.Controls::RangeSlider::setValues(real firstValue, real secondValue) Sets \l first.value and \l second.value with the given arguments. @@ -891,6 +864,33 @@ void QQuickRangeSlider::setValues(qreal firstValue, qreal secondValue) secondPrivate->updatePosition(); } +/*! + \since QtQuick.Controls 2.2 (Qt 5.9) + \qmlproperty bool QtQuick.Controls::RangeSlider::live + + This property holds whether the slider provides live updates for the \l first.value + and \l second.value properties while the respective handles are dragged. + + The default value is \c true. + + \sa first.value, second.value +*/ +bool QQuickRangeSlider::live() const +{ + Q_D(const QQuickRangeSlider); + return d->live; +} + +void QQuickRangeSlider::setLive(bool live) +{ + Q_D(QQuickRangeSlider); + if (d->live == live) + return; + + d->live = live; + emit liveChanged(); +} + void QQuickRangeSlider::focusInEvent(QFocusEvent *event) { Q_D(QQuickRangeSlider); diff --git a/src/quicktemplates2/qquickrangeslider_p.h b/src/quicktemplates2/qquickrangeslider_p.h index 439a0d45..fc5a1d99 100644 --- a/src/quicktemplates2/qquickrangeslider_p.h +++ b/src/quicktemplates2/qquickrangeslider_p.h @@ -65,6 +65,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickRangeSlider : public QQuickControl Q_PROPERTY(qreal stepSize READ stepSize WRITE setStepSize NOTIFY stepSizeChanged FINAL) Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged FINAL) Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL) + // 2.2 (Qt 5.9) Q_PROPERTY(bool live READ live WRITE setLive NOTIFY liveChanged FINAL REVISION 2) public: @@ -95,17 +96,19 @@ public: Qt::Orientation orientation() const; void setOrientation(Qt::Orientation orientation); + Q_INVOKABLE void setValues(qreal firstValue, qreal secondValue); + + // 2.2 (Qt 5.9) bool live() const; void setLive(bool live); - Q_INVOKABLE void setValues(qreal firstValue, qreal secondValue); - Q_SIGNALS: void fromChanged(); void toChanged(); void stepSizeChanged(); void snapModeChanged(); void orientationChanged(); + // 2.2 (Qt 5.9) Q_REVISION(2) void liveChanged(); protected: @@ -144,6 +147,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickRangeSliderNode : public QObject Q_PROPERTY(qreal visualPosition READ visualPosition NOTIFY visualPositionChanged FINAL) Q_PROPERTY(QQuickItem *handle READ handle WRITE setHandle NOTIFY handleChanged FINAL) Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL) + // 2.1 (Qt 5.8) Q_PROPERTY(bool hovered READ isHovered WRITE setHovered NOTIFY hoveredChanged FINAL REVISION 1) public: @@ -162,6 +166,7 @@ public: bool isPressed() const; void setPressed(bool pressed); + // 2.1 (Qt 5.8) bool isHovered() const; void setHovered(bool hovered); @@ -175,6 +180,7 @@ Q_SIGNALS: void visualPositionChanged(); void handleChanged(); void pressedChanged(); + // 2.1 (Qt 5.8) Q_REVISION(1) void hoveredChanged(); private: diff --git a/src/quicktemplates2/qquickscrollbar_p.h b/src/quicktemplates2/qquickscrollbar_p.h index 28c48428..892ef2e4 100644 --- a/src/quicktemplates2/qquickscrollbar_p.h +++ b/src/quicktemplates2/qquickscrollbar_p.h @@ -64,6 +64,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickScrollBar : public QQuickControl Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged FINAL) Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL) Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL) + // 2.2 (Qt 5.9) Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged FINAL REVISION 2) Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive RESET resetInteractive NOTIFY interactiveChanged FINAL REVISION 2) Q_PROPERTY(Policy policy READ policy WRITE setPolicy NOTIFY policyChanged FINAL REVISION 2) @@ -88,6 +89,7 @@ public: Qt::Orientation orientation() const; void setOrientation(Qt::Orientation orientation); + // 2.2 (Qt 5.9) enum SnapMode { NoSnap, SnapAlways, @@ -125,6 +127,7 @@ Q_SIGNALS: void activeChanged(); void pressedChanged(); void orientationChanged(); + // 2.2 (Qt 5.9) Q_REVISION(2) void snapModeChanged(); Q_REVISION(2) void interactiveChanged(); Q_REVISION(2) void policyChanged(); diff --git a/src/quicktemplates2/qquickslider.cpp b/src/quicktemplates2/qquickslider.cpp index c5a8eb1b..4d3cbe3e 100644 --- a/src/quicktemplates2/qquickslider.cpp +++ b/src/quicktemplates2/qquickslider.cpp @@ -430,33 +430,6 @@ void QQuickSlider::setSnapMode(SnapMode mode) } /*! - \since QtQuick.Controls 2.2 (Qt 5.9) - \qmlproperty bool QtQuick.Controls::Slider::live - - This property holds whether the slider provides live updates for the \l value - property while the handle is dragged. - - The default value is \c true. - - \sa value, valueAt() -*/ -bool QQuickSlider::live() const -{ - Q_D(const QQuickSlider); - return d->live; -} - -void QQuickSlider::setLive(bool live) -{ - Q_D(QQuickSlider); - if (d->live == live) - return; - - d->live = live; - emit liveChanged(); -} - -/*! \qmlproperty bool QtQuick.Controls::Slider::pressed This property holds whether the slider is pressed. @@ -547,6 +520,33 @@ qreal QQuickSlider::valueAt(qreal position) const } /*! + \since QtQuick.Controls 2.2 (Qt 5.9) + \qmlproperty bool QtQuick.Controls::Slider::live + + This property holds whether the slider provides live updates for the \l value + property while the handle is dragged. + + The default value is \c true. + + \sa value, valueAt() +*/ +bool QQuickSlider::live() const +{ + Q_D(const QQuickSlider); + return d->live; +} + +void QQuickSlider::setLive(bool live) +{ + Q_D(QQuickSlider); + if (d->live == live) + return; + + d->live = live; + emit liveChanged(); +} + +/*! \qmlmethod void QtQuick.Controls::Slider::increase() Increases the value by \l stepSize or \c 0.1 if stepSize is not defined. diff --git a/src/quicktemplates2/qquickslider_p.h b/src/quicktemplates2/qquickslider_p.h index 865902ab..f33c330a 100644 --- a/src/quicktemplates2/qquickslider_p.h +++ b/src/quicktemplates2/qquickslider_p.h @@ -64,10 +64,10 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSlider : public QQuickControl Q_PROPERTY(qreal visualPosition READ visualPosition NOTIFY visualPositionChanged FINAL) Q_PROPERTY(qreal stepSize READ stepSize WRITE setStepSize NOTIFY stepSizeChanged FINAL) Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged FINAL) - Q_PROPERTY(bool live READ live WRITE setLive NOTIFY liveChanged FINAL REVISION 2) Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL) Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL) Q_PROPERTY(QQuickItem *handle READ handle WRITE setHandle NOTIFY handleChanged FINAL) + Q_PROPERTY(bool live READ live WRITE setLive NOTIFY liveChanged FINAL REVISION 2) public: explicit QQuickSlider(QQuickItem *parent = nullptr); @@ -97,9 +97,6 @@ public: SnapMode snapMode() const; void setSnapMode(SnapMode mode); - bool live() const; - void setLive(bool live); - bool isPressed() const; void setPressed(bool pressed); @@ -109,8 +106,13 @@ public: QQuickItem *handle() const; void setHandle(QQuickItem *handle); + // 2.1 (Qt 5.8) Q_REVISION(1) Q_INVOKABLE qreal valueAt(qreal position) const; + // 2.2 (Qt 5.9) + bool live() const; + void setLive(bool live); + public Q_SLOTS: void increase(); void decrease(); @@ -123,11 +125,12 @@ Q_SIGNALS: void visualPositionChanged(); void stepSizeChanged(); void snapModeChanged(); - Q_REVISION(2) void liveChanged(); void pressedChanged(); void orientationChanged(); void handleChanged(); + // 2.2 (Qt 5.9) Q_REVISION(2) void moved(); + Q_REVISION(2) void liveChanged(); protected: void keyPressEvent(QKeyEvent *event) override; diff --git a/src/quicktemplates2/qquickspinbox.cpp b/src/quicktemplates2/qquickspinbox.cpp index 1911e796..1989d768 100644 --- a/src/quicktemplates2/qquickspinbox.cpp +++ b/src/quicktemplates2/qquickspinbox.cpp @@ -926,22 +926,6 @@ void QQuickSpinButton::setPressed(bool pressed) emit pressedChanged(); } -bool QQuickSpinButton::isHovered() const -{ - Q_D(const QQuickSpinButton); - return d->hovered; -} - -void QQuickSpinButton::setHovered(bool hovered) -{ - Q_D(QQuickSpinButton); - if (d->hovered == hovered) - return; - - d->hovered = hovered; - emit hoveredChanged(); -} - QQuickItem *QQuickSpinButton::indicator() const { Q_D(const QQuickSpinButton); @@ -964,4 +948,20 @@ void QQuickSpinButton::setIndicator(QQuickItem *indicator) emit indicatorChanged(); } +bool QQuickSpinButton::isHovered() const +{ + Q_D(const QQuickSpinButton); + return d->hovered; +} + +void QQuickSpinButton::setHovered(bool hovered) +{ + Q_D(QQuickSpinButton); + if (d->hovered == hovered) + return; + + d->hovered = hovered; + emit hoveredChanged(); +} + QT_END_NAMESPACE diff --git a/src/quicktemplates2/qquickspinbox_p.h b/src/quicktemplates2/qquickspinbox_p.h index bd0d1ab2..e62f8614 100644 --- a/src/quicktemplates2/qquickspinbox_p.h +++ b/src/quicktemplates2/qquickspinbox_p.h @@ -71,6 +71,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSpinBox : public QQuickControl Q_PROPERTY(QJSValue valueFromText READ valueFromText WRITE setValueFromText NOTIFY valueFromTextChanged FINAL) Q_PROPERTY(QQuickSpinButton *up READ up CONSTANT FINAL) Q_PROPERTY(QQuickSpinButton *down READ down CONSTANT FINAL) + // 2.2 (Qt 5.9) Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints NOTIFY inputMethodHintsChanged FINAL REVISION 2) Q_PROPERTY(bool inputMethodComposing READ isInputMethodComposing NOTIFY inputMethodComposingChanged FINAL REVISION 2) @@ -104,6 +105,7 @@ public: QQuickSpinButton *up() const; QQuickSpinButton *down() const; + // 2.2 (Qt 5.9) Qt::InputMethodHints inputMethodHints() const; void setInputMethodHints(Qt::InputMethodHints hints); @@ -122,6 +124,7 @@ Q_SIGNALS: void validatorChanged(); void textFromValueChanged(); void valueFromTextChanged(); + // 2.2 (Qt 5.9) Q_REVISION(2) void valueModified(); Q_REVISION(2) void inputMethodHintsChanged(); Q_REVISION(2) void inputMethodComposingChanged(); @@ -158,8 +161,9 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSpinButton : public QObject { Q_OBJECT Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL) - Q_PROPERTY(bool hovered READ isHovered WRITE setHovered NOTIFY hoveredChanged FINAL REVISION 1) Q_PROPERTY(QQuickItem *indicator READ indicator WRITE setIndicator NOTIFY indicatorChanged FINAL) + // 2.1 (Qt 5.8) + Q_PROPERTY(bool hovered READ isHovered WRITE setHovered NOTIFY hoveredChanged FINAL REVISION 1) public: explicit QQuickSpinButton(QQuickSpinBox *parent); @@ -167,16 +171,18 @@ public: bool isPressed() const; void setPressed(bool pressed); - bool isHovered() const; - void setHovered(bool hovered); - QQuickItem *indicator() const; void setIndicator(QQuickItem *indicator); + // 2.1 (Qt 5.8) + bool isHovered() const; + void setHovered(bool hovered); + Q_SIGNALS: void pressedChanged(); - Q_REVISION(1) void hoveredChanged(); void indicatorChanged(); + // 2.1 (Qt 5.8) + Q_REVISION(1) void hoveredChanged(); private: Q_DISABLE_COPY(QQuickSpinButton) diff --git a/src/quicktemplates2/qquickstackview_p.h b/src/quicktemplates2/qquickstackview_p.h index b74a162d..ff115416 100644 --- a/src/quicktemplates2/qquickstackview_p.h +++ b/src/quicktemplates2/qquickstackview_p.h @@ -168,6 +168,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickStackViewAttached : public QObject Q_PROPERTY(int index READ index NOTIFY indexChanged FINAL) Q_PROPERTY(QQuickStackView *view READ view NOTIFY viewChanged FINAL) Q_PROPERTY(QQuickStackView::Status status READ status NOTIFY statusChanged FINAL) + // 2.2 (Qt 5.9) Q_PROPERTY(bool visible READ isVisible WRITE setVisible RESET resetVisible NOTIFY visibleChanged FINAL) // REVISION 2 public: @@ -178,6 +179,7 @@ public: QQuickStackView *view() const; QQuickStackView::Status status() const; + // 2.2 (Qt 5.9) bool isVisible() const; void setVisible(bool visible); void resetVisible(); @@ -186,13 +188,14 @@ Q_SIGNALS: void indexChanged(); void viewChanged(); void statusChanged(); - /*Q_REVISION(2)*/ void visibleChanged(); - + // 2.1 (Qt 5.8) /*Q_REVISION(1)*/ void activated(); /*Q_REVISION(1)*/ void activating(); /*Q_REVISION(1)*/ void deactivated(); /*Q_REVISION(1)*/ void deactivating(); /*Q_REVISION(1)*/ void removed(); + // 2.2 (Qt 5.9) + /*Q_REVISION(2)*/ void visibleChanged(); private: Q_DISABLE_COPY(QQuickStackViewAttached) diff --git a/src/quicktemplates2/qquickswipe_p.h b/src/quicktemplates2/qquickswipe_p.h index 62b0e903..20e38e90 100644 --- a/src/quicktemplates2/qquickswipe_p.h +++ b/src/quicktemplates2/qquickswipe_p.h @@ -64,13 +64,14 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSwipe : public QObject Q_OBJECT Q_PROPERTY(qreal position READ position WRITE setPosition NOTIFY positionChanged FINAL) Q_PROPERTY(bool complete READ isComplete NOTIFY completeChanged FINAL) - Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged FINAL) // REVISION 2 Q_PROPERTY(QQmlComponent *left READ left WRITE setLeft NOTIFY leftChanged FINAL) Q_PROPERTY(QQmlComponent *behind READ behind WRITE setBehind NOTIFY behindChanged FINAL) Q_PROPERTY(QQmlComponent *right READ right WRITE setRight NOTIFY rightChanged FINAL) Q_PROPERTY(QQuickItem *leftItem READ leftItem NOTIFY leftItemChanged FINAL) Q_PROPERTY(QQuickItem *behindItem READ behindItem NOTIFY behindItemChanged FINAL) Q_PROPERTY(QQuickItem *rightItem READ rightItem NOTIFY rightItemChanged FINAL) + // 2.2 (Qt 5.9) + Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged FINAL) // REVISION 2 Q_PROPERTY(QQuickTransition *transition READ transition WRITE setTransition NOTIFY transitionChanged FINAL) // REVISION 2 public: @@ -82,9 +83,6 @@ public: bool isComplete() const; void setComplete(bool complete); - bool isEnabled() const; - void setEnabled(bool enabled); - QQmlComponent *left() const; void setLeft(QQmlComponent *left); @@ -103,25 +101,33 @@ public: QQuickItem *rightItem() const; void setRightItem(QQuickItem *item); + // 2.1 (Qt 5.8) + Q_REVISION(1) Q_INVOKABLE void close(); + + // 2.2 (Qt 5.9) + bool isEnabled() const; + void setEnabled(bool enabled); + QQuickTransition *transition() const; void setTransition(QQuickTransition *transition); Q_REVISION(2) Q_INVOKABLE void open(QQuickSwipeDelegate::Side side); - Q_REVISION(1) Q_INVOKABLE void close(); Q_SIGNALS: void positionChanged(); void completeChanged(); - /*Q_REVISION(2)*/ void enabledChanged(); - /*Q_REVISION(1)*/ void completed(); - /*Q_REVISION(2)*/ void opened(); - /*Q_REVISION(2)*/ void closed(); void leftChanged(); void behindChanged(); void rightChanged(); void leftItemChanged(); void behindItemChanged(); void rightItemChanged(); + // 2.1 (Qt 5.8) + /*Q_REVISION(1)*/ void completed(); + // 2.2 (Qt 5.9) + /*Q_REVISION(2)*/ void opened(); + /*Q_REVISION(2)*/ void closed(); + /*Q_REVISION(2)*/ void enabledChanged(); /*Q_REVISION(2)*/ void transitionChanged(); private: diff --git a/src/quicktemplates2/qquickswipeview.cpp b/src/quicktemplates2/qquickswipeview.cpp index f6efc7e4..72754b0f 100644 --- a/src/quicktemplates2/qquickswipeview.cpp +++ b/src/quicktemplates2/qquickswipeview.cpp @@ -456,12 +456,6 @@ QQuickSwipeViewAttached::~QQuickSwipeViewAttached() QQuickItemPrivate::get(item)->removeItemChangeListener(d, QQuickItemPrivate::Parent | QQuickItemPrivate::Destroyed); } -QQuickSwipeView *QQuickSwipeViewAttached::view() const -{ - Q_D(const QQuickSwipeViewAttached); - return d->swipeView; -} - int QQuickSwipeViewAttached::index() const { Q_D(const QQuickSwipeViewAttached); @@ -474,6 +468,12 @@ bool QQuickSwipeViewAttached::isCurrentItem() const return d->index != -1 && d->currentIndex != -1 && d->index == d->currentIndex; } +QQuickSwipeView *QQuickSwipeViewAttached::view() const +{ + Q_D(const QQuickSwipeViewAttached); + return d->swipeView; +} + bool QQuickSwipeViewAttached::isNextItem() const { Q_D(const QQuickSwipeViewAttached); diff --git a/src/quicktemplates2/qquickswipeview_p.h b/src/quicktemplates2/qquickswipeview_p.h index e07ed7f0..98594bd3 100644 --- a/src/quicktemplates2/qquickswipeview_p.h +++ b/src/quicktemplates2/qquickswipeview_p.h @@ -58,22 +58,28 @@ class QQuickSwipeViewPrivate; class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSwipeView : public QQuickContainer { Q_OBJECT + // 2.1 (Qt 5.8) Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive NOTIFY interactiveChanged FINAL REVISION 1) + // 2.2 (Qt 5.9) Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL REVISION 2) public: explicit QQuickSwipeView(QQuickItem *parent = nullptr); + static QQuickSwipeViewAttached *qmlAttachedProperties(QObject *object); + + // 2.1 (Qt 5.8) bool isInteractive() const; void setInteractive(bool interactive); + // 2.2 (Qt 5.9) Qt::Orientation orientation() const; void setOrientation(Qt::Orientation orientation); - static QQuickSwipeViewAttached *qmlAttachedProperties(QObject *object); - Q_SIGNALS: + // 2.1 (Qt 5.8) Q_REVISION(1) void interactiveChanged(); + // 2.2 (Qt 5.9) Q_REVISION(2) void orientationChanged(); protected: @@ -96,9 +102,10 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSwipeViewAttached : public QObject Q_OBJECT Q_PROPERTY(int index READ index NOTIFY indexChanged FINAL) Q_PROPERTY(bool isCurrentItem READ isCurrentItem NOTIFY isCurrentItemChanged FINAL) + Q_PROPERTY(QQuickSwipeView *view READ view NOTIFY viewChanged FINAL) + // 2.1 (Qt 5.8) Q_PROPERTY(bool isNextItem READ isNextItem NOTIFY isNextItemChanged FINAL REVISION 1) Q_PROPERTY(bool isPreviousItem READ isPreviousItem NOTIFY isPreviousItemChanged FINAL REVISION 1) - Q_PROPERTY(QQuickSwipeView *view READ view NOTIFY viewChanged FINAL) public: explicit QQuickSwipeViewAttached(QObject *parent = nullptr); @@ -106,16 +113,19 @@ public: int index() const; bool isCurrentItem() const; + QQuickSwipeView *view() const; + + // 2.1 (Qt 5.8) bool isNextItem() const; bool isPreviousItem() const; - QQuickSwipeView *view() const; Q_SIGNALS: void indexChanged(); void isCurrentItemChanged(); + void viewChanged(); + // 2.1 (Qt 5.8) /*Q_REVISION(1)*/ void isNextItemChanged(); /*Q_REVISION(1)*/ void isPreviousItemChanged(); - void viewChanged(); private: Q_DISABLE_COPY(QQuickSwipeViewAttached) diff --git a/src/quicktemplates2/qquicktabbar_p.h b/src/quicktemplates2/qquicktabbar_p.h index 0ffd53d5..5780197b 100644 --- a/src/quicktemplates2/qquicktabbar_p.h +++ b/src/quicktemplates2/qquicktabbar_p.h @@ -58,6 +58,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTabBar : public QQuickContainer { Q_OBJECT Q_PROPERTY(Position position READ position WRITE setPosition NOTIFY positionChanged FINAL) + // 2.2 (Qt 5.9) Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth RESET resetContentWidth NOTIFY contentWidthChanged FINAL REVISION 2) Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight RESET resetContentHeight NOTIFY contentHeightChanged FINAL REVISION 2) @@ -73,6 +74,7 @@ public: Position position() const; void setPosition(Position position); + // 2.2 (Qt 5.9) qreal contentWidth() const; void setContentWidth(qreal width); void resetContentWidth(); @@ -83,6 +85,7 @@ public: Q_SIGNALS: void positionChanged(); + // 2.2 (Qt 5.9) Q_REVISION(2) void contentWidthChanged(); Q_REVISION(2) void contentHeightChanged(); diff --git a/src/quicktemplates2/qquicktextarea.cpp b/src/quicktemplates2/qquicktextarea.cpp index 24011505..8c48bdf9 100644 --- a/src/quicktemplates2/qquicktextarea.cpp +++ b/src/quicktemplates2/qquicktextarea.cpp @@ -513,6 +513,14 @@ void QQuickTextArea::setFocusReason(Qt::FocusReason reason) emit focusReasonChanged(); } +bool QQuickTextArea::contains(const QPointF &point) const +{ + Q_D(const QQuickTextArea); + if (d->flickable && !d->flickable->contains(d->flickable->mapFromItem(this, point))) + return false; + return QQuickTextEdit::contains(point); +} + /*! \since QtQuick.Controls 2.1 (Qt 5.8) \qmlproperty bool QtQuick.Controls::TextArea::hovered @@ -589,14 +597,6 @@ void QQuickTextArea::resetHoverEnabled() #endif } -bool QQuickTextArea::contains(const QPointF &point) const -{ - Q_D(const QQuickTextArea); - if (d->flickable && !d->flickable->contains(d->flickable->mapFromItem(this, point))) - return false; - return QQuickTextEdit::contains(point); -} - void QQuickTextArea::classBegin() { Q_D(QQuickTextArea); diff --git a/src/quicktemplates2/qquicktextarea_p.h b/src/quicktemplates2/qquicktextarea_p.h index 87cb57bc..507f8b14 100644 --- a/src/quicktemplates2/qquicktextarea_p.h +++ b/src/quicktemplates2/qquicktextarea_p.h @@ -67,6 +67,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTextArea : public QQuickTextEdit Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL) Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText NOTIFY placeholderTextChanged FINAL) Q_PROPERTY(Qt::FocusReason focusReason READ focusReason WRITE setFocusReason NOTIFY focusReasonChanged FINAL) + // 2.1 (Qt 5.8) Q_PROPERTY(bool hovered READ isHovered NOTIFY hoveredChanged FINAL REVISION 1) Q_PROPERTY(bool hoverEnabled READ isHoverEnabled WRITE setHoverEnabled RESET resetHoverEnabled NOTIFY hoverEnabledChanged FINAL REVISION 1) @@ -88,6 +89,9 @@ public: Qt::FocusReason focusReason() const; void setFocusReason(Qt::FocusReason reason); + bool contains(const QPointF &point) const override; + + // 2.1 (Qt 5.8) bool isHovered() const; void setHovered(bool hovered); @@ -95,8 +99,6 @@ public: void setHoverEnabled(bool enabled); void resetHoverEnabled(); - bool contains(const QPointF &point) const override; - Q_SIGNALS: void fontChanged(); void implicitWidthChanged3(); @@ -104,11 +106,12 @@ Q_SIGNALS: void backgroundChanged(); void placeholderTextChanged(); void focusReasonChanged(); - Q_REVISION(1) void hoveredChanged(); - Q_REVISION(1) void hoverEnabledChanged(); void pressAndHold(QQuickMouseEvent *event); + // 2.1 (Qt 5.8) Q_REVISION(1) void pressed(QQuickMouseEvent *event); Q_REVISION(1) void released(QQuickMouseEvent *event); + Q_REVISION(1) void hoveredChanged(); + Q_REVISION(1) void hoverEnabledChanged(); protected: void classBegin() override; diff --git a/src/quicktemplates2/qquicktextfield_p.h b/src/quicktemplates2/qquicktextfield_p.h index 24e6ce53..49e0be13 100644 --- a/src/quicktemplates2/qquicktextfield_p.h +++ b/src/quicktemplates2/qquicktextfield_p.h @@ -66,6 +66,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTextField : public QQuickTextInput Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL) Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText NOTIFY placeholderTextChanged FINAL) Q_PROPERTY(Qt::FocusReason focusReason READ focusReason WRITE setFocusReason NOTIFY focusReasonChanged FINAL) + // 2.1 (Qt 5.8) Q_PROPERTY(bool hovered READ isHovered NOTIFY hoveredChanged FINAL REVISION 1) Q_PROPERTY(bool hoverEnabled READ isHoverEnabled WRITE setHoverEnabled RESET resetHoverEnabled NOTIFY hoverEnabledChanged FINAL REVISION 1) @@ -84,6 +85,7 @@ public: Qt::FocusReason focusReason() const; void setFocusReason(Qt::FocusReason reason); + // 2.1 (Qt 5.8) bool isHovered() const; void setHovered(bool hovered); @@ -98,11 +100,12 @@ Q_SIGNALS: void backgroundChanged(); void placeholderTextChanged(); void focusReasonChanged(); - Q_REVISION(1) void hoveredChanged(); - Q_REVISION(1) void hoverEnabledChanged(); void pressAndHold(QQuickMouseEvent *event); + // 2.1 (Qt 5.8) Q_REVISION(1) void pressed(QQuickMouseEvent *event); Q_REVISION(1) void released(QQuickMouseEvent *event); + Q_REVISION(1) void hoveredChanged(); + Q_REVISION(1) void hoverEnabledChanged(); protected: void classBegin() override; diff --git a/src/quicktemplates2/qquicktumbler.cpp b/src/quicktemplates2/qquicktumbler.cpp index 80ab71ea..3429f1f4 100644 --- a/src/quicktemplates2/qquicktumbler.cpp +++ b/src/quicktemplates2/qquicktumbler.cpp @@ -418,6 +418,11 @@ void QQuickTumbler::setVisibleItemCount(int visibleItemCount) emit visibleItemCountChanged(); } +QQuickTumblerAttached *QQuickTumbler::qmlAttachedProperties(QObject *object) +{ + return new QQuickTumblerAttached(object); +} + /*! \qmlproperty bool QtQuick.Controls::Tumbler::wrap \since QtQuick.Controls 2.1 (Qt 5.8) @@ -463,11 +468,6 @@ bool QQuickTumbler::isMoving() const return d->view && d->view->property("moving").toBool(); } -QQuickTumblerAttached *QQuickTumbler::qmlAttachedProperties(QObject *object) -{ - return new QQuickTumblerAttached(object); -} - void QQuickTumbler::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { Q_D(QQuickTumbler); diff --git a/src/quicktemplates2/qquicktumbler_p.h b/src/quicktemplates2/qquicktumbler_p.h index b71a7636..de7de595 100644 --- a/src/quicktemplates2/qquicktumbler_p.h +++ b/src/quicktemplates2/qquicktumbler_p.h @@ -66,7 +66,9 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTumbler : public QQuickControl Q_PROPERTY(QQuickItem *currentItem READ currentItem NOTIFY currentItemChanged FINAL) Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL) Q_PROPERTY(int visibleItemCount READ visibleItemCount WRITE setVisibleItemCount NOTIFY visibleItemCountChanged FINAL) + // 2.1 (Qt 5.8) Q_PROPERTY(bool wrap READ wrap WRITE setWrap RESET resetWrap NOTIFY wrapChanged FINAL REVISION 1) + // 2.2 (Qt 5.9) Q_PROPERTY(bool moving READ isMoving NOTIFY movingChanged FINAL REVISION 2) public: @@ -88,14 +90,16 @@ public: int visibleItemCount() const; void setVisibleItemCount(int visibleItemCount); + static QQuickTumblerAttached *qmlAttachedProperties(QObject *object); + + // 2.1 (Qt 5.8) bool wrap() const; void setWrap(bool wrap); void resetWrap(); + // 2.2 (Qt 5.9) bool isMoving() const; - static QQuickTumblerAttached *qmlAttachedProperties(QObject *object); - Q_SIGNALS: void modelChanged(); void countChanged(); @@ -103,7 +107,9 @@ Q_SIGNALS: void currentItemChanged(); void delegateChanged(); void visibleItemCountChanged(); + // 2.1 (Qt 5.8) Q_REVISION(1) void wrapChanged(); + // 2.2 (Qt 5.9) Q_REVISION(2) void movingChanged(); protected: |