on xenial help sign in
LVWPH: Remove processEvents() call from updatePolish()
94098feAlbert Astals
plugins/DashViews/listviewwithpageheader.cpp+1−6
@@ -1097,7 +1097,7 @@ void ListViewWithPageHeader::itemGeometryChanged(QQuickItem * /*item*/, const QR
1097{
1097{
1098 const qreal heightDiff = newGeometry.height() - oldGeometry.height();
1098 const qreal heightDiff = newGeometry.height() - oldGeometry.height();
1099 if (heightDiff != 0) {
1099 if (heightDiff != 0) {
1100− if (oldGeometry.y() + oldGeometry.height() + m_clipItem->y() <= contentY() && !m_visibleItems.isEmpty()) {
1100+ if (!m_inContentHeightKeepHeaderShown && oldGeometry.y() + oldGeometry.height() + m_clipItem->y() <= contentY() && !m_visibleItems.isEmpty()) {
1101 ListItem *firstItem = m_visibleItems.first();
1101 ListItem *firstItem = m_visibleItems.first();
1102 firstItem->setY(firstItem->y() - heightDiff);
1102 firstItem->setY(firstItem->y() - heightDiff);
1103 adjustMinYExtent();
1103 adjustMinYExtent();
@@ -1293,11 +1293,6 @@ void ListViewWithPageHeader::updatePolish()
1293 refill();
1293 refill();
1294
1294
1295 if (m_contentHeightDirty) {
1295 if (m_contentHeightDirty) {
1296− // We need to make sure all bindings have updated otherwise
1297− // we may end up with bindings updating when we call setContentHeight
1298− // and then everything gets out of sync, i.e. testHeaderPositionBug1240118
1299− QCoreApplication::instance()->processEvents();
1300−
1301 qreal contentHeight;
1296 qreal contentHeight;
1302 if (m_visibleItems.isEmpty()) {
1297 if (m_visibleItems.isEmpty()) {
1303 contentHeight = m_headerItem ? m_headerItem->height() : 0;
1298 contentHeight = m_headerItem ? m_headerItem->height() : 0;
tests/plugins/DashViews/listviewwithpageheadertest.cpp−1
@@ -1855,7 +1855,6 @@ private Q_SLOTS:
1855 scrollToBottom();
1855 scrollToBottom();
1856 lvwph->showHeader();
1856 lvwph->showHeader();
1857 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1857 QTRY_VERIFY(!lvwph->m_contentYAnimation->isRunning());
1858− QTest::qWait(100); // Make sure stuff is stable
1859 QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 0), Q_ARG(QVariant, 100));
1858 QMetaObject::invokeMethod(model, "insertItem", Q_ARG(QVariant, 0), Q_ARG(QVariant, 100));
1860 model->setProperty(3, "size", 10);
1859 model->setProperty(3, "size", 10);
1861 model->setProperty(4, "size", 10);
1860 model->setProperty(4, "size", 10);
tests/plugins/DashViews/listviewwithpageheadertestsection.cpp+3−3
@@ -1680,12 +1680,11 @@ private Q_SLOTS:
1680 verifyItem(18, 700, 50., false, QString(), true);
1680 verifyItem(18, 700, 50., false, QString(), true);
1681 verifyItem(19, 750, 50., false, QString(), true);
1681 verifyItem(19, 750, 50., false, QString(), true);
1682 verifyItem(20, 800, 50., false, QString(), true);
1682 verifyItem(20, 800, 50., false, QString(), true);
1683+ QCOMPARE(lvwph->m_clipItem->y(), lvwph->contentY());
1683− QCOMPARE(lvwph->m_minYExtent, 5 * 1510./21. + 660 - 1970 + 50);
1684+ QCOMPARE(lvwph->m_minYExtent, 5 * 1510./21. + 660 - lvwph->contentY() + 50);
1684− QCOMPARE(lvwph->m_clipItem->y(), 1970.);
1685 QCOMPARE(lvwph->m_clipItem->clip(), false);
1685 QCOMPARE(lvwph->m_clipItem->clip(), false);
1686 QCOMPARE(lvwph->m_headerItem->y(), 0.);
1686 QCOMPARE(lvwph->m_headerItem->y(), 0.);
1687 QCOMPARE(lvwph->m_headerItem->height(), 50.);
1687 QCOMPARE(lvwph->m_headerItem->height(), 50.);
1688− QCOMPARE(lvwph->contentY(), 1970.);
1689 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1688 QCOMPARE(lvwph->m_headerItemShownHeight, 0.);
1690 }
1689 }
1691
1690
@@ -2108,6 +2107,7 @@ private Q_SLOTS:
2108 QVERIFY(QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
2107 QVERIFY(QQuickItemPrivate::get(lvwph->m_topSectionItem)->culled);
2109
2108
2110 QTest::qWait(1);
2109 QTest::qWait(1);
2110+ QCoreApplication::instance()->processEvents();
2111
2111
2112 changeContentY(-15);
2112 changeContentY(-15);
2113
2113