aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-05-11 03:04:15 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-05-11 03:04:15 +0200
commitda150dacec8a2a68d290141b1e0ab268ce648edb (patch)
tree7828854015bfd71d13dc737296d949974b7d94c3 /src/quicktemplates2
parent73fa64256eaad072cc64569e9a38a59d287a414a (diff)
parent324ec97aa256549c56d506fd96c1e06c35fed1ae (diff)
Merge remote-tracking branch 'origin/5.13' into dev
Diffstat (limited to 'src/quicktemplates2')
-rw-r--r--src/quicktemplates2/qquickcombobox.cpp6
-rw-r--r--src/quicktemplates2/qquickcontrol.cpp5
-rw-r--r--src/quicktemplates2/qquickmenu.cpp24
3 files changed, 26 insertions, 9 deletions
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp
index 00ffe3ab..7bcb60fb 100644
--- a/src/quicktemplates2/qquickcombobox.cpp
+++ b/src/quicktemplates2/qquickcombobox.cpp
@@ -164,7 +164,7 @@ QT_BEGIN_NAMESPACE
This signal is emitted when the \uicontrol Return or \uicontrol Enter key is pressed
on an \l editable combo box. If the confirmed string is not currently in the model,
- the \l currentIndex will be set to \c -1 and the \c currentText will be updated
+ the \l currentIndex will be set to \c -1 and the \l currentText will be updated
accordingly.
\note If there is a \l validator set on the combo box, the signal will only be
@@ -935,7 +935,7 @@ void QQuickComboBox::setCurrentIndex(int index)
This property holds the text of the current item in the combo box.
- \sa currentIndex, displayText, textRole
+ \sa currentIndex, displayText, textRole, editText
*/
QString QQuickComboBox::currentText() const
{
@@ -1307,7 +1307,7 @@ void QQuickComboBox::setEditable(bool editable)
This property holds the text in the text field of an editable combo box.
- \sa editable
+ \sa editable, currentText, displayText
*/
QString QQuickComboBox::editText() const
{
diff --git a/src/quicktemplates2/qquickcontrol.cpp b/src/quicktemplates2/qquickcontrol.cpp
index a61df3ca..dd954b2b 100644
--- a/src/quicktemplates2/qquickcontrol.cpp
+++ b/src/quicktemplates2/qquickcontrol.cpp
@@ -1626,8 +1626,9 @@ void QQuickControl::setBackground(QQuickItem *background)
}
\endcode
- \note The content item is automatically resized to fit within the
- \l padding of the control.
+ \note The content item is automatically positioned and resized to fit
+ within the \l padding of the control. Bindings to the \l x, \l y, \l width,
+ and \l height properties of the contentItem are not respected.
\note Most controls use the implicit size of the content item to calculate
the implicit size of the control itself. If you replace the content item
diff --git a/src/quicktemplates2/qquickmenu.cpp b/src/quicktemplates2/qquickmenu.cpp
index cf50149b..96d6f269 100644
--- a/src/quicktemplates2/qquickmenu.cpp
+++ b/src/quicktemplates2/qquickmenu.cpp
@@ -213,6 +213,7 @@ void QQuickMenuPrivate::insertItem(int index, QQuickItem *item)
if (complete)
resizeItem(item);
QQuickItemPrivate::get(item)->addItemChangeListener(this, QQuickItemPrivate::Destroyed | QQuickItemPrivate::Parent);
+ QQuickItemPrivate::get(item)->updateOrAddGeometryChangeListener(this, QQuickGeometryChange::Width);
contentModel->insert(index, item);
QQuickMenuItem *menuItem = qobject_cast<QQuickMenuItem *>(item);
@@ -237,6 +238,7 @@ void QQuickMenuPrivate::removeItem(int index, QQuickItem *item)
contentData.removeOne(item);
QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::Destroyed | QQuickItemPrivate::Parent);
+ QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::Geometry);
item->setParentItem(nullptr);
contentModel->remove(index);
@@ -358,10 +360,20 @@ void QQuickMenuPrivate::itemDestroyed(QQuickItem *item)
removeItem(index, item);
}
-void QQuickMenuPrivate::itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF &)
+void QQuickMenuPrivate::itemGeometryChanged(QQuickItem *item, QQuickGeometryChange, const QRectF &)
{
- if (complete)
+ if (!complete)
+ return;
+
+ if (item == contentItem) {
+ // The contentItem's geometry changed, so resize any items
+ // that don't have explicit widths set so that they fill the width of the menu.
resizeItems();
+ } else {
+ // The geometry of an item in the menu changed. If the item
+ // doesn't have an explicit width set, make it fill the width of the menu.
+ resizeItem(item);
+ }
}
QQuickPopupPositioner *QQuickMenuPrivate::getPositioner()
@@ -1382,10 +1394,14 @@ void QQuickMenu::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
Q_D(QQuickMenu);
QQuickPopup::contentItemChange(newItem, oldItem);
- if (oldItem)
+ if (oldItem) {
QQuickItemPrivate::get(oldItem)->removeItemChangeListener(d, QQuickItemPrivate::Children);
- if (newItem)
+ QQuickItemPrivate::get(oldItem)->removeItemChangeListener(d, QQuickItemPrivate::Geometry);
+ }
+ if (newItem) {
QQuickItemPrivate::get(newItem)->addItemChangeListener(d, QQuickItemPrivate::Children);
+ QQuickItemPrivate::get(newItem)->updateOrAddGeometryChangeListener(d, QQuickGeometryChange::Width);
+ }
d->contentItem = newItem;
}