aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-11-06 14:02:21 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2017-11-06 14:02:21 +0100
commitc39b126a77e27296ef82a1634753c775cc5a93fb (patch)
tree235d9568e21e59b7c70f8be81518c3ea184cf552
parentdc2603562a36241c9beac0c9c4c08bcbfed7b6a2 (diff)
parent430fe83ecb7106118cbebd735637aee9e9253914 (diff)
Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts: src/quicktemplates2/qquickabstractbutton_p.h src/quicktemplates2/qquickbuttongroup_p.h src/quicktemplates2/qquickrangeslider.cpp src/quicktemplates2/qquickrangeslider_p.h src/quicktemplates2/qquickswipeview_p.h src/quicktemplates2/qquicktextarea.cpp src/quicktemplates2/qquicktextarea_p.h src/quicktemplates2/qquicktextfield_p.h Change-Id: I7cba8783b1dd85a4db534222e36572ee05dd01d0
-rw-r--r--src/quicktemplates2/qquickabstractbutton_p.h3
-rw-r--r--src/quicktemplates2/qquickbuttongroup_p.h3
-rw-r--r--src/quicktemplates2/qquickcombobox.cpp294
-rw-r--r--src/quicktemplates2/qquickcombobox_p.h63
-rw-r--r--src/quicktemplates2/qquickcontainer_p.h1
-rw-r--r--src/quicktemplates2/qquickdial.cpp56
-rw-r--r--src/quicktemplates2/qquickdial_p.h13
-rw-r--r--src/quicktemplates2/qquickdialogbuttonbox.cpp2
-rw-r--r--src/quicktemplates2/qquickdrawer.cpp5
-rw-r--r--src/quicktemplates2/qquickdrawer_p.h3
-rw-r--r--src/quicktemplates2/qquickpage.cpp90
-rw-r--r--src/quicktemplates2/qquickpage_p.h15
-rw-r--r--src/quicktemplates2/qquickpopup_p.h24
-rw-r--r--src/quicktemplates2/qquickrangeslider.cpp114
-rw-r--r--src/quicktemplates2/qquickrangeslider_p.h14
-rw-r--r--src/quicktemplates2/qquickscrollbar_p.h3
-rw-r--r--src/quicktemplates2/qquickslider.cpp59
-rw-r--r--src/quicktemplates2/qquickslider_p.h13
-rw-r--r--src/quicktemplates2/qquickspinbox.cpp32
-rw-r--r--src/quicktemplates2/qquickspinbox_p.h16
-rw-r--r--src/quicktemplates2/qquickstackview_p.h7
-rw-r--r--src/quicktemplates2/qquickswipe_p.h24
-rw-r--r--src/quicktemplates2/qquickswipeview.cpp12
-rw-r--r--src/quicktemplates2/qquickswipeview_p.h20
-rw-r--r--src/quicktemplates2/qquicktabbar_p.h3
-rw-r--r--src/quicktemplates2/qquicktextarea.cpp16
-rw-r--r--src/quicktemplates2/qquicktextarea_p.h11
-rw-r--r--src/quicktemplates2/qquicktextfield.cpp12
-rw-r--r--src/quicktemplates2/qquicktextfield_p.h7
-rw-r--r--src/quicktemplates2/qquicktumbler.cpp10
-rw-r--r--src/quicktemplates2/qquicktumbler_p.h10
-rw-r--r--tests/auto/controls/data/tst_scrollbar.qml4
-rw-r--r--tests/auto/controls/data/tst_textfield.qml15
-rw-r--r--tests/manual/viewinqwidget/main.cpp6
-rw-r--r--tests/manual/viewinqwidget/viewinqwidget.pro4
35 files changed, 542 insertions, 442 deletions
diff --git a/src/quicktemplates2/qquickabstractbutton_p.h b/src/quicktemplates2/qquickabstractbutton_p.h
index 81384298..ecd297e7 100644
--- a/src/quicktemplates2/qquickabstractbutton_p.h
+++ b/src/quicktemplates2/qquickabstractbutton_p.h
@@ -129,7 +129,6 @@ Q_SIGNALS:
void released();
void canceled();
void clicked();
- Q_REVISION(2) void toggled();
void pressAndHold();
void doubleClicked();
void textChanged();
@@ -139,6 +138,8 @@ Q_SIGNALS:
void checkableChanged();
void autoExclusiveChanged();
void indicatorChanged();
+ // 2.2 (Qt 5.9)
+ Q_REVISION(2) void toggled();
Q_REVISION(3) void iconChanged();
Q_REVISION(3) void displayChanged();
Q_REVISION(3) void actionChanged();
diff --git a/src/quicktemplates2/qquickbuttongroup_p.h b/src/quicktemplates2/qquickbuttongroup_p.h
index cd46d8f7..51712b03 100644
--- a/src/quicktemplates2/qquickbuttongroup_p.h
+++ b/src/quicktemplates2/qquickbuttongroup_p.h
@@ -87,8 +87,9 @@ public Q_SLOTS:
Q_SIGNALS:
void checkedButtonChanged();
void buttonsChanged();
- Q_REVISION(3) void exclusiveChanged();
+ // 2.1 (Qt 5.8)
Q_REVISION(1) void clicked(QQuickAbstractButton *button);
+ Q_REVISION(3) void exclusiveChanged();
private:
Q_DISABLE_COPY(QQuickButtonGroup)
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp
index 48d75f88..6b20e6a5 100644
--- a/src/quicktemplates2/qquickcombobox.cpp
+++ b/src/quicktemplates2/qquickcombobox.cpp
@@ -792,124 +792,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
@@ -1039,34 +921,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
@@ -1209,6 +1063,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 ce9ff17e..dd1e1d4f 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 d8773684..8cea0755 100644
--- a/src/quicktemplates2/qquickcontainer_p.h
+++ b/src/quicktemplates2/qquickcontainer_p.h
@@ -88,6 +88,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/qquickdialogbuttonbox.cpp b/src/quicktemplates2/qquickdialogbuttonbox.cpp
index 45924139..b6a9d757 100644
--- a/src/quicktemplates2/qquickdialogbuttonbox.cpp
+++ b/src/quicktemplates2/qquickdialogbuttonbox.cpp
@@ -217,7 +217,7 @@ void QQuickDialogButtonBoxPrivate::resizeContent()
const int valign = alignment & Qt::AlignVertical_Mask;
const qreal cw = !halign ? q->availableWidth() : contentItem->implicitWidth();
- const qreal ch = !valign ? q->availableHeight() : contentItem->implicitWidth();
+ const qreal ch = !valign ? q->availableHeight() : contentItem->implicitHeight();
QRectF geometry = q->boundingRect().adjusted(q->leftPadding(), q->topPadding(), -q->rightPadding(), -q->bottomPadding());
if (halign || valign)
diff --git a/src/quicktemplates2/qquickdrawer.cpp b/src/quicktemplates2/qquickdrawer.cpp
index 328778ca..022c9dbf 100644
--- a/src/quicktemplates2/qquickdrawer.cpp
+++ b/src/quicktemplates2/qquickdrawer.cpp
@@ -153,6 +153,11 @@ QT_BEGIN_NAMESPACE
If you would like the application's contents to stay where they are when
the drawer is opened, don't apply a translation.
+ Drawer can be configured as a non-closable persistent side panel by
+ making the Drawer \l {Popup::modal}{non-modal} and \l {interactive}
+ {non-interactive}. See the \l {Qt Quick Controls 2 - Side Panel}{Side Panel}
+ example for more details.
+
\note On some platforms, certain edges may be reserved for system
gestures and therefore cannot be used with Drawer. For example, the
top and bottom edges may be reserved for system notifications and
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 a8e6ea11..9dc4115e 100644
--- a/src/quicktemplates2/qquickpopup_p.h
+++ b/src/quicktemplates2/qquickpopup_p.h
@@ -85,7 +85,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)
@@ -119,6 +118,8 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickPopup : public QObject, public QQml
Q_PROPERTY(TransformOrigin transformOrigin READ transformOrigin WRITE setTransformOrigin FINAL)
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:
@@ -160,10 +161,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();
@@ -300,11 +297,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();
@@ -316,7 +322,6 @@ Q_SIGNALS:
void contentHeightChanged();
void availableWidthChanged();
void availableHeightChanged();
- Q_REVISION(1) void spacingChanged();
void marginsChanged();
void topMarginChanged();
void leftMarginChanged();
@@ -349,11 +354,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 154688b2..d16cd3b4 100644
--- a/src/quicktemplates2/qquickrangeslider.cpp
+++ b/src/quicktemplates2/qquickrangeslider.cpp
@@ -810,63 +810,6 @@ void QQuickRangeSlider::setOrientation(Qt::Orientation orientation)
}
/*!
- \since QtQuick.Controls 2.3 (Qt 5.10)
- \qmlproperty bool QtQuick.Controls::RangeSlider::horizontal
- \readonly
-
- This property holds whether the slider is horizontal.
-
- \sa orientation
-*/
-bool QQuickRangeSlider::isHorizontal() const
-{
- Q_D(const QQuickRangeSlider);
- return d->orientation == Qt::Horizontal;
-}
-
-/*!
- \since QtQuick.Controls 2.3 (Qt 5.10)
- \qmlproperty bool QtQuick.Controls::RangeSlider::vertical
- \readonly
-
- This property holds whether the slider is vertical.
-
- \sa orientation
-*/
-bool QQuickRangeSlider::isVertical() const
-{
- Q_D(const QQuickRangeSlider);
- return d->orientation == Qt::Vertical;
-}
-
-/*!
- \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.
@@ -923,6 +866,63 @@ 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();
+}
+
+/*!
+ \since QtQuick.Controls 2.3 (Qt 5.10)
+ \qmlproperty bool QtQuick.Controls::RangeSlider::horizontal
+ \readonly
+
+ This property holds whether the slider is horizontal.
+
+ \sa orientation
+*/
+bool QQuickRangeSlider::isHorizontal() const
+{
+ Q_D(const QQuickRangeSlider);
+ return d->orientation == Qt::Horizontal;
+}
+
+/*!
+ \since QtQuick.Controls 2.3 (Qt 5.10)
+ \qmlproperty bool QtQuick.Controls::RangeSlider::vertical
+ \readonly
+
+ This property holds whether the slider is vertical.
+
+ \sa orientation
+*/
+bool QQuickRangeSlider::isVertical() const
+{
+ Q_D(const QQuickRangeSlider);
+ return d->orientation == Qt::Vertical;
+}
+
void QQuickRangeSlider::focusInEvent(QFocusEvent *event)
{
Q_D(QQuickRangeSlider);
diff --git a/src/quicktemplates2/qquickrangeslider_p.h b/src/quicktemplates2/qquickrangeslider_p.h
index 82d61b37..03c0c663 100644
--- a/src/quicktemplates2/qquickrangeslider_p.h
+++ b/src/quicktemplates2/qquickrangeslider_p.h
@@ -65,9 +65,10 @@ 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)
Q_PROPERTY(bool horizontal READ isHorizontal NOTIFY orientationChanged FINAL REVISION 3)
Q_PROPERTY(bool vertical READ isVertical NOTIFY orientationChanged FINAL REVISION 3)
- Q_PROPERTY(bool live READ live WRITE setLive NOTIFY liveChanged FINAL REVISION 2)
public:
explicit QQuickRangeSlider(QQuickItem *parent = nullptr);
@@ -97,13 +98,14 @@ public:
Qt::Orientation orientation() const;
void setOrientation(Qt::Orientation orientation);
- bool isHorizontal() const;
- bool isVertical() const;
+ 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);
+ bool isHorizontal() const;
+ bool isVertical() const;
Q_SIGNALS:
void fromChanged();
@@ -111,6 +113,7 @@ Q_SIGNALS:
void stepSizeChanged();
void snapModeChanged();
void orientationChanged();
+ // 2.2 (Qt 5.9)
Q_REVISION(2) void liveChanged();
protected:
@@ -149,6 +152,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:
@@ -167,6 +171,7 @@ public:
bool isPressed() const;
void setPressed(bool pressed);
+ // 2.1 (Qt 5.8)
bool isHovered() const;
void setHovered(bool hovered);
@@ -180,6 +185,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 9b417a2b..b4a92d0a 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)
@@ -90,6 +91,7 @@ public:
Qt::Orientation orientation() const;
void setOrientation(Qt::Orientation orientation);
+ // 2.2 (Qt 5.9)
enum SnapMode {
NoSnap,
SnapAlways,
@@ -130,6 +132,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 b5bf5e52..8628f981 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.
@@ -572,7 +545,37 @@ void QQuickSlider::setHandle(QQuickItem *handle)
qreal QQuickSlider::valueAt(qreal position) const
{
Q_D(const QQuickSlider);
- return d->from + (d->to - d->from) * position;
+ const qreal value = d->from + (d->to - d->from) * position;
+ if (qFuzzyIsNull(d->stepSize))
+ return value;
+ return qRound(value / d->stepSize) * d->stepSize;
+}
+
+/*!
+ \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();
}
/*!
diff --git a/src/quicktemplates2/qquickslider_p.h b/src/quicktemplates2/qquickslider_p.h
index 21a880f5..91b26b75 100644
--- a/src/quicktemplates2/qquickslider_p.h
+++ b/src/quicktemplates2/qquickslider_p.h
@@ -64,12 +64,12 @@ 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(bool horizontal READ isHorizontal NOTIFY orientationChanged FINAL REVISION 3)
Q_PROPERTY(bool vertical READ isVertical NOTIFY orientationChanged FINAL REVISION 3)
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);
@@ -99,9 +99,6 @@ public:
SnapMode snapMode() const;
void setSnapMode(SnapMode mode);
- bool live() const;
- void setLive(bool live);
-
bool isPressed() const;
void setPressed(bool pressed);
@@ -114,8 +111,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();
@@ -128,11 +130,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 aaf0fbad..ef1c9d97 100644
--- a/src/quicktemplates2/qquickspinbox.cpp
+++ b/src/quicktemplates2/qquickspinbox.cpp
@@ -978,22 +978,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);
@@ -1016,4 +1000,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 13ba89a9..26c1dd40 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)
Q_PROPERTY(bool wrap READ wrap WRITE setWrap NOTIFY wrapChanged FINAL REVISION 3)
@@ -105,6 +106,7 @@ public:
QQuickSpinButton *up() const;
QQuickSpinButton *down() const;
+ // 2.2 (Qt 5.9)
Qt::InputMethodHints inputMethodHints() const;
void setInputMethodHints(Qt::InputMethodHints hints);
@@ -126,6 +128,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();
@@ -164,8 +167,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);
@@ -173,16 +177,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 21c20f3a..fcbf0a93 100644
--- a/src/quicktemplates2/qquickstackview_p.h
+++ b/src/quicktemplates2/qquickstackview_p.h
@@ -172,6 +172,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:
@@ -182,6 +183,7 @@ public:
QQuickStackView *view() const;
QQuickStackView::Status status() const;
+ // 2.2 (Qt 5.9)
bool isVisible() const;
void setVisible(bool visible);
void resetVisible();
@@ -190,13 +192,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 ce586363..5f84f93e 100644
--- a/src/quicktemplates2/qquickswipeview.cpp
+++ b/src/quicktemplates2/qquickswipeview.cpp
@@ -415,12 +415,6 @@ QQuickSwipeViewAttached::QQuickSwipeViewAttached(QObject *parent)
qmlWarning(parent) << "SwipeView: attached properties must be accessed from within a child item";
}
-QQuickSwipeView *QQuickSwipeViewAttached::view() const
-{
- Q_D(const QQuickSwipeViewAttached);
- return d->swipeView;
-}
-
int QQuickSwipeViewAttached::index() const
{
Q_D(const QQuickSwipeViewAttached);
@@ -433,6 +427,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 543cb6aa..82db6457 100644
--- a/src/quicktemplates2/qquickswipeview_p.h
+++ b/src/quicktemplates2/qquickswipeview_p.h
@@ -58,7 +58,9 @@ 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)
Q_PROPERTY(bool horizontal READ isHorizontal NOTIFY orientationChanged FINAL REVISION 3)
Q_PROPERTY(bool vertical READ isVertical NOTIFY orientationChanged FINAL REVISION 3)
@@ -66,19 +68,23 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSwipeView : public QQuickContainer
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);
bool isHorizontal() const;
bool isVertical() const;
- 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:
@@ -103,25 +109,29 @@ 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);
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 0e4a3c58..f0299bd5 100644
--- a/src/quicktemplates2/qquicktabbar_p.h
+++ b/src/quicktemplates2/qquicktabbar_p.h
@@ -60,6 +60,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)
@@ -75,6 +76,7 @@ public:
Position position() const;
void setPosition(Position position);
+ // 2.2 (Qt 5.9)
qreal contentWidth() const;
void setContentWidth(qreal width);
void resetContentWidth();
@@ -87,6 +89,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 19ede665..02e84a35 100644
--- a/src/quicktemplates2/qquicktextarea.cpp
+++ b/src/quicktemplates2/qquicktextarea.cpp
@@ -559,6 +559,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
@@ -635,14 +643,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);
-}
-
/*!
\since QtQuick.Controls 2.3 (Qt 5.10)
\qmlproperty palette QtQuick.Controls::TextArea::palette
diff --git a/src/quicktemplates2/qquicktextarea_p.h b/src/quicktemplates2/qquicktextarea_p.h
index 4709d41a..0c3a6c65 100644
--- a/src/quicktemplates2/qquicktextarea_p.h
+++ b/src/quicktemplates2/qquicktextarea_p.h
@@ -68,6 +68,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)
Q_PROPERTY(QPalette palette READ palette WRITE setPalette RESET resetPalette NOTIFY paletteChanged FINAL REVISION 3)
@@ -90,6 +91,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);
@@ -97,8 +101,6 @@ public:
void setHoverEnabled(bool enabled);
void resetHoverEnabled();
- bool contains(const QPointF &point) const override;
-
QPalette palette() const;
void setPalette(const QPalette &palette);
void resetPalette();
@@ -110,11 +112,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();
Q_REVISION(3) void paletteChanged();
protected:
diff --git a/src/quicktemplates2/qquicktextfield.cpp b/src/quicktemplates2/qquicktextfield.cpp
index 189c26be..fba0e67c 100644
--- a/src/quicktemplates2/qquicktextfield.cpp
+++ b/src/quicktemplates2/qquicktextfield.cpp
@@ -637,7 +637,8 @@ void QQuickTextField::mousePressEvent(QMouseEvent *event)
QQuickTextInput::mousePressEvent(d->pressHandler.delayedMousePressEvent);
d->pressHandler.clearDelayedMouseEvent();
}
- QQuickTextInput::mousePressEvent(event);
+ if (event->buttons() != Qt::RightButton)
+ QQuickTextInput::mousePressEvent(event);
}
}
@@ -650,7 +651,8 @@ void QQuickTextField::mouseMoveEvent(QMouseEvent *event)
QQuickTextInput::mousePressEvent(d->pressHandler.delayedMousePressEvent);
d->pressHandler.clearDelayedMouseEvent();
}
- QQuickTextInput::mouseMoveEvent(event);
+ if (event->buttons() != Qt::RightButton)
+ QQuickTextInput::mouseMoveEvent(event);
}
}
@@ -663,7 +665,8 @@ void QQuickTextField::mouseReleaseEvent(QMouseEvent *event)
QQuickTextInput::mousePressEvent(d->pressHandler.delayedMousePressEvent);
d->pressHandler.clearDelayedMouseEvent();
}
- QQuickTextInput::mouseReleaseEvent(event);
+ if (event->buttons() != Qt::RightButton)
+ QQuickTextInput::mouseReleaseEvent(event);
}
}
@@ -674,7 +677,8 @@ void QQuickTextField::mouseDoubleClickEvent(QMouseEvent *event)
QQuickTextInput::mousePressEvent(d->pressHandler.delayedMousePressEvent);
d->pressHandler.clearDelayedMouseEvent();
}
- QQuickTextInput::mouseDoubleClickEvent(event);
+ if (event->buttons() != Qt::RightButton)
+ QQuickTextInput::mouseDoubleClickEvent(event);
}
void QQuickTextField::timerEvent(QTimerEvent *event)
diff --git a/src/quicktemplates2/qquicktextfield_p.h b/src/quicktemplates2/qquicktextfield_p.h
index 0629a158..dafe1c30 100644
--- a/src/quicktemplates2/qquicktextfield_p.h
+++ b/src/quicktemplates2/qquicktextfield_p.h
@@ -67,6 +67,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)
Q_PROPERTY(QPalette palette READ palette WRITE setPalette RESET resetPalette NOTIFY paletteChanged FINAL REVISION 3)
@@ -86,6 +87,7 @@ public:
Qt::FocusReason focusReason() const;
void setFocusReason(Qt::FocusReason reason);
+ // 2.1 (Qt 5.8)
bool isHovered() const;
void setHovered(bool hovered);
@@ -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();
Q_REVISION(3) void paletteChanged();
protected:
diff --git a/src/quicktemplates2/qquicktumbler.cpp b/src/quicktemplates2/qquicktumbler.cpp
index 42fbcc20..bed3e400 100644
--- a/src/quicktemplates2/qquicktumbler.cpp
+++ b/src/quicktemplates2/qquicktumbler.cpp
@@ -461,6 +461,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)
@@ -506,11 +511,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 afdce23c..5d4df4a7 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:
diff --git a/tests/auto/controls/data/tst_scrollbar.qml b/tests/auto/controls/data/tst_scrollbar.qml
index bc424a27..d515db7e 100644
--- a/tests/auto/controls/data/tst_scrollbar.qml
+++ b/tests/auto/controls/data/tst_scrollbar.qml
@@ -704,7 +704,7 @@ TestCase {
}
function test_overshoot() {
- var container = flickable.createObject(testCase)
+ var container = createTemporaryObject(flickable, testCase)
verify(container)
waitForRendering(container)
@@ -733,8 +733,6 @@ TestCase {
horizontal.position = 0.8
compare(horizontal.contentItem.x, horizontal.leftPadding + 0.8 * horizontal.availableWidth)
compare(horizontal.contentItem.width, 0.2 * horizontal.availableWidth)
-
- container.destroy()
}
function test_orientation() {
diff --git a/tests/auto/controls/data/tst_textfield.qml b/tests/auto/controls/data/tst_textfield.qml
index 6a40f053..0fee7363 100644
--- a/tests/auto/controls/data/tst_textfield.qml
+++ b/tests/auto/controls/data/tst_textfield.qml
@@ -420,4 +420,19 @@ TestCase {
mouseClick(control, rect.x + rect.width / 2, rect.y + rect.height / 2)
compare(control.selectedText, "Qt Quick Controls 2 TextArea")
}
+
+ // QTBUG-64048
+ function test_rightClick() {
+ var control = createTemporaryObject(textField, testCase, {text: "TextField", selectByMouse: true})
+ verify(control)
+
+ control.selectAll()
+ compare(control.selectedText, "TextField")
+
+ mouseClick(control, control.width / 2, control.height / 2, Qt.RightButton)
+ compare(control.selectedText, "TextField")
+
+ mouseClick(control, control.width / 2, control.height / 2, Qt.LeftButton | Qt.RightButton)
+ compare(control.selectedText, "")
+ }
}
diff --git a/tests/manual/viewinqwidget/main.cpp b/tests/manual/viewinqwidget/main.cpp
index c7050bc1..80cbb415 100644
--- a/tests/manual/viewinqwidget/main.cpp
+++ b/tests/manual/viewinqwidget/main.cpp
@@ -39,6 +39,7 @@
#include <QVBoxLayout>
#include <QDebug>
#include <QDesktopWidget>
+#include <QDir>
#include <QGroupBox>
#include <QQmlApplicationEngine>
#include <QQmlError>
@@ -66,8 +67,9 @@ int main(int argc, char *argv[])
}
hLayout->addWidget(groupBox);
- const QUrl gallerySource(QLatin1String("qrc:/gallery.qml"));
- QQmlApplicationEngine engine(gallerySource);
+ const QString gallerySource =
+ QDir::cleanPath(QLatin1String(SRCDIR"../../../examples/quickcontrols2/gallery/gallery.qml"));
+ QQmlApplicationEngine engine(QUrl::fromLocalFile(gallerySource));
QObject *root = engine.rootObjects().value(0, nullptr);
if (!root || !root->isWindowType()) {
qWarning() << "Load error" << gallerySource;
diff --git a/tests/manual/viewinqwidget/viewinqwidget.pro b/tests/manual/viewinqwidget/viewinqwidget.pro
index 9b7cba00..649829d4 100644
--- a/tests/manual/viewinqwidget/viewinqwidget.pro
+++ b/tests/manual/viewinqwidget/viewinqwidget.pro
@@ -2,5 +2,5 @@ QT += qml quick widgets quickwidgets
TARGET = viewinqwidget
SOURCES += $$PWD/main.cpp
OTHER_FILES += main.qml
-RESOURCES += viewinqwidget.qrc \
- ../../../examples/controls/gallery/gallery.qrc
+RESOURCES += viewinqwidget.qrc
+DEFINES += SRCDIR=\\\"$$PWD/\\\"