qt5-quickcontrols2 ,svg,wayland,translations rebuild
This commit is contained in:
@@ -75,6 +75,66 @@ index f38c2b09c..6eed2a024 100644
|
||||
return;
|
||||
|
||||
contentHeight = implicitContentHeight;
|
||||
diff --git a/src/quicktemplates2/qquickcontrol.cpp b/src/quicktemplates2/qquickcontrol.cpp
|
||||
index bbbd0e622..1f4b47343 100644
|
||||
--- a/src/quicktemplates2/qquickcontrol.cpp
|
||||
+++ b/src/quicktemplates2/qquickcontrol.cpp
|
||||
@@ -845,6 +845,13 @@ void QQuickControlPrivate::executeBackground(bool complete)
|
||||
quickCompleteDeferred(q, backgroundName(), background);
|
||||
}
|
||||
|
||||
+/*
|
||||
+ \internal
|
||||
+
|
||||
+ Hides an item that was replaced by a newer one, rather than
|
||||
+ deleting it, as the item is typically created in QML and hence
|
||||
+ we don't own it.
|
||||
+*/
|
||||
void QQuickControlPrivate::hideOldItem(QQuickItem *item)
|
||||
{
|
||||
if (!item)
|
||||
@@ -863,6 +870,29 @@ void QQuickControlPrivate::hideOldItem(QQuickItem *item)
|
||||
#endif
|
||||
}
|
||||
|
||||
+/*
|
||||
+ \internal
|
||||
+
|
||||
+ Named "unhide" because it's used for cases where an item
|
||||
+ that was previously hidden by \l hideOldItem() wants to be
|
||||
+ shown by a control again, such as a ScrollBar in ScrollView.
|
||||
+*/
|
||||
+void QQuickControlPrivate::unhideOldItem(QQuickControl *control, QQuickItem *item)
|
||||
+{
|
||||
+ Q_ASSERT(item);
|
||||
+ qCDebug(lcItemManagement) << "unhiding old item" << item;
|
||||
+
|
||||
+ item->setVisible(true);
|
||||
+ item->setParentItem(control);
|
||||
+
|
||||
+#if QT_CONFIG(accessibility)
|
||||
+ // Add the item back in to the accessibility tree.
|
||||
+ QQuickAccessibleAttached *accessible = accessibleAttached(item);
|
||||
+ if (accessible)
|
||||
+ accessible->setIgnored(false);
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
void QQuickControlPrivate::updateBaselineOffset()
|
||||
{
|
||||
Q_Q(QQuickControl);
|
||||
diff --git a/src/quicktemplates2/qquickcontrol_p_p.h b/src/quicktemplates2/qquickcontrol_p_p.h
|
||||
index 8e979079e..a6e624c91 100644
|
||||
--- a/src/quicktemplates2/qquickcontrol_p_p.h
|
||||
+++ b/src/quicktemplates2/qquickcontrol_p_p.h
|
||||
@@ -173,6 +173,7 @@ public:
|
||||
virtual void executeBackground(bool complete = false);
|
||||
|
||||
static void hideOldItem(QQuickItem *item);
|
||||
+ static void unhideOldItem(QQuickControl *control, QQuickItem *item);
|
||||
|
||||
void updateBaselineOffset();
|
||||
|
||||
diff --git a/src/quicktemplates2/qquickdialogbuttonbox.cpp b/src/quicktemplates2/qquickdialogbuttonbox.cpp
|
||||
index e6db14eb5..6197d1547 100644
|
||||
--- a/src/quicktemplates2/qquickdialogbuttonbox.cpp
|
||||
@@ -522,6 +582,35 @@ index 65b33b21e..a12e43e0a 100644
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
diff --git a/src/quicktemplates2/qquickscrollbar.cpp b/src/quicktemplates2/qquickscrollbar.cpp
|
||||
index 4e2f509db..1c4b308cd 100644
|
||||
--- a/src/quicktemplates2/qquickscrollbar.cpp
|
||||
+++ b/src/quicktemplates2/qquickscrollbar.cpp
|
||||
@@ -797,6 +797,14 @@ void QQuickScrollBarAttachedPrivate::initHorizontal()
|
||||
if (parent && parent == flickable->parentItem())
|
||||
horizontal->stackAfter(flickable);
|
||||
|
||||
+ // If a scroll bar was previously hidden (due to e.g. setting a new contentItem
|
||||
+ // on a ScrollView), we need to make sure that we un-hide it.
|
||||
+ // We don't bother checking if the item is actually the old one, because
|
||||
+ // if it's not, all of the things the function does (setting parent, visibility, etc.)
|
||||
+ // should be no-ops anyway.
|
||||
+ if (auto control = qobject_cast<QQuickControl*>(q_ptr->parent()))
|
||||
+ QQuickControlPrivate::unhideOldItem(control, horizontal);
|
||||
+
|
||||
layoutHorizontal();
|
||||
horizontal->setSize(area->property("widthRatio").toReal());
|
||||
horizontal->setPosition(area->property("xPosition").toReal());
|
||||
@@ -818,6 +826,9 @@ void QQuickScrollBarAttachedPrivate::initVertical()
|
||||
if (parent && parent == flickable->parentItem())
|
||||
vertical->stackAfter(flickable);
|
||||
|
||||
+ if (auto control = qobject_cast<QQuickControl*>(q_ptr->parent()))
|
||||
+ QQuickControlPrivate::unhideOldItem(control, vertical);
|
||||
+
|
||||
layoutVertical();
|
||||
vertical->setSize(area->property("heightRatio").toReal());
|
||||
vertical->setPosition(area->property("yPosition").toReal());
|
||||
diff --git a/src/quicktemplates2/quicktemplates2.pri b/src/quicktemplates2/quicktemplates2.pri
|
||||
index ba09591bf..fa6929f92 100644
|
||||
--- a/src/quicktemplates2/quicktemplates2.pri
|
||||
@@ -534,6 +623,62 @@ index ba09591bf..fa6929f92 100644
|
||||
$$PWD/qquickpopupitem_p_p.h \
|
||||
$$PWD/qquickpopuppositioner_p_p.h \
|
||||
$$PWD/qquickpresshandler_p_p.h \
|
||||
diff --git a/tests/auto/controls/data/tst_scrollview.qml b/tests/auto/controls/data/tst_scrollview.qml
|
||||
index 0e8b08352..cd4931184 100644
|
||||
--- a/tests/auto/controls/data/tst_scrollview.qml
|
||||
+++ b/tests/auto/controls/data/tst_scrollview.qml
|
||||
@@ -576,4 +576,51 @@ TestCase {
|
||||
verify(newHorizontalScrollBar.visible)
|
||||
verify(!oldHorizontalScrollBar.visible)
|
||||
}
|
||||
+
|
||||
+ Component {
|
||||
+ id: bindingToContentItemAndStandaloneFlickable
|
||||
+
|
||||
+ Item {
|
||||
+ width: 200
|
||||
+ height: 200
|
||||
+
|
||||
+ property alias scrollView: scrollView
|
||||
+
|
||||
+ ScrollView {
|
||||
+ id: scrollView
|
||||
+ anchors.fill: parent
|
||||
+ contentItem: listView
|
||||
+
|
||||
+ property Item someBinding: contentItem
|
||||
+ }
|
||||
+ ListView {
|
||||
+ id: listView
|
||||
+ model: 10
|
||||
+ delegate: ItemDelegate {
|
||||
+ text: modelData
|
||||
+ width: listView.width
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Tests that scroll bars show up for a ScrollView where
|
||||
+ // - its contentItem is declared as a standalone, separate item
|
||||
+ // - there is a binding to contentItem (which causes a default Flickable to be created)
|
||||
+ function test_bindingToContentItemAndStandaloneFlickable() {
|
||||
+ let root = createTemporaryObject(bindingToContentItemAndStandaloneFlickable, testCase)
|
||||
+ verify(root)
|
||||
+
|
||||
+ let control = root.scrollView
|
||||
+ let verticalScrollBar = control.ScrollBar.vertical
|
||||
+ let horizontalScrollBar = control.ScrollBar.horizontal
|
||||
+ compare(verticalScrollBar.parent, control)
|
||||
+ compare(horizontalScrollBar.parent, control)
|
||||
+ verify(verticalScrollBar.visible)
|
||||
+ verify(horizontalScrollBar.visible)
|
||||
+
|
||||
+ mouseDrag(verticalScrollBar, verticalScrollBar.width / 2, verticalScrollBar.height / 2, 0, 50)
|
||||
+ verify(verticalScrollBar.active)
|
||||
+ verify(horizontalScrollBar.active)
|
||||
+ }
|
||||
}
|
||||
diff --git a/tests/auto/controls/data/tst_switch.qml b/tests/auto/controls/data/tst_switch.qml
|
||||
index b3fab41ca..10b6baa02 100644
|
||||
--- a/tests/auto/controls/data/tst_switch.qml
|
||||
|
||||
Reference in New Issue
Block a user