aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-11-06 20:32:26 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2017-11-06 20:32:26 +0100
commit501d45012f746d843e0144c78202297a577758bc (patch)
tree5c2b125327d49e3495b5f47995d93fb4215acbb4 /src/quicktemplates2
parent9e1b044afa994cdd77fd256cea78cd144e804d76 (diff)
parent442843db6f5dce6b594448d43b380c9b884a7c91 (diff)
Merge remote-tracking branch 'origin/5.10' into dev
Conflicts: src/quickcontrols2/qquickchecklabel.cpp src/quickcontrols2/qquickchecklabel_p.h src/quickcontrols2/qquickmnemoniclabel_p.h src/quicktemplates2/qquickbuttongroup_p.h src/quicktemplates2/qquickspinbox.cpp src/quicktemplates2/qquickswipedelegate.cpp Change-Id: I1278b78dcaf25be5698f34751193b83dc951eb3c
Diffstat (limited to 'src/quicktemplates2')
-rw-r--r--src/quicktemplates2/qquickabstractbutton.cpp56
-rw-r--r--src/quicktemplates2/qquickabstractbutton_p.h6
-rw-r--r--src/quicktemplates2/qquickapplicationwindow.cpp12
-rw-r--r--src/quicktemplates2/qquickapplicationwindow_p.h9
-rw-r--r--src/quicktemplates2/qquickbutton.cpp7
-rw-r--r--src/quicktemplates2/qquickbuttongroup_p.h5
-rw-r--r--src/quicktemplates2/qquickcombobox.cpp294
-rw-r--r--src/quicktemplates2/qquickcombobox_p.h63
-rw-r--r--src/quicktemplates2/qquickcontainer.cpp40
-rw-r--r--src/quicktemplates2/qquickcontainer_p.h4
-rw-r--r--src/quicktemplates2/qquickcontainer_p_p.h1
-rw-r--r--src/quicktemplates2/qquickcontrol.cpp2
-rw-r--r--src/quicktemplates2/qquickcontrol_p.h3
-rw-r--r--src/quicktemplates2/qquickdial.cpp56
-rw-r--r--src/quicktemplates2/qquickdial_p.h13
-rw-r--r--src/quicktemplates2/qquickdialog_p.h12
-rw-r--r--src/quicktemplates2/qquickdialogbuttonbox.cpp6
-rw-r--r--src/quicktemplates2/qquickdialogbuttonbox_p.h8
-rw-r--r--src/quicktemplates2/qquickdrawer.cpp5
-rw-r--r--src/quicktemplates2/qquickdrawer_p.h3
-rw-r--r--src/quicktemplates2/qquickitemdelegate.cpp5
-rw-r--r--src/quicktemplates2/qquicklabel_p.h3
-rw-r--r--src/quicktemplates2/qquickmenu.cpp26
-rw-r--r--src/quicktemplates2/qquickmenu_p.h36
-rw-r--r--src/quicktemplates2/qquickmenuitem.cpp4
-rw-r--r--src/quicktemplates2/qquickmenuitem_p.h3
-rw-r--r--src/quicktemplates2/qquickpage.cpp90
-rw-r--r--src/quicktemplates2/qquickpage_p.h15
-rw-r--r--src/quicktemplates2/qquickpopup.cpp2
-rw-r--r--src/quicktemplates2/qquickpopup_p.h64
-rw-r--r--src/quicktemplates2/qquickrangeslider.cpp114
-rw-r--r--src/quicktemplates2/qquickrangeslider_p.h16
-rw-r--r--src/quicktemplates2/qquickscrollbar_p.h5
-rw-r--r--src/quicktemplates2/qquickscrollindicator_p.h2
-rw-r--r--src/quicktemplates2/qquickslider.cpp59
-rw-r--r--src/quicktemplates2/qquickslider_p.h25
-rw-r--r--src/quicktemplates2/qquickspinbox.cpp36
-rw-r--r--src/quicktemplates2/qquickspinbox_p.h19
-rw-r--r--src/quicktemplates2/qquickstackview.cpp1
-rw-r--r--src/quicktemplates2/qquickstackview_p.h10
-rw-r--r--src/quicktemplates2/qquickswipe_p.h24
-rw-r--r--src/quicktemplates2/qquickswipedelegate.cpp2
-rw-r--r--src/quicktemplates2/qquickswipeview.cpp12
-rw-r--r--src/quicktemplates2/qquickswipeview_p.h22
-rw-r--r--src/quicktemplates2/qquicktabbar.cpp19
-rw-r--r--src/quicktemplates2/qquicktabbar_p.h3
-rw-r--r--src/quicktemplates2/qquicktextarea.cpp16
-rw-r--r--src/quicktemplates2/qquicktextarea_p.h14
-rw-r--r--src/quicktemplates2/qquicktextfield.cpp12
-rw-r--r--src/quicktemplates2/qquicktextfield_p.h10
-rw-r--r--src/quicktemplates2/qquicktoolbutton.cpp5
-rw-r--r--src/quicktemplates2/qquicktooltip.cpp2
-rw-r--r--src/quicktemplates2/qquicktumbler.cpp185
-rw-r--r--src/quicktemplates2/qquicktumbler_p.h15
-rw-r--r--src/quicktemplates2/qquicktumbler_p_p.h37
55 files changed, 820 insertions, 698 deletions
diff --git a/src/quicktemplates2/qquickabstractbutton.cpp b/src/quicktemplates2/qquickabstractbutton.cpp
index e5a563f9..9e1a2502 100644
--- a/src/quicktemplates2/qquickabstractbutton.cpp
+++ b/src/quicktemplates2/qquickabstractbutton.cpp
@@ -68,56 +68,6 @@ static const int AUTO_REPEAT_INTERVAL = 100;
radio buttons and check boxes. As an abstract control, it has no delegate
implementations, leaving them to the types that derive from it.
- \section2 Button Icons
-
- AbstractButton provides the following properties through which icons can
- be set:
-
- \list
- \li \l icon.name
- \li \l icon.source
- \li \l icon.width
- \li \l icon.height
- \li \l icon.color
- \endlist
-
- For applications that target platforms that support both
- \l {QIcon::fromTheme()}{theme icons} and regular icons,
- both \l icon.name and \l icon.source can be set to ensure that an icon will
- always be found. If the icon is found in the theme, it will always be used;
- even if \l icon.source is also set. If the icon is not found,
- \l icon.source will be used instead.
-
- \code
- Button {
- icon.name: "edit-cut"
- icon.source: "qrc:/icons/edit-cut.png"
- }
- \endcode
-
- Each \l {Styling Qt Quick Controls 2}{style} sets a default icon size and
- color according to their guidelines, but it is possible to override these
- by setting the \l icon.width, \l icon.height, and \l icon.color properties.
-
- The image that is loaded by an icon whose \c width and \c height are not set
- depends on the type of icon in use. For theme icons, the closest available
- size will be chosen. For regular icons, the behavior is the same as the
- \l {Image::}{sourceSize} property of \l Image.
-
- The icon color is specified by default so that it matches the text color in
- different states. In order to use an icon with the original colors, set the
- color to \c "transparent".
-
- \code
- Button {
- icon.color: "transparent"
- icon.source: "qrc:/icons/logo.png"
- }
- \endcode
-
- The \l display property can be used to control how the icon and text are
- displayed within the button.
-
\sa ButtonGroup, {Button Controls}
*/
@@ -463,7 +413,7 @@ QQuickAbstractButton::~QQuickAbstractButton()
\note The text is used for accessibility purposes, so it makes sense to
set a textual description even if the content item is an image.
- \sa {Control::contentItem}{contentItem}
+ \sa icon, display, {Control::contentItem}{contentItem}
*/
QString QQuickAbstractButton::text() const
{
@@ -481,7 +431,7 @@ void QQuickAbstractButton::setText(const QString &text)
setShortcut(QKeySequence::mnemonic(text));
#endif
- d->text = QPlatformTheme::removeMnemonics(text); // ### TODO: visualize mnemonics
+ d->text = text;
setAccessibleName(d->text);
buttonChange(ButtonTextChange);
emit textChanged();
@@ -719,7 +669,7 @@ void QQuickAbstractButton::setIndicator(QQuickItem *indicator)
\include qquickicon.qdocinc grouped-properties
- \sa {Button Icons}
+ \sa text, display, {Icons in Qt Quick Controls 2}
*/
QQuickIcon QQuickAbstractButton::icon() const
diff --git a/src/quicktemplates2/qquickabstractbutton_p.h b/src/quicktemplates2/qquickabstractbutton_p.h
index ccaf6d19..81caed5a 100644
--- a/src/quicktemplates2/qquickabstractbutton_p.h
+++ b/src/quicktemplates2/qquickabstractbutton_p.h
@@ -67,6 +67,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickAbstractButton : public QQuickContr
Q_PROPERTY(bool autoExclusive READ autoExclusive WRITE setAutoExclusive NOTIFY autoExclusiveChanged FINAL)
Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat NOTIFY autoRepeatChanged FINAL)
Q_PROPERTY(QQuickItem *indicator READ indicator WRITE setIndicator NOTIFY indicatorChanged FINAL)
+ // 2.3 (Qt 5.10)
Q_PROPERTY(QQuickIcon icon READ icon WRITE setIcon NOTIFY iconChanged FINAL REVISION 3)
Q_PROPERTY(Display display READ display WRITE setDisplay NOTIFY displayChanged FINAL REVISION 3)
Q_PROPERTY(QQuickAction *action READ action WRITE setAction NOTIFY actionChanged FINAL REVISION 3)
@@ -104,6 +105,7 @@ public:
QQuickItem *indicator() const;
void setIndicator(QQuickItem *indicator);
+ // 2.3 (Qt 5.10)
QQuickIcon icon() const;
void setIcon(const QQuickIcon &icon);
@@ -143,7 +145,6 @@ Q_SIGNALS:
void released();
void canceled();
void clicked();
- Q_REVISION(2) void toggled();
void pressAndHold();
void doubleClicked();
void textChanged();
@@ -154,6 +155,9 @@ Q_SIGNALS:
void autoExclusiveChanged();
void autoRepeatChanged();
void indicatorChanged();
+ // 2.2 (Qt 5.9)
+ Q_REVISION(2) void toggled();
+ // 2.3 (Qt 5.10)
Q_REVISION(3) void iconChanged();
Q_REVISION(3) void displayChanged();
Q_REVISION(3) void actionChanged();
diff --git a/src/quicktemplates2/qquickapplicationwindow.cpp b/src/quicktemplates2/qquickapplicationwindow.cpp
index 2ef84a17..d579afb2 100644
--- a/src/quicktemplates2/qquickapplicationwindow.cpp
+++ b/src/quicktemplates2/qquickapplicationwindow.cpp
@@ -349,6 +349,11 @@ QQuickApplicationWindow::~QQuickApplicationWindow()
d_ptr.reset(); // QTBUG-52731
}
+QQuickApplicationWindowAttached *QQuickApplicationWindow::qmlAttachedProperties(QObject *object)
+{
+ return new QQuickApplicationWindowAttached(object);
+}
+
/*!
\qmlproperty Item QtQuick.Controls::ApplicationWindow::background
@@ -718,7 +723,7 @@ void QQuickApplicationWindow::resetLocale()
property on the window's palette, that property propagates to all child controls in the window,
overriding any system defaults for that property.
- \sa Control::palette
+ \sa Control::palette, Popup::palette, {qtquickcontrols2-palette}{palette QML Basic Type}
*/
QPalette QQuickApplicationWindow::palette() const
{
@@ -788,11 +793,6 @@ void QQuickApplicationWindow::setMenuBar(QQuickItem *menuBar)
emit menuBarChanged();
}
-QQuickApplicationWindowAttached *QQuickApplicationWindow::qmlAttachedProperties(QObject *object)
-{
- return new QQuickApplicationWindowAttached(object);
-}
-
bool QQuickApplicationWindow::isComponentComplete() const
{
Q_D(const QQuickApplicationWindow);
diff --git a/src/quicktemplates2/qquickapplicationwindow_p.h b/src/quicktemplates2/qquickapplicationwindow_p.h
index ceab70e6..4e24009f 100644
--- a/src/quicktemplates2/qquickapplicationwindow_p.h
+++ b/src/quicktemplates2/qquickapplicationwindow_p.h
@@ -73,6 +73,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickApplicationWindow : public QQuickWi
Q_PROPERTY(QQuickOverlay *overlay READ overlay CONSTANT FINAL)
Q_PROPERTY(QFont font READ font WRITE setFont RESET resetFont NOTIFY fontChanged FINAL)
Q_PROPERTY(QLocale locale READ locale WRITE setLocale RESET resetLocale NOTIFY localeChanged FINAL)
+ // 2.3 (Qt 5.10)
Q_PROPERTY(QPalette palette READ palette WRITE setPalette RESET resetPalette NOTIFY paletteChanged FINAL REVISION 3)
Q_PROPERTY(QQuickItem *menuBar READ menuBar WRITE setMenuBar NOTIFY menuBarChanged FINAL REVISION 3)
Q_CLASSINFO("DefaultProperty", "contentData")
@@ -81,6 +82,8 @@ public:
explicit QQuickApplicationWindow(QWindow *parent = nullptr);
~QQuickApplicationWindow();
+ static QQuickApplicationWindowAttached *qmlAttachedProperties(QObject *object);
+
QQuickItem *background() const;
void setBackground(QQuickItem *background);
@@ -105,6 +108,7 @@ public:
void setLocale(const QLocale &locale);
void resetLocale();
+ // 2.3 (Qt 5.10)
QPalette palette() const;
void setPalette(const QPalette &palette);
void resetPalette();
@@ -112,8 +116,6 @@ public:
QQuickItem *menuBar() const;
void setMenuBar(QQuickItem *menuBar);
- static QQuickApplicationWindowAttached *qmlAttachedProperties(QObject *object);
-
Q_SIGNALS:
void backgroundChanged();
void activeFocusControlChanged();
@@ -146,7 +148,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickApplicationWindowAttached : public
Q_PROPERTY(QQuickItem *header READ header NOTIFY headerChanged FINAL)
Q_PROPERTY(QQuickItem *footer READ footer NOTIFY footerChanged FINAL)
Q_PROPERTY(QQuickOverlay *overlay READ overlay NOTIFY overlayChanged FINAL)
- Q_PROPERTY(QQuickItem *menuBar READ menuBar NOTIFY menuBarChanged FINAL /*REVISION 3*/)
+ Q_PROPERTY(QQuickItem *menuBar READ menuBar NOTIFY menuBarChanged FINAL) // REVISION 3
public:
explicit QQuickApplicationWindowAttached(QObject *parent = nullptr);
@@ -166,6 +168,7 @@ Q_SIGNALS:
void headerChanged();
void footerChanged();
void overlayChanged();
+ // 2.3 (Qt 5.10)
/*Q_REVISION(3)*/ void menuBarChanged();
private:
diff --git a/src/quicktemplates2/qquickbutton.cpp b/src/quicktemplates2/qquickbutton.cpp
index adbc48fd..a1bea792 100644
--- a/src/quicktemplates2/qquickbutton.cpp
+++ b/src/quicktemplates2/qquickbutton.cpp
@@ -57,6 +57,10 @@ QT_BEGIN_NAMESPACE
a question. Typical buttons are \e OK, \e Apply, \e Cancel, \e Close,
\e Yes, \e No, and \e Help.
+ Button inherits its API from AbstractButton. For instance, you can set
+ \l {AbstractButton::text}{text}, display an \l {Icons in Qt Quick Controls 2}{icon},
+ and react to \l {AbstractButton::clicked}{clicks} using the AbstractButton API.
+
A button emits the signal \l {AbstractButton::}{clicked()} when it is activated by the user.
Connect to this signal to perform the button's action. Buttons also
provide the signals \l {AbstractButton::}{canceled()}, \l {AbstractButton::}{doubleClicked()}, \l {AbstractButton::}{pressed()},
@@ -77,9 +81,6 @@ QT_BEGIN_NAMESPACE
}
\endcode
- In addition to displaying \l {AbstractButton::}{text}, buttons can also
- display an \l [QML]{Button Icons}{icon}.
-
\sa {Customizing Button}, {Button Controls}
*/
diff --git a/src/quicktemplates2/qquickbuttongroup_p.h b/src/quicktemplates2/qquickbuttongroup_p.h
index d2cbb8c2..30a09a62 100644
--- a/src/quicktemplates2/qquickbuttongroup_p.h
+++ b/src/quicktemplates2/qquickbuttongroup_p.h
@@ -65,6 +65,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickButtonGroup : public QObject, publi
Q_OBJECT
Q_PROPERTY(QQuickAbstractButton *checkedButton READ checkedButton WRITE setCheckedButton NOTIFY checkedButtonChanged FINAL)
Q_PROPERTY(QQmlListProperty<QQuickAbstractButton> buttons READ buttons NOTIFY buttonsChanged FINAL)
+ // 2.3 (Qt 5.10)
Q_PROPERTY(bool exclusive READ isExclusive WRITE setExclusive NOTIFY exclusiveChanged FINAL REVISION 3)
Q_PROPERTY(Qt::CheckState checkState READ checkState WRITE setCheckState NOTIFY checkStateChanged FINAL REVISION 4)
Q_INTERFACES(QQmlParserStatus)
@@ -93,9 +94,11 @@ public Q_SLOTS:
Q_SIGNALS:
void checkedButtonChanged();
void buttonsChanged();
+ // 2.1 (Qt 5.8)
+ Q_REVISION(1) void clicked(QQuickAbstractButton *button);
+ // 2.3 (Qt 5.10)
Q_REVISION(3) void exclusiveChanged();
Q_REVISION(4) void checkStateChanged();
- Q_REVISION(1) void clicked(QQuickAbstractButton *button);
protected:
void classBegin() override;
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.cpp b/src/quicktemplates2/qquickcontainer.cpp
index a62de655..07fe04d2 100644
--- a/src/quicktemplates2/qquickcontainer.cpp
+++ b/src/quicktemplates2/qquickcontainer.cpp
@@ -324,6 +324,24 @@ void QQuickContainerPrivate::removeItem(int index, QQuickItem *item)
updatingCurrent = false;
}
+void QQuickContainerPrivate::reorderItems()
+{
+ Q_Q(QQuickContainer);
+ if (!contentItem)
+ return;
+
+ QList<QQuickItem *> siblings = effectiveContentItem(contentItem)->childItems();
+
+ int to = 0;
+ for (int i = 0; i < siblings.count(); ++i) {
+ QQuickItem* sibling = siblings.at(i);
+ if (QQuickItemPrivate::get(sibling)->isTransparentForPositioner())
+ continue;
+ int index = contentModel->indexOf(sibling, nullptr);
+ q->moveItem(index, to++);
+ }
+}
+
void QQuickContainerPrivate::_q_currentIndexChanged()
{
Q_Q(QQuickContainer);
@@ -347,18 +365,11 @@ void QQuickContainerPrivate::itemParentChanged(QQuickItem *item, QQuickItem *par
void QQuickContainerPrivate::itemSiblingOrderChanged(QQuickItem *)
{
- // reorder the restacked items (eg. by a Repeater)
- Q_Q(QQuickContainer);
- QList<QQuickItem *> siblings = effectiveContentItem(contentItem)->childItems();
+ if (!componentComplete)
+ return;
- int to = 0;
- for (int i = 0; i < siblings.count(); ++i) {
- QQuickItem* sibling = siblings.at(i);
- if (QQuickItemPrivate::get(sibling)->isTransparentForPositioner())
- continue;
- int index = contentModel->indexOf(sibling, nullptr);
- q->moveItem(index, to++);
- }
+ // reorder the restacked items (eg. by a Repeater)
+ reorderItems();
}
void QQuickContainerPrivate::itemDestroyed(QQuickItem *item)
@@ -737,6 +748,13 @@ QQuickItem *QQuickContainer::currentItem() const
return itemAt(d->currentIndex);
}
+void QQuickContainer::componentComplete()
+{
+ Q_D(QQuickContainer);
+ QQuickControl::componentComplete();
+ d->reorderItems();
+}
+
void QQuickContainer::itemChange(ItemChange change, const ItemChangeData &data)
{
Q_D(QQuickContainer);
diff --git a/src/quicktemplates2/qquickcontainer_p.h b/src/quicktemplates2/qquickcontainer_p.h
index 5ac585c2..030497cf 100644
--- a/src/quicktemplates2/qquickcontainer_p.h
+++ b/src/quicktemplates2/qquickcontainer_p.h
@@ -77,6 +77,7 @@ public:
Q_INVOKABLE void moveItem(int from, int to);
Q_INVOKABLE void removeItem(const QVariant &item); // ### Qt 6: remove
void removeItem(QQuickItem *item); // ### Qt 6: Q_INVOKABLE
+ // 2.3 (Qt 5.10)
Q_REVISION(3) Q_INVOKABLE QQuickItem *takeItem(int index);
QVariant contentModel() const;
@@ -88,6 +89,7 @@ public:
public Q_SLOTS:
void setCurrentIndex(int index);
+ // 2.1 (Qt 5.8)
Q_REVISION(1) void incrementCurrentIndex();
Q_REVISION(1) void decrementCurrentIndex();
@@ -100,6 +102,8 @@ Q_SIGNALS:
protected:
QQuickContainer(QQuickContainerPrivate &dd, QQuickItem *parent);
+ void componentComplete() override;
+
void itemChange(ItemChange change, const ItemChangeData &data) override;
void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override;
diff --git a/src/quicktemplates2/qquickcontainer_p_p.h b/src/quicktemplates2/qquickcontainer_p_p.h
index 54fc5c60..7791b69c 100644
--- a/src/quicktemplates2/qquickcontainer_p_p.h
+++ b/src/quicktemplates2/qquickcontainer_p_p.h
@@ -74,6 +74,7 @@ public:
void insertItem(int index, QQuickItem *item);
void moveItem(int from, int to, QQuickItem *item);
void removeItem(int index, QQuickItem *item);
+ void reorderItems();
void _q_currentIndexChanged();
diff --git a/src/quicktemplates2/qquickcontrol.cpp b/src/quicktemplates2/qquickcontrol.cpp
index e3b5c9ef..8448f9ad 100644
--- a/src/quicktemplates2/qquickcontrol.cpp
+++ b/src/quicktemplates2/qquickcontrol.cpp
@@ -1361,6 +1361,8 @@ void QQuickControl::setContentItem(QQuickItem *item)
}
}
\endcode
+
+ \sa ApplicationWindow::palette, Popup::palette, {qtquickcontrols2-palette}{palette QML Basic Type}
*/
QPalette QQuickControl::palette() const
{
diff --git a/src/quicktemplates2/qquickcontrol_p.h b/src/quicktemplates2/qquickcontrol_p.h
index eaf00ced..7dd1deb3 100644
--- a/src/quicktemplates2/qquickcontrol_p.h
+++ b/src/quicktemplates2/qquickcontrol_p.h
@@ -79,6 +79,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickControl : public QQuickItem
Q_PROPERTY(bool wheelEnabled READ isWheelEnabled WRITE setWheelEnabled NOTIFY wheelEnabledChanged FINAL)
Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
Q_PROPERTY(QQuickItem *contentItem READ contentItem WRITE setContentItem NOTIFY contentItemChanged FINAL)
+ // 2.3 (Qt 5.10)
Q_PROPERTY(QPalette palette READ palette WRITE setPalette RESET resetPalette NOTIFY paletteChanged FINAL REVISION 3)
public:
@@ -145,6 +146,7 @@ public:
QQuickItem *contentItem() const;
void setContentItem(QQuickItem *item);
+ // 2.3 (Qt 5.10)
QPalette palette() const;
void setPalette(const QPalette &palette);
void resetPalette();
@@ -169,6 +171,7 @@ Q_SIGNALS:
void wheelEnabledChanged();
void backgroundChanged();
void contentItemChanged();
+ // 2.3 (Qt 5.10)
Q_REVISION(3) void paletteChanged();
protected:
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/qquickdialog_p.h b/src/quicktemplates2/qquickdialog_p.h
index 8032cf83..d22685b6 100644
--- a/src/quicktemplates2/qquickdialog_p.h
+++ b/src/quicktemplates2/qquickdialog_p.h
@@ -63,6 +63,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickDialog : public QQuickPopup
Q_PROPERTY(QQuickItem *header READ header WRITE setHeader NOTIFY headerChanged FINAL)
Q_PROPERTY(QQuickItem *footer READ footer WRITE setFooter NOTIFY footerChanged FINAL)
Q_PROPERTY(QPlatformDialogHelper::StandardButtons standardButtons READ standardButtons WRITE setStandardButtons NOTIFY standardButtonsChanged FINAL)
+ // 2.3 (Qt 5.10)
Q_PROPERTY(int result READ result WRITE setResult NOTIFY resultChanged FINAL REVISION 3)
Q_FLAGS(QPlatformDialogHelper::StandardButtons)
@@ -82,6 +83,7 @@ public:
void setStandardButtons(QPlatformDialogHelper::StandardButtons buttons);
Q_REVISION(3) Q_INVOKABLE QQuickAbstractButton *standardButton(QPlatformDialogHelper::StandardButton button) const;
+ // 2.3 (Qt 5.10)
enum StandardCode { Rejected, Accepted };
Q_ENUM(StandardCode)
@@ -96,15 +98,15 @@ public Q_SLOTS:
Q_SIGNALS:
void accepted();
void rejected();
- Q_REVISION(3) void applied();
- Q_REVISION(3) void reset();
- Q_REVISION(3) void discarded();
- Q_REVISION(3) void helpRequested();
-
void titleChanged();
void headerChanged();
void footerChanged();
void standardButtonsChanged();
+ // 2.3 (Qt 5.10)
+ Q_REVISION(3) void applied();
+ Q_REVISION(3) void reset();
+ Q_REVISION(3) void discarded();
+ Q_REVISION(3) void helpRequested();
Q_REVISION(3) void resultChanged();
protected:
diff --git a/src/quicktemplates2/qquickdialogbuttonbox.cpp b/src/quicktemplates2/qquickdialogbuttonbox.cpp
index 7c2f17c4..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)
@@ -238,8 +238,8 @@ void QQuickDialogButtonBoxPrivate::updateLayout()
const int valign = alignment & Qt::AlignVertical_Mask;
QVector<QQuickAbstractButton *> buttons;
- const qreal maxItemWidth = (contentItem->width() - qMax(0, count - 1) * spacing) / count;
- const qreal maxItemHeight = contentItem->height();
+ const qreal maxItemWidth = ((contentItem ? contentItem->width() : q->availableWidth()) - qMax(0, count - 1) * spacing) / count;
+ const qreal maxItemHeight = contentItem ? contentItem->height() : q->availableHeight();
for (int i = 0; i < count; ++i) {
QQuickItem *item = q->itemAt(i);
diff --git a/src/quicktemplates2/qquickdialogbuttonbox_p.h b/src/quicktemplates2/qquickdialogbuttonbox_p.h
index 5d6e568e..1e3cdeef 100644
--- a/src/quicktemplates2/qquickdialogbuttonbox_p.h
+++ b/src/quicktemplates2/qquickdialogbuttonbox_p.h
@@ -98,15 +98,15 @@ Q_SIGNALS:
void accepted();
void rejected();
void helpRequested();
- Q_REVISION(3) void applied();
- Q_REVISION(3) void reset();
- Q_REVISION(3) void discarded();
void clicked(QQuickAbstractButton *button);
-
void positionChanged();
void alignmentChanged();
void standardButtonsChanged();
void delegateChanged();
+ // 2.3 (Qt 5.10)
+ Q_REVISION(3) void applied();
+ Q_REVISION(3) void reset();
+ Q_REVISION(3) void discarded();
protected:
void updatePolish() override;
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/qquickitemdelegate.cpp b/src/quicktemplates2/qquickitemdelegate.cpp
index 6eb04a46..044141f2 100644
--- a/src/quicktemplates2/qquickitemdelegate.cpp
+++ b/src/quicktemplates2/qquickitemdelegate.cpp
@@ -56,9 +56,8 @@ QT_BEGIN_NAMESPACE
in various views and controls, such as \l ListView and \l ComboBox.
ItemDelegate inherits its API from AbstractButton. For instance, you can set
- \l {AbstractButton::text}{text}, and react to \l {AbstractButton::clicked}{clicks}
- using the AbstractButton API. In addition to displaying text, item delegates
- can also display an \l [QML]{Button Icons}{icon}.
+ \l {AbstractButton::text}{text}, display an \l {Icons in Qt Quick Controls 2}{icon},
+ and react to \l {AbstractButton::clicked}{clicks} using the AbstractButton API.
\snippet qtquickcontrols2-itemdelegate.qml 1
diff --git a/src/quicktemplates2/qquicklabel_p.h b/src/quicktemplates2/qquicklabel_p.h
index a102c89a..937c57eb 100644
--- a/src/quicktemplates2/qquicklabel_p.h
+++ b/src/quicktemplates2/qquicklabel_p.h
@@ -61,6 +61,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickLabel : public QQuickText
Q_OBJECT
Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) // override
Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
+ // 2.3 (Qt 5.10)
Q_PROPERTY(QPalette palette READ palette WRITE setPalette RESET resetPalette NOTIFY paletteChanged FINAL REVISION 3)
public:
@@ -72,6 +73,7 @@ public:
QQuickItem *background() const;
void setBackground(QQuickItem *background);
+ // 2.3 (Qt 5.10)
QPalette palette() const;
void setPalette(const QPalette &palette);
void resetPalette();
@@ -79,6 +81,7 @@ public:
Q_SIGNALS:
void fontChanged();
void backgroundChanged();
+ // 2.3 (Qt 5.10)
Q_REVISION(3) void paletteChanged();
protected:
diff --git a/src/quicktemplates2/qquickmenu.cpp b/src/quicktemplates2/qquickmenu.cpp
index 9b196930..7ebeb344 100644
--- a/src/quicktemplates2/qquickmenu.cpp
+++ b/src/quicktemplates2/qquickmenu.cpp
@@ -661,19 +661,6 @@ QQuickMenu::QQuickMenu(QObject *parent)
}
/*!
- \since QtQuick.Controls 2.3 (Qt 5.10)
- \qmlproperty int QtQuick.Controls::Menu::count
- \readonly
-
- This property holds the number of items.
-*/
-int QQuickMenu::count() const
-{
- Q_D(const QQuickMenu);
- return d->contentModel->count();
-}
-
-/*!
\qmlmethod Item QtQuick.Controls::Menu::itemAt(int index)
Returns the item at \a index, or \c null if it does not exist.
@@ -1181,6 +1168,19 @@ void QQuickMenu::setCurrentIndex(int index)
d->setCurrentIndex(index, Qt::OtherFocusReason);
}
+/*!
+ \since QtQuick.Controls 2.3 (Qt 5.10)
+ \qmlproperty int QtQuick.Controls::Menu::count
+ \readonly
+
+ This property holds the number of items.
+*/
+int QQuickMenu::count() const
+{
+ Q_D(const QQuickMenu);
+ return d->contentModel->count();
+}
+
void QQuickMenu::popup(QQuickItem *menuItem)
{
Q_D(QQuickMenu);
diff --git a/src/quicktemplates2/qquickmenu_p.h b/src/quicktemplates2/qquickmenu_p.h
index 80c4c055..01b970f8 100644
--- a/src/quicktemplates2/qquickmenu_p.h
+++ b/src/quicktemplates2/qquickmenu_p.h
@@ -63,10 +63,11 @@ class QQuickMenuPrivate;
class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickMenu : public QQuickPopup
{
Q_OBJECT
- Q_PROPERTY(int count READ count NOTIFY countChanged FINAL REVISION 3)
Q_PROPERTY(QVariant contentModel READ contentModel CONSTANT FINAL)
Q_PROPERTY(QQmlListProperty<QObject> contentData READ contentData FINAL)
Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL)
+ // 2.3 (Qt 5.10)
+ Q_PROPERTY(int count READ count NOTIFY countChanged FINAL REVISION 3)
Q_PROPERTY(bool cascade READ cascade WRITE setCascade RESET resetCascade NOTIFY cascadeChanged FINAL REVISION 3)
Q_PROPERTY(qreal overlap READ overlap WRITE setOverlap NOTIFY overlapChanged FINAL REVISION 3)
Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL REVISION 3)
@@ -76,26 +77,12 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickMenu : public QQuickPopup
public:
explicit QQuickMenu(QObject *parent = nullptr);
- int count() const;
Q_INVOKABLE QQuickItem *itemAt(int index) const;
Q_INVOKABLE void addItem(QQuickItem *item);
Q_INVOKABLE void insertItem(int index, QQuickItem *item);
Q_INVOKABLE void moveItem(int from, int to);
Q_INVOKABLE void removeItem(const QVariant &item); // ### Qt 6: remove
void removeItem(QQuickItem *item); // ### Qt 6: Q_INVOKABLE
- Q_REVISION(3) Q_INVOKABLE QQuickItem *takeItem(int index);
-
- Q_REVISION(3) Q_INVOKABLE QQuickMenu *menuAt(int index) const;
- Q_REVISION(3) Q_INVOKABLE void addMenu(QQuickMenu *menu);
- Q_REVISION(3) Q_INVOKABLE void insertMenu(int index, QQuickMenu *menu);
- Q_REVISION(3) Q_INVOKABLE void removeMenu(QQuickMenu *menu);
- Q_REVISION(3) Q_INVOKABLE QQuickMenu *takeMenu(int index);
-
- Q_REVISION(3) Q_INVOKABLE QQuickAction *actionAt(int index) const;
- Q_REVISION(3) Q_INVOKABLE void addAction(QQuickAction *action);
- Q_REVISION(3) Q_INVOKABLE void insertAction(int index, QQuickAction *action);
- Q_REVISION(3) Q_INVOKABLE void removeAction(QQuickAction *action);
- Q_REVISION(3) Q_INVOKABLE QQuickAction *takeAction(int index);
QVariant contentModel() const;
QQmlListProperty<QObject> contentData();
@@ -116,6 +103,22 @@ public:
int currentIndex() const;
void setCurrentIndex(int index);
+ // 2.3 (Qt 5.10)
+ int count() const;
+ Q_REVISION(3) Q_INVOKABLE QQuickItem *takeItem(int index);
+
+ Q_REVISION(3) Q_INVOKABLE QQuickMenu *menuAt(int index) const;
+ Q_REVISION(3) Q_INVOKABLE void addMenu(QQuickMenu *menu);
+ Q_REVISION(3) Q_INVOKABLE void insertMenu(int index, QQuickMenu *menu);
+ Q_REVISION(3) Q_INVOKABLE void removeMenu(QQuickMenu *menu);
+ Q_REVISION(3) Q_INVOKABLE QQuickMenu *takeMenu(int index);
+
+ Q_REVISION(3) Q_INVOKABLE QQuickAction *actionAt(int index) const;
+ Q_REVISION(3) Q_INVOKABLE void addAction(QQuickAction *action);
+ Q_REVISION(3) Q_INVOKABLE void insertAction(int index, QQuickAction *action);
+ Q_REVISION(3) Q_INVOKABLE void removeAction(QQuickAction *action);
+ Q_REVISION(3) Q_INVOKABLE QQuickAction *takeAction(int index);
+
void popup(QQuickItem *menuItem = nullptr);
void popup(const QPointF &pos, QQuickItem *menuItem = nullptr);
@@ -129,8 +132,9 @@ protected:
void keyPressEvent(QKeyEvent *event) override;
Q_SIGNALS:
- Q_REVISION(3) void countChanged();
void titleChanged(const QString &title);
+ // 2.3 (Qt 5.10)
+ Q_REVISION(3) void countChanged();
Q_REVISION(3) void cascadeChanged(bool cascade);
Q_REVISION(3) void overlapChanged();
Q_REVISION(3) void delegateChanged();
diff --git a/src/quicktemplates2/qquickmenuitem.cpp b/src/quicktemplates2/qquickmenuitem.cpp
index 3a43dbfa..f71b9c35 100644
--- a/src/quicktemplates2/qquickmenuitem.cpp
+++ b/src/quicktemplates2/qquickmenuitem.cpp
@@ -57,8 +57,8 @@ QT_BEGIN_NAMESPACE
example.
MenuItem inherits its API from AbstractButton. For instance, you can set
- \l {AbstractButton::text}{text} and \l [QML]{Button Icons}{icon} using the
- AbstractButton API
+ \l {AbstractButton::text}{text} and \l {Icons in Qt Quick Controls 2}{icon}
+ using the AbstractButton API.
\code
Button {
diff --git a/src/quicktemplates2/qquickmenuitem_p.h b/src/quicktemplates2/qquickmenuitem_p.h
index 7c469b6a..8af3cbd1 100644
--- a/src/quicktemplates2/qquickmenuitem_p.h
+++ b/src/quicktemplates2/qquickmenuitem_p.h
@@ -59,6 +59,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickMenuItem : public QQuickAbstractBut
{
Q_OBJECT
Q_PROPERTY(bool highlighted READ isHighlighted WRITE setHighlighted NOTIFY highlightedChanged FINAL)
+ // 2.3 (Qt 5.10)
Q_PROPERTY(QQuickItem *arrow READ arrow WRITE setArrow NOTIFY arrowChanged FINAL REVISION 3)
Q_PROPERTY(QQuickMenu *menu READ menu NOTIFY menuChanged FINAL REVISION 3)
Q_PROPERTY(QQuickMenu *subMenu READ subMenu NOTIFY subMenuChanged FINAL REVISION 3)
@@ -69,6 +70,7 @@ public:
bool isHighlighted() const;
void setHighlighted(bool highlighted);
+ // 2.3 (Qt 5.10)
QQuickItem *arrow() const;
void setArrow(QQuickItem *arrow);
@@ -78,6 +80,7 @@ public:
Q_SIGNALS:
void triggered();
void highlightedChanged();
+ // 2.3 (Qt 5.10)
Q_REVISION(3) void arrowChanged();
Q_REVISION(3) void menuChanged();
Q_REVISION(3) void subMenuChanged();
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.cpp b/src/quicktemplates2/qquickpopup.cpp
index 95e3d553..472d2124 100644
--- a/src/quicktemplates2/qquickpopup.cpp
+++ b/src/quicktemplates2/qquickpopup.cpp
@@ -1505,7 +1505,7 @@ void QQuickPopup::resetFont()
}
\endcode
- \sa Control::palette, ApplicationWindow::palette
+ \sa Control::palette, ApplicationWindow::palette, {qtquickcontrols2-palette}{palette QML Basic Type}
*/
QPalette QQuickPopup::palette() const
{
diff --git a/src/quicktemplates2/qquickpopup_p.h b/src/quicktemplates2/qquickpopup_p.h
index a8e6ea11..ada4b649 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)
@@ -97,9 +96,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickPopup : public QObject, public QQml
Q_PROPERTY(qreal rightPadding READ rightPadding WRITE setRightPadding RESET resetRightPadding NOTIFY rightPaddingChanged FINAL)
Q_PROPERTY(qreal bottomPadding READ bottomPadding WRITE setBottomPadding RESET resetBottomPadding NOTIFY bottomPaddingChanged FINAL)
Q_PROPERTY(QLocale locale READ locale WRITE setLocale RESET resetLocale NOTIFY localeChanged FINAL)
- Q_PROPERTY(bool mirrored READ isMirrored NOTIFY mirroredChanged FINAL REVISION 3)
Q_PROPERTY(QFont font READ font WRITE setFont RESET resetFont NOTIFY fontChanged FINAL)
- Q_PROPERTY(QPalette palette READ palette WRITE setPalette RESET resetPalette NOTIFY paletteChanged FINAL REVISION 3)
Q_PROPERTY(QQuickItem *parent READ parentItem WRITE setParentItem RESET resetParentItem NOTIFY parentChanged FINAL)
Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
Q_PROPERTY(QQuickItem *contentItem READ contentItem WRITE setContentItem NOTIFY contentItemChanged FINAL)
@@ -111,14 +108,19 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickPopup : public QObject, public QQml
Q_PROPERTY(bool modal READ isModal WRITE setModal NOTIFY modalChanged FINAL)
Q_PROPERTY(bool dim READ dim WRITE setDim RESET resetDim NOTIFY dimChanged FINAL)
Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL)
- Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged FINAL REVISION 3)
- Q_PROPERTY(bool opened READ isOpened NOTIFY openedChanged FINAL REVISION 3)
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged FINAL)
Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged FINAL)
Q_PROPERTY(ClosePolicy closePolicy READ closePolicy WRITE setClosePolicy RESET resetClosePolicy NOTIFY closePolicyChanged FINAL)
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)
+ // 2.3 (Qt 5.10)
+ Q_PROPERTY(bool opened READ isOpened NOTIFY openedChanged FINAL REVISION 3)
+ Q_PROPERTY(bool mirrored READ isMirrored NOTIFY mirroredChanged FINAL REVISION 3)
+ Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged FINAL REVISION 3)
+ Q_PROPERTY(QPalette palette READ palette WRITE setPalette RESET resetPalette NOTIFY paletteChanged FINAL REVISION 3)
Q_CLASSINFO("DefaultProperty", "contentData")
public:
@@ -160,10 +162,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();
@@ -208,16 +206,10 @@ public:
void setLocale(const QLocale &locale);
void resetLocale();
- bool isMirrored() const;
-
QFont font() const;
void setFont(const QFont &font);
void resetFont();
- QPalette palette() const;
- void setPalette(const QPalette &palette);
- void resetPalette();
-
QQuickWindow *window() const;
QQuickItem *popupItem() const;
@@ -252,11 +244,6 @@ public:
bool isVisible() const;
virtual void setVisible(bool visible);
- bool isEnabled() const;
- void setEnabled(bool enabled);
-
- bool isOpened() const;
-
qreal opacity() const;
void setOpacity(qreal opacity);
@@ -300,11 +287,31 @@ public:
Q_INVOKABLE void forceActiveFocus(Qt::FocusReason reason = Qt::OtherFocusReason);
+ // 2.1 (Qt 5.8)
+ qreal spacing() const;
+ void setSpacing(qreal spacing);
+ void resetSpacing();
+
+ // 2.3 (Qt 5.10)
+ bool isOpened() const;
+ bool isMirrored() const;
+
+ bool isEnabled() const;
+ void setEnabled(bool enabled);
+
+ QPalette palette() const;
+ void setPalette(const QPalette &palette);
+ void resetPalette();
+
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 +323,6 @@ Q_SIGNALS:
void contentHeightChanged();
void availableWidthChanged();
void availableHeightChanged();
- Q_REVISION(1) void spacingChanged();
void marginsChanged();
void topMarginChanged();
void leftMarginChanged();
@@ -329,8 +335,6 @@ Q_SIGNALS:
void bottomPaddingChanged();
void fontChanged();
void localeChanged();
- Q_REVISION(3) void mirroredChanged();
- Q_REVISION(3) void paletteChanged();
void parentChanged();
void backgroundChanged();
void contentItemChanged();
@@ -341,19 +345,19 @@ Q_SIGNALS:
void modalChanged();
void dimChanged();
void visibleChanged();
- Q_REVISION(3) void enabledChanged();
- Q_REVISION(3) void openedChanged();
void opacityChanged();
void scaleChanged();
void closePolicyChanged();
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();
+ // 2.3 (Qt 5.10)
+ Q_REVISION(3) void openedChanged();
+ Q_REVISION(3) void mirroredChanged();
+ Q_REVISION(3) void enabledChanged();
+ Q_REVISION(3) void paletteChanged();
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..ef6e5677 100644
--- a/src/quicktemplates2/qquickrangeslider_p.h
+++ b/src/quicktemplates2/qquickrangeslider_p.h
@@ -65,9 +65,11 @@ 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)
+ // 2.3 (Qt 5.10)
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 +99,15 @@ 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);
+ // 2.3 (Qt 5.10)
+ bool isHorizontal() const;
+ bool isVertical() const;
Q_SIGNALS:
void fromChanged();
@@ -111,6 +115,7 @@ Q_SIGNALS:
void stepSizeChanged();
void snapModeChanged();
void orientationChanged();
+ // 2.2 (Qt 5.9)
Q_REVISION(2) void liveChanged();
protected:
@@ -149,6 +154,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 +173,7 @@ public:
bool isPressed() const;
void setPressed(bool pressed);
+ // 2.1 (Qt 5.8)
bool isHovered() const;
void setHovered(bool hovered);
@@ -180,6 +187,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 1ac1d306..8f0b835d 100644
--- a/src/quicktemplates2/qquickscrollbar_p.h
+++ b/src/quicktemplates2/qquickscrollbar_p.h
@@ -64,9 +64,11 @@ 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)
+ // 2.3 (Qt 5.10)
Q_PROPERTY(bool horizontal READ isHorizontal NOTIFY orientationChanged FINAL REVISION 3)
Q_PROPERTY(bool vertical READ isVertical NOTIFY orientationChanged FINAL REVISION 3)
Q_PROPERTY(qreal minimumSize READ minimumSize WRITE setMinimumSize NOTIFY minimumSizeChanged FINAL REVISION 4)
@@ -93,6 +95,7 @@ public:
Qt::Orientation orientation() const;
void setOrientation(Qt::Orientation orientation);
+ // 2.2 (Qt 5.9)
enum SnapMode {
NoSnap,
SnapAlways,
@@ -117,6 +120,7 @@ public:
Policy policy() const;
void setPolicy(Policy policy);
+ // 2.3 (Qt 5.10)
bool isHorizontal() const;
bool isVertical() const;
@@ -139,6 +143,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/qquickscrollindicator_p.h b/src/quicktemplates2/qquickscrollindicator_p.h
index c1065a3f..d679cf74 100644
--- a/src/quicktemplates2/qquickscrollindicator_p.h
+++ b/src/quicktemplates2/qquickscrollindicator_p.h
@@ -63,6 +63,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickScrollIndicator : public QQuickCont
Q_PROPERTY(qreal position READ position WRITE setPosition NOTIFY positionChanged FINAL)
Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged FINAL)
Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL)
+ // 2.3 (Qt 5.10)
Q_PROPERTY(bool horizontal READ isHorizontal NOTIFY orientationChanged FINAL REVISION 3)
Q_PROPERTY(bool vertical READ isVertical NOTIFY orientationChanged FINAL REVISION 3)
@@ -80,6 +81,7 @@ public:
Qt::Orientation orientation() const;
void setOrientation(Qt::Orientation orientation);
+ // 2.3 (Qt 5.10)
bool isHorizontal() const;
bool isVertical() const;
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..b2f4897c 100644
--- a/src/quicktemplates2/qquickslider_p.h
+++ b/src/quicktemplates2/qquickslider_p.h
@@ -64,12 +64,13 @@ 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)
+ // 2.3 (Qt 5.10)
+ Q_PROPERTY(bool horizontal READ isHorizontal NOTIFY orientationChanged FINAL REVISION 3)
+ Q_PROPERTY(bool vertical READ isVertical NOTIFY orientationChanged FINAL REVISION 3)
public:
explicit QQuickSlider(QQuickItem *parent = nullptr);
@@ -99,23 +100,26 @@ public:
SnapMode snapMode() const;
void setSnapMode(SnapMode mode);
- bool live() const;
- void setLive(bool live);
-
bool isPressed() const;
void setPressed(bool pressed);
- bool isHorizontal() const;
- bool isVertical() const;
-
Qt::Orientation orientation() const;
void setOrientation(Qt::Orientation orientation);
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);
+
+ // 2.3 (Qt 5.10)
+ bool isHorizontal() const;
+ bool isVertical() const;
+
public Q_SLOTS:
void increase();
void decrease();
@@ -128,11 +132,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 4f57c305..588944af 100644
--- a/src/quicktemplates2/qquickspinbox.cpp
+++ b/src/quicktemplates2/qquickspinbox.cpp
@@ -197,7 +197,7 @@ void QQuickSpinBoxPrivate::updateValue()
} else {
val = locale.toInt(text.toString());
}
- setValue(val, /* modified = */ true, /* allowWrap = */ false);
+ setValue(val, /* allowWrap = */ false, /* modified = */ true);
}
}
}
@@ -938,7 +938,7 @@ void QQuickSpinBox::componentComplete()
{
Q_D(QQuickSpinBox);
QQuickControl::componentComplete();
- if (!d->setValue(d->value, /* modified = */ false, /* allowWrap = */ false)) {
+ if (!d->setValue(d->value, /* allowWrap = */ false, /* modified = */ false)) {
d->updateDisplayText();
d->updateUpEnabled();
d->updateDownEnabled();
@@ -1040,22 +1040,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);
@@ -1078,4 +1062,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 164a5f04..0d911962 100644
--- a/src/quicktemplates2/qquickspinbox_p.h
+++ b/src/quicktemplates2/qquickspinbox_p.h
@@ -71,8 +71,10 @@ 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)
+ // 2.3 (Qt 5.10)
Q_PROPERTY(bool wrap READ wrap WRITE setWrap NOTIFY wrapChanged FINAL REVISION 3)
Q_PROPERTY(QString displayText READ displayText NOTIFY displayTextChanged FINAL REVISION 4)
@@ -106,11 +108,13 @@ public:
QQuickSpinButton *up() const;
QQuickSpinButton *down() const;
+ // 2.2 (Qt 5.9)
Qt::InputMethodHints inputMethodHints() const;
void setInputMethodHints(Qt::InputMethodHints hints);
bool isInputMethodComposing() const;
+ // 2.3 (Qt 5.10)
bool wrap() const;
void setWrap(bool wrap);
@@ -129,9 +133,11 @@ 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();
+ // 2.3 (Qt 5.10)
Q_REVISION(3) void wrapChanged();
Q_REVISION(4) void displayTextChanged();
@@ -169,8 +175,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);
@@ -178,16 +185,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.cpp b/src/quicktemplates2/qquickstackview.cpp
index 674e6ee1..2f13b1a1 100644
--- a/src/quicktemplates2/qquickstackview.cpp
+++ b/src/quicktemplates2/qquickstackview.cpp
@@ -1029,6 +1029,7 @@ void QQuickStackView::componentComplete()
element = QQuickStackElement::fromString(d->initialItem.toString(), this, &error);
if (!error.isEmpty()) {
d->warn(error);
+ delete element;
} else if (d->pushElement(element)) {
d->depthChange(d->elements.count(), oldDepth);
d->setCurrentItem(element);
diff --git a/src/quicktemplates2/qquickstackview_p.h b/src/quicktemplates2/qquickstackview_p.h
index 21c20f3a..2cddb800 100644
--- a/src/quicktemplates2/qquickstackview_p.h
+++ b/src/quicktemplates2/qquickstackview_p.h
@@ -72,6 +72,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickStackView : public QQuickControl
Q_PROPERTY(QQuickTransition *pushExit READ pushExit WRITE setPushExit NOTIFY pushExitChanged FINAL)
Q_PROPERTY(QQuickTransition *replaceEnter READ replaceEnter WRITE setReplaceEnter NOTIFY replaceEnterChanged FINAL)
Q_PROPERTY(QQuickTransition *replaceExit READ replaceExit WRITE setReplaceExit NOTIFY replaceExitChanged FINAL)
+ // 2.3 (Qt 5.10)
Q_PROPERTY(bool empty READ isEmpty NOTIFY emptyChanged FINAL REVISION 3)
public:
@@ -135,6 +136,7 @@ public:
Q_INVOKABLE void pop(QQmlV4Function *args);
Q_INVOKABLE void replace(QQmlV4Function *args);
+ // 2.3 (Qt 5.10)
bool isEmpty() const;
public Q_SLOTS:
@@ -150,6 +152,7 @@ Q_SIGNALS:
void pushExitChanged();
void replaceEnterChanged();
void replaceExitChanged();
+ // 2.3 (Qt 5.10)
Q_REVISION(3) void emptyChanged();
protected:
@@ -172,6 +175,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 +186,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 +195,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/qquickswipedelegate.cpp b/src/quicktemplates2/qquickswipedelegate.cpp
index 628f5d47..dcf93437 100644
--- a/src/quicktemplates2/qquickswipedelegate.cpp
+++ b/src/quicktemplates2/qquickswipedelegate.cpp
@@ -737,7 +737,6 @@ bool QQuickSwipeDelegatePrivate::handleMousePressEvent(QQuickItem *item, QMouseE
// so we correct it after calling the base class' mousePressEvent(), rather
// than having to duplicate its code just so we can set the pressPoint.
setPressPoint(item->mapToItem(q, event->pos()));
- q->grabMouse();
return true;
}
@@ -754,7 +753,6 @@ bool QQuickSwipeDelegatePrivate::handleMousePressEvent(QQuickItem *item, QMouseE
attached->setPressed(true);
// Stop the event from propagating, as QQuickItem explicitly ignores events.
event->accept();
- item->grabMouse();
return true;
}
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..03f6cefa 100644
--- a/src/quicktemplates2/qquickswipeview_p.h
+++ b/src/quicktemplates2/qquickswipeview_p.h
@@ -58,27 +58,35 @@ 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)
+ // 2.3 (Qt 5.10)
Q_PROPERTY(bool horizontal READ isHorizontal NOTIFY orientationChanged FINAL REVISION 3)
Q_PROPERTY(bool vertical READ isVertical NOTIFY orientationChanged FINAL REVISION 3)
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);
+ // 2.3 (Qt 5.10)
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 +111,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.cpp b/src/quicktemplates2/qquicktabbar.cpp
index 52522262..814d14ea 100644
--- a/src/quicktemplates2/qquicktabbar.cpp
+++ b/src/quicktemplates2/qquicktabbar.cpp
@@ -228,29 +228,27 @@ void QQuickTabBarPrivate::updateLayout()
contentHeightChange = true;
}
- updatingLayout = true;
if (contentWidthChange)
emit q->contentWidthChanged();
if (contentHeightChange)
emit q->contentHeightChanged();
- updatingLayout = false;
}
-void QQuickTabBarPrivate::itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &)
+void QQuickTabBarPrivate::itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF &)
{
- if (!updatingLayout && change.sizeChange() && QQuickItemPrivate::get(item)->componentComplete)
+ if (!updatingLayout)
updateLayout();
}
-void QQuickTabBarPrivate::itemImplicitWidthChanged(QQuickItem *item)
+void QQuickTabBarPrivate::itemImplicitWidthChanged(QQuickItem *)
{
- if (!updatingLayout && !hasContentWidth && QQuickItemPrivate::get(item)->componentComplete)
+ if (!updatingLayout && !hasContentWidth)
updateLayout();
}
-void QQuickTabBarPrivate::itemImplicitHeightChanged(QQuickItem *item)
+void QQuickTabBarPrivate::itemImplicitHeightChanged(QQuickItem *)
{
- if (!updatingLayout && !hasContentHeight && QQuickItemPrivate::get(item)->componentComplete)
+ if (!updatingLayout && !hasContentHeight)
updateLayout();
}
@@ -399,10 +397,7 @@ void QQuickTabBar::geometryChanged(const QRectF &newGeometry, const QRectF &oldG
{
Q_D(QQuickTabBar);
QQuickContainer::geometryChanged(newGeometry, oldGeometry);
- if (!d->updatingLayout)
- d->updateLayout();
- else
- polish();
+ d->updateLayout();
}
bool QQuickTabBar::isContent(QQuickItem *item) const
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..26799532 100644
--- a/src/quicktemplates2/qquicktextarea_p.h
+++ b/src/quicktemplates2/qquicktextarea_p.h
@@ -68,8 +68,10 @@ 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)
+ // 2.3 (Qt 5.10)
Q_PROPERTY(QPalette palette READ palette WRITE setPalette RESET resetPalette NOTIFY paletteChanged FINAL REVISION 3)
public:
@@ -90,6 +92,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 +102,7 @@ public:
void setHoverEnabled(bool enabled);
void resetHoverEnabled();
- bool contains(const QPointF &point) const override;
-
+ // 2.3 (Qt 5.10)
QPalette palette() const;
void setPalette(const QPalette &palette);
void resetPalette();
@@ -110,11 +114,13 @@ 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();
+ // 2.3 (Qt 5.10)
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..7dab0caf 100644
--- a/src/quicktemplates2/qquicktextfield_p.h
+++ b/src/quicktemplates2/qquicktextfield_p.h
@@ -67,8 +67,10 @@ 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)
+ // 2.3 (Qt 5.10)
Q_PROPERTY(QPalette palette READ palette WRITE setPalette RESET resetPalette NOTIFY paletteChanged FINAL REVISION 3)
public:
@@ -86,6 +88,7 @@ public:
Qt::FocusReason focusReason() const;
void setFocusReason(Qt::FocusReason reason);
+ // 2.1 (Qt 5.8)
bool isHovered() const;
void setHovered(bool hovered);
@@ -93,6 +96,7 @@ public:
void setHoverEnabled(bool enabled);
void resetHoverEnabled();
+ // 2.3 (Qt 5.10)
QPalette palette() const;
void setPalette(const QPalette &palette);
void resetPalette();
@@ -104,11 +108,13 @@ 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();
+ // 2.3 (Qt 5.10)
Q_REVISION(3) void paletteChanged();
protected:
diff --git a/src/quicktemplates2/qquicktoolbutton.cpp b/src/quicktemplates2/qquicktoolbutton.cpp
index 8c9e9bca..f87a58b2 100644
--- a/src/quicktemplates2/qquicktoolbutton.cpp
+++ b/src/quicktemplates2/qquicktoolbutton.cpp
@@ -58,9 +58,8 @@ QT_BEGIN_NAMESPACE
\snippet qtquickcontrols2-toolbar.qml 1
ToolButton inherits its API from AbstractButton. For instance, you can set
- \l {AbstractButton::text}{text}, and react to \l {AbstractButton::clicked}{clicks}
- using the AbstractButton API. In addition to displaying text, tool buttons
- can also display an \l [QML]{Button Icons}{icon}.
+ \l {AbstractButton::text}{text}, display an \l {Icons in Qt Quick Controls 2}{icon},
+ and react to \l {AbstractButton::clicked}{clicks} using the AbstractButton API.
\sa ToolBar, {Customizing ToolButton}, {Button Controls}
*/
diff --git a/src/quicktemplates2/qquicktooltip.cpp b/src/quicktemplates2/qquicktooltip.cpp
index 48edb32e..1bf6ca55 100644
--- a/src/quicktemplates2/qquicktooltip.cpp
+++ b/src/quicktemplates2/qquicktooltip.cpp
@@ -36,6 +36,7 @@
#include "qquicktooltip_p.h"
#include "qquickpopup_p_p.h"
+#include "qquickpopupitem_p_p.h"
#include "qquickcontrol_p_p.h"
#include <QtCore/qbasictimer.h>
@@ -172,6 +173,7 @@ QQuickToolTip::QQuickToolTip(QQuickItem *parent)
Q_D(QQuickToolTip);
d->allowVerticalFlip = true;
d->allowHorizontalFlip = true;
+ d->popupItem->setHoverEnabled(false); // QTBUG-63644
}
/*!
diff --git a/src/quicktemplates2/qquicktumbler.cpp b/src/quicktemplates2/qquicktumbler.cpp
index 547380e6..bed3e400 100644
--- a/src/quicktemplates2/qquicktumbler.cpp
+++ b/src/quicktemplates2/qquicktumbler.cpp
@@ -124,11 +124,13 @@ QQuickItem *QQuickTumblerPrivate::determineViewType(QQuickItem *contentItem)
view = contentItem;
viewContentItem = contentItem;
viewContentItemType = PathViewContentItem;
+ viewOffset = 0;
return contentItem;
} else if (contentItem->inherits("QQuickListView")) {
view = contentItem;
viewContentItem = qobject_cast<QQuickFlickable*>(contentItem)->contentItem();
viewContentItemType = ListViewContentItem;
+ viewContentY = 0;
return contentItem;
} else {
const auto childItems = contentItem->childItems();
@@ -147,6 +149,10 @@ void QQuickTumblerPrivate::resetViewData()
{
view = nullptr;
viewContentItem = nullptr;
+ if (viewContentItemType == PathViewContentItem)
+ viewOffset = 0;
+ else if (viewContentItemType == ListViewContentItem)
+ viewContentY = 0;
viewContentItemType = UnsupportedContentItemType;
}
@@ -229,16 +235,52 @@ void QQuickTumblerPrivate::_q_onViewCountChanged()
}
}
-void QQuickTumblerPrivate::itemChildAdded(QQuickItem *, QQuickItem *)
+void QQuickTumblerPrivate::_q_onViewOffsetChanged()
+{
+ viewOffset = view->property("offset").toReal();
+ calculateDisplacements();
+}
+
+void QQuickTumblerPrivate::_q_onViewContentYChanged()
+{
+ viewContentY = view->property("contentY").toReal();
+ calculateDisplacements();
+}
+
+void QQuickTumblerPrivate::calculateDisplacements()
+{
+ const auto items = viewContentItemChildItems();
+ for (QQuickItem *childItem : items) {
+ QQuickTumblerAttached *attached = qobject_cast<QQuickTumblerAttached *>(qmlAttachedPropertiesObject<QQuickTumbler>(childItem, false));
+ if (attached)
+ QQuickTumblerAttachedPrivate::get(attached)->calculateDisplacement();
+ }
+}
+
+void QQuickTumblerPrivate::itemChildAdded(QQuickItem *, QQuickItem *child)
{
_q_updateItemWidths();
_q_updateItemHeights();
+
+ QQuickTumblerAttached *attached = qobject_cast<QQuickTumblerAttached *>(qmlAttachedPropertiesObject<QQuickTumbler>(child, false));
+ if (attached)
+ QQuickTumblerAttachedPrivate::get(attached)->calculateDisplacement();
}
-void QQuickTumblerPrivate::itemChildRemoved(QQuickItem *, QQuickItem *)
+void QQuickTumblerPrivate::itemChildRemoved(QQuickItem *, QQuickItem *child)
{
_q_updateItemWidths();
_q_updateItemHeights();
+
+ QQuickTumblerAttached *attached = qobject_cast<QQuickTumblerAttached *>(qmlAttachedPropertiesObject<QQuickTumbler>(child, false));
+ if (attached)
+ QQuickTumblerAttachedPrivate::get(attached)->calculateDisplacement();
+}
+
+void QQuickTumblerPrivate::itemGeometryChanged(QQuickItem *, QQuickGeometryChange change, const QRectF &)
+{
+ if (change.sizeChange())
+ calculateDisplacements();
}
QQuickTumbler::QQuickTumbler(QQuickItem *parent)
@@ -419,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)
@@ -464,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);
@@ -532,8 +574,13 @@ void QQuickTumblerPrivate::disconnectFromView()
QObject::disconnect(view, SIGNAL(countChanged()), q, SLOT(_q_onViewCountChanged()));
QObject::disconnect(view, SIGNAL(movingChanged()), q, SIGNAL(movingChanged()));
+ if (viewContentItemType == PathViewContentItem)
+ QObject::disconnect(view, SIGNAL(offsetChanged()), q, SLOT(_q_onViewOffsetChanged()));
+ else
+ QObject::disconnect(view, SIGNAL(contentYChanged()), q, SLOT(_q_onViewContentYChanged()));
+
QQuickItemPrivate *oldViewContentItemPrivate = QQuickItemPrivate::get(viewContentItem);
- oldViewContentItemPrivate->removeItemChangeListener(this, QQuickItemPrivate::Children);
+ oldViewContentItemPrivate->removeItemChangeListener(this, QQuickItemPrivate::Children | QQuickItemPrivate::Geometry);
resetViewData();
}
@@ -557,8 +604,16 @@ void QQuickTumblerPrivate::setupViewData(QQuickItem *newControlContentItem)
QObject::connect(view, SIGNAL(countChanged()), q, SLOT(_q_onViewCountChanged()));
QObject::connect(view, SIGNAL(movingChanged()), q, SIGNAL(movingChanged()));
+ if (viewContentItemType == PathViewContentItem) {
+ QObject::connect(view, SIGNAL(offsetChanged()), q, SLOT(_q_onViewOffsetChanged()));
+ _q_onViewOffsetChanged();
+ } else {
+ QObject::connect(view, SIGNAL(contentYChanged()), q, SLOT(_q_onViewContentYChanged()));
+ _q_onViewContentYChanged();
+ }
+
QQuickItemPrivate *viewContentItemPrivate = QQuickItemPrivate::get(viewContentItem);
- viewContentItemPrivate->addItemChangeListener(this, QQuickItemPrivate::Children);
+ viewContentItemPrivate->addItemChangeListener(this, QQuickItemPrivate::Children | QQuickItemPrivate::Geometry);
// Sync the view's currentIndex with ours.
syncCurrentIndex();
@@ -700,81 +755,36 @@ QPalette QQuickTumbler::defaultPalette() const
return QQuickControlPrivate::themePalette(QPlatformTheme::ItemViewPalette);
}
-class QQuickTumblerAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener
-{
- Q_DECLARE_PUBLIC(QQuickTumblerAttached)
-public:
- QQuickTumblerAttachedPrivate()
- : tumbler(nullptr),
- index(-1),
- displacement(0)
- {
- }
-
- void init(QQuickItem *delegateItem)
- {
- if (!delegateItem->parentItem()) {
- qWarning() << "Tumbler: attached properties must be accessed through a delegate item that has a parent";
- return;
- }
-
- QVariant indexContextProperty = qmlContext(delegateItem)->contextProperty(QStringLiteral("index"));
- if (!indexContextProperty.isValid()) {
- qWarning() << "Tumbler: attempting to access attached property on item without an \"index\" property";
- return;
- }
-
- index = indexContextProperty.toInt();
-
- QQuickItem *parentItem = delegateItem;
- while ((parentItem = parentItem->parentItem())) {
- if ((tumbler = qobject_cast<QQuickTumbler*>(parentItem)))
- break;
- }
- }
-
- void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override;
- void itemChildAdded(QQuickItem *, QQuickItem *) override;
- void itemChildRemoved(QQuickItem *, QQuickItem *) override;
-
- void _q_calculateDisplacement();
- void emitIfDisplacementChanged(qreal oldDisplacement, qreal newDisplacement);
-
- // The Tumbler that contains the delegate. Required to calculated the displacement.
- QPointer<QQuickTumbler> tumbler;
- // The index of the delegate. Used to calculate the displacement.
- int index;
- // The displacement for our delegate.
- qreal displacement;
-};
-
-void QQuickTumblerAttachedPrivate::itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF &)
+QQuickTumblerAttachedPrivate::QQuickTumblerAttachedPrivate()
+ : tumbler(nullptr),
+ index(-1),
+ displacement(0)
{
- _q_calculateDisplacement();
}
-void QQuickTumblerAttachedPrivate::itemChildAdded(QQuickItem *, QQuickItem *)
+void QQuickTumblerAttachedPrivate::init(QQuickItem *delegateItem)
{
- _q_calculateDisplacement();
-}
+ if (!delegateItem->parentItem()) {
+ qWarning() << "Tumbler: attached properties must be accessed through a delegate item that has a parent";
+ return;
+ }
-void QQuickTumblerAttachedPrivate::itemChildRemoved(QQuickItem *item, QQuickItem *child)
-{
- _q_calculateDisplacement();
+ QVariant indexContextProperty = qmlContext(delegateItem)->contextProperty(QStringLiteral("index"));
+ if (!indexContextProperty.isValid()) {
+ qWarning() << "Tumbler: attempting to access attached property on item without an \"index\" property";
+ return;
+ }
- if (parent == child) {
- // The child that was removed from the contentItem was the delegate
- // that our properties are attached to. If we don't remove the change
- // listener, the contentItem will attempt to notify a destroyed
- // listener, causing a crash.
+ index = indexContextProperty.toInt();
- // item is the "actual content item" of Tumbler's contentItem, i.e. a PathView or ListView.contentItem
- QQuickItemPrivate *p = QQuickItemPrivate::get(item);
- p->removeItemChangeListener(this, QQuickItemPrivate::Geometry | QQuickItemPrivate::Children);
+ QQuickItem *parentItem = delegateItem;
+ while ((parentItem = parentItem->parentItem())) {
+ if ((tumbler = qobject_cast<QQuickTumbler*>(parentItem)))
+ break;
}
}
-void QQuickTumblerAttachedPrivate::_q_calculateDisplacement()
+void QQuickTumblerAttachedPrivate::calculateDisplacement()
{
const int previousDisplacement = displacement;
displacement = 0;
@@ -802,7 +812,7 @@ void QQuickTumblerAttachedPrivate::_q_calculateDisplacement()
}
if (tumblerPrivate->viewContentItemType == QQuickTumblerPrivate::PathViewContentItem) {
- const qreal offset = tumblerPrivate->view->property("offset").toReal();
+ const qreal offset = tumblerPrivate->viewOffset;
displacement = count > 1 ? count - index - offset : 0;
// Don't add 1 if count <= visibleItemCount
@@ -813,7 +823,7 @@ void QQuickTumblerAttachedPrivate::_q_calculateDisplacement()
else if (displacement < -halfVisibleItems)
displacement += count;
} else {
- const qreal contentY = tumblerPrivate->view->property("contentY").toReal();
+ const qreal contentY = tumblerPrivate->viewContentY;
const qreal delegateH = delegateHeight(tumbler);
const qreal preferredHighlightBegin = tumblerPrivate->view->property("preferredHighlightBegin").toReal();
// Tumbler's displacement goes from negative at the top to positive towards the bottom, so we must switch this around.
@@ -853,31 +863,10 @@ QQuickTumblerAttached::QQuickTumblerAttached(QObject *parent)
if (!tumblerPrivate->viewContentItem)
return;
- QQuickItemPrivate *p = QQuickItemPrivate::get(tumblerPrivate->viewContentItem);
- p->addItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Children);
-
- const char *contentItemSignal = tumblerPrivate->viewContentItemType == QQuickTumblerPrivate::PathViewContentItem
- ? SIGNAL(offsetChanged()) : SIGNAL(contentYChanged());
- connect(tumblerPrivate->view, contentItemSignal, this, SLOT(_q_calculateDisplacement()));
-
- d->_q_calculateDisplacement();
+ d->calculateDisplacement();
}
}
-QQuickTumblerAttached::~QQuickTumblerAttached()
-{
- Q_D(QQuickTumblerAttached);
- if (!d->tumbler)
- return;
-
- QQuickTumblerPrivate *tumblerPrivate = QQuickTumblerPrivate::get(d->tumbler);
- if (!tumblerPrivate->viewContentItem)
- return;
-
- QQuickItemPrivate *viewContentItemPrivate = QQuickItemPrivate::get(tumblerPrivate->viewContentItem);
- viewContentItemPrivate->removeItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Children);
-}
-
/*!
\qmlattachedproperty Tumbler QtQuick.Controls::Tumbler::tumbler
\readonly
diff --git a/src/quicktemplates2/qquicktumbler_p.h b/src/quicktemplates2/qquicktumbler_p.h
index 71d1bda2..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:
@@ -124,6 +130,8 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_updateItemHeights())
Q_PRIVATE_SLOT(d_func(), void _q_onViewCurrentIndexChanged())
Q_PRIVATE_SLOT(d_func(), void _q_onViewCountChanged())
+ Q_PRIVATE_SLOT(d_func(), void _q_onViewOffsetChanged())
+ Q_PRIVATE_SLOT(d_func(), void _q_onViewContentYChanged())
};
class QQuickTumblerAttachedPrivate;
@@ -136,7 +144,6 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTumblerAttached : public QObject
public:
explicit QQuickTumblerAttached(QObject *parent = nullptr);
- ~QQuickTumblerAttached();
QQuickTumbler *tumbler() const;
qreal displacement() const;
@@ -147,8 +154,6 @@ Q_SIGNALS:
private:
Q_DISABLE_COPY(QQuickTumblerAttached)
Q_DECLARE_PRIVATE(QQuickTumblerAttached)
-
- Q_PRIVATE_SLOT(d_func(), void _q_calculateDisplacement())
};
QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquicktumbler_p_p.h b/src/quicktemplates2/qquicktumbler_p_p.h
index 0dcae762..fe8a4ad2 100644
--- a/src/quicktemplates2/qquicktumbler_p_p.h
+++ b/src/quicktemplates2/qquicktumbler_p_p.h
@@ -50,11 +50,10 @@
#include <QtQuick/private/qquickitemchangelistener_p.h>
#include <QtQuickTemplates2/private/qquickcontrol_p_p.h>
+#include <QtQuickTemplates2/private/qquicktumbler_p.h>
QT_BEGIN_NAMESPACE
-class QQuickTumbler;
-
class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTumblerPrivate : public QQuickControlPrivate, public QQuickItemChangeListener
{
Q_DECLARE_PUBLIC(QQuickTumbler)
@@ -84,6 +83,10 @@ public:
QQuickItem *view;
QQuickItem *viewContentItem;
ContentItemType viewContentItemType;
+ union {
+ qreal viewOffset; // PathView
+ qreal viewContentY; // ListView
+ };
int currentIndex;
int pendingCurrentIndex;
bool ignoreCurrentIndexChanges;
@@ -94,6 +97,10 @@ public:
void _q_updateItemWidths();
void _q_onViewCurrentIndexChanged();
void _q_onViewCountChanged();
+ void _q_onViewOffsetChanged();
+ void _q_onViewContentYChanged();
+
+ void calculateDisplacements();
void disconnectFromView();
void setupViewData(QQuickItem *newControlContentItem);
@@ -107,6 +114,32 @@ public:
void itemChildAdded(QQuickItem *, QQuickItem *) override;
void itemChildRemoved(QQuickItem *, QQuickItem *) override;
+ void itemGeometryChanged(QQuickItem *, QQuickGeometryChange , const QRectF &) override;
+};
+
+class QQuickTumblerAttachedPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickTumblerAttached)
+
+public:
+ QQuickTumblerAttachedPrivate();
+
+ static QQuickTumblerAttachedPrivate *get(QQuickTumblerAttached *attached)
+ {
+ return attached->d_func();
+ }
+
+ void init(QQuickItem *delegateItem);
+
+ void calculateDisplacement();
+ void emitIfDisplacementChanged(qreal oldDisplacement, qreal newDisplacement);
+
+ // The Tumbler that contains the delegate. Required to calculated the displacement.
+ QPointer<QQuickTumbler> tumbler;
+ // The index of the delegate. Used to calculate the displacement.
+ int index;
+ // The displacement for our delegate.
+ qreal displacement;
};
QT_END_NAMESPACE