aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-05-04 03:04:57 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-05-04 03:04:57 +0200
commit324ec97aa256549c56d506fd96c1e06c35fed1ae (patch)
treea3cdf92830cf8cd7e80b6de4eeda8cd847540919 /src
parent8301071b25f50a119822519f08af9595b95430fc (diff)
parent0525d640cd11ddced2ec418be182c585204fc45f (diff)
Merge remote-tracking branch 'origin/5.12' into 5.13
Diffstat (limited to 'src')
-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 328797b8..78ec7ef8 100644
--- a/src/quicktemplates2/qquickcombobox.cpp
+++ b/src/quicktemplates2/qquickcombobox.cpp
@@ -168,7 +168,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
@@ -923,7 +923,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
{
@@ -1266,7 +1266,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 f91d15a5..aa44e845 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;
}