From 15ada2b91798638c90630c332e4a8caef7660638 Mon Sep 17 00:00:00 2001 From: Kari Oikarinen Date: Wed, 4 Apr 2018 12:57:51 +0300 Subject: [PATCH 01/21] tests/auto/widgets/kernel: Avoid unconditional qWait()s Task-number: QTBUG-63992 Change-Id: Icb32b516002c3bb2841c8e7a29624e54cfcbbcac Reviewed-by: Gatis Paeglis --- .../kernel/qapplication/tst_qapplication.cpp | 2 +- .../kernel/qboxlayout/tst_qboxlayout.cpp | 8 +++----- .../kernel/qformlayout/tst_qformlayout.cpp | 3 +-- .../kernel/qgridlayout/tst_qgridlayout.cpp | 1 - .../widgets/kernel/qshortcut/tst_qshortcut.cpp | 2 +- .../qstackedlayout/tst_qstackedlayout.cpp | 17 +++-------------- .../qwindowcontainer/tst_qwindowcontainer.cpp | 10 +--------- 7 files changed, 10 insertions(+), 33 deletions(-) diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index c70ac0309f..5301dababc 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -288,7 +288,6 @@ void tst_QApplication::alert() widget2.show(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); QVERIFY(QTest::qWaitForWindowExposed(&widget2)); - QTest::qWait(100); app.alert(&widget, -1); app.alert(&widget, 250); widget2.activateWindow(); @@ -1711,6 +1710,7 @@ void tst_QApplication::focusOut() le2->setStyleSheet("background: #fee"); le2->move(100, 100); w.show(); + QVERIFY(QTest::qWaitForWindowExposed(&w)); QTest::qWait(2000); le2->setFocus(); diff --git a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp index 2f1a305710..8314dbedf5 100644 --- a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp +++ b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp @@ -226,15 +226,13 @@ void tst_QBoxLayout::setStyleShouldChangeSpacing() window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - int spacing = pb2->geometry().left() - pb1->geometry().right() - 1; - QCOMPARE(spacing, 6); + auto spacing = [&]() { return pb2->geometry().left() - pb1->geometry().right() - 1; }; + QCOMPARE(spacing(), 6); QScopedPointer style2(new CustomLayoutStyle()); style2->hspacing = 10; window.setStyle(style2.data()); - QTest::qWait(100); - spacing = pb2->geometry().left() - pb1->geometry().right() - 1; - QCOMPARE(spacing, 10); + QTRY_COMPARE(spacing(), 10); } void tst_QBoxLayout::taskQTBUG_7103_minMaxWidthNotRespected() diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp index 1ccda25339..162da61584 100644 --- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp +++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp @@ -164,7 +164,7 @@ private slots: void tst_QFormLayout::cleanup() { - QVERIFY(QApplication::topLevelWidgets().isEmpty()); + QTRY_VERIFY(QApplication::topLevelWidgets().isEmpty()); } void tst_QFormLayout::rowCount() @@ -1188,7 +1188,6 @@ void tst_QFormLayout::layoutAlone() w.setWindowTitle(QTest::currentTestFunction()); w.show(); layout.activate(); - QTest::qWait(500); } void tst_QFormLayout::taskQTBUG_27420_takeAtShouldUnparentLayout() diff --git a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp index 40a2319910..5e0327319b 100644 --- a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp +++ b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp @@ -1441,7 +1441,6 @@ void tst_QGridLayout::layoutSpacing() QLayout *layout = widget->layout(); QVERIFY(layout); - //QTest::qWait(2000); for (int pi = 0; pi < expectedpositions.count(); ++pi) { QLayoutItem *item = layout->itemAt(pi); //qDebug() << item->widget()->pos(); diff --git a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp index ff35b0cdb1..b78287f84b 100644 --- a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp +++ b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp @@ -604,7 +604,7 @@ void tst_QShortcut::disabledItems() { clearAllShortcuts(); mainW->activateWindow(); - QTest::qWait(100); + QVERIFY(QTest::qWaitForWindowActive(mainW)); /* Testing Disabled Shortcuts Qt::Key_M on slot1 diff --git a/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp b/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp index 5be4846b3e..10712ea9ad 100644 --- a/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp +++ b/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp @@ -103,7 +103,7 @@ void tst_QStackedLayout::init() // make sure the tests work with focus follows mouse QCursor::setPos(testWidget->geometry().center()); testWidget->activateWindow(); - QTest::qWait(250); + QVERIFY(QTest::qWaitForWindowActive(testWidget)); } void tst_QStackedLayout::cleanup() @@ -251,24 +251,13 @@ void tst_QStackedLayout::removeWidget() testLayout->addWidget(w2); vbox->addLayout(testLayout); top->setFocus(); - QTest::qWait(100); top->activateWindow(); - QTest::qWait(100); - int i =0; - for (;;) { - if (QApplication::focusWidget() == top) - break; - else if (i >= 5) - QSKIP("Can't get focus"); - QTest::qWait(100); - ++i; - } - QCOMPARE(QApplication::focusWidget(), static_cast(top)); + QTRY_COMPARE(QApplication::focusWidget(), top); // focus should stay at the 'top' widget testLayout->removeWidget(w1); - QCOMPARE(QApplication::focusWidget(), static_cast(top)); + QCOMPARE(QApplication::focusWidget(), top); } class LineEdit : public QLineEdit diff --git a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp index a3e549aa50..c9c8e193b3 100644 --- a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp +++ b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp @@ -146,13 +146,7 @@ void tst_QWindowContainer::testExposeObscure() container->hide(); - QElapsedTimer timer; - timer.start(); - while (window->numberOfObscures == 0 && timer.elapsed() < 5000) { - QTest::qWait(10); - } - - QVERIFY(window->numberOfObscures > 0); + QTRY_VERIFY(window->numberOfObscures > 0); } @@ -345,11 +339,9 @@ void tst_QWindowContainer::testDockWidget() QVERIFY(QTest::qWaitForWindowExposed(&mainWindow)); QCOMPARE(window->parent(), mainWindow.window()->windowHandle()); - QTest::qWait(1000); dock->setFloating(true); QTRY_VERIFY(window->parent() != mainWindow.window()->windowHandle()); - QTest::qWait(1000); dock->setFloating(false); QTRY_COMPARE(window->parent(), mainWindow.window()->windowHandle()); } From 309dacedac6147e8c552b652e5fe2ffd02b6eac3 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 23 Apr 2018 19:29:04 -0700 Subject: [PATCH 02/21] Atomics: remove requirement for alignment equality with plain types This was originally added so that you could replace a T with QAtomicInteger in the same class and still keep ABI. However, for legacy reasons, on 32-bit x86, types larger than 4 bytes keep an old 1990s alignment of only 4 bytes, but modern std::atomic for those 8- byte types enforces an alignment of 8 bytes. Therefore, the requirement to keep alignment is not possible to guarantee. In other words: you may not replace T with QAtomicInteger or std::atomic and assume no ABI breakages in all platforms. This is a requirement to implement atomicity. An 8-byte type aligned to only a 4-byte boundary could cross a 16-byte boundary or, worse, cross a cacheline boundary. Crossing the 16-byte boundary could be bad on some processors, but crossing the cacheline boundary (addresses ending in 0x3C, 0x7C, 0xCC and 0xFC, or 4 out of 64 possible addresses or 6.25%) is always bad: the CPUs cannot guarantee an atomic load or store operation. See also . Task-number: QTBUG-67858 Change-Id: If90a92b041d3442fa0a4fffd15283e4615474582 Reviewed-by: Frederik Gladhorn --- tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp b/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp index ca40927ef9..32e5b8ee56 100644 --- a/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp +++ b/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp @@ -185,12 +185,10 @@ private Q_SLOTS: }; template inline void booleanHelper() { } -struct TypeInStruct { TEST_TYPE type; }; void tst_QAtomicIntegerXX::static_checks() { Q_STATIC_ASSERT(sizeof(QAtomicInteger) == sizeof(T)); - Q_STATIC_ASSERT(Q_ALIGNOF(QAtomicInteger) == Q_ALIGNOF(TypeInStruct)); // statements with no effect (void) QAtomicInteger::isReferenceCountingNative(); From 143cf9e4675ff0f1317dce915aef009886307cf8 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 20 Apr 2018 13:41:04 -0700 Subject: [PATCH 03/21] QCocoaWindow: Fix handleMouseEvent() compilation warning qtbase/src/plugins/platforms/cocoa/qcocoawindow.mm:408:53: warning: 'handleMouseEvent' is deprecated [-Wdeprecated-declarations] QWindowSystemInterface::handleMouseEvent(window(), window()->mapFromGlobal(localPoint.toPoint()), localPoint, Change-Id: Ifbf8c46e31a1de2089ce0e16cec087fdd9adb64e Reviewed-by: Erik Verbruggen --- src/plugins/platforms/cocoa/qcocoawindow.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 54254455e4..f9d16ab1c6 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -404,8 +404,10 @@ void QCocoaWindow::setVisible(bool visible) removeMonitor(); monitor = [NSEvent addGlobalMonitorForEventsMatchingMask:NSLeftMouseDownMask|NSRightMouseDownMask|NSOtherMouseDownMask|NSMouseMovedMask handler:^(NSEvent *e) { QPointF localPoint = QCocoaScreen::mapFromNative([NSEvent mouseLocation]); + const auto eventType = e.type == NSMouseMoved ? QEvent::MouseMove : QEvent::MouseButtonPress; QWindowSystemInterface::handleMouseEvent(window(), window()->mapFromGlobal(localPoint.toPoint()), localPoint, - cocoaButton2QtButton([e buttonNumber])); + Qt::MouseButtons(uint(NSEvent.pressedMouseButtons & 0xFFFF)), + cocoaButton2QtButton(e.buttonNumber), eventType); }]; } } From e413874467c01cff63bb53e630d1e5d9d19fda53 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 23 Apr 2018 15:09:35 +0200 Subject: [PATCH 04/21] Fix division by zero in radial gradiants with NEON The NEON implementation uses rsqrt and thus can not be taken on 0, so replace the minimum with something close to zero instead of zero. Task-number: QTBUG-59961 Change-Id: Ia39e45be675b056c1e22900495ce9ba4e8b70e5f Reviewed-by: Erik Verbruggen --- src/gui/painting/qdrawhelper_p.h | 5 +++++ tests/auto/gui/painting/qpainter/tst_qpainter.cpp | 4 ---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index b94fd34b51..6f3c92ca64 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -520,7 +520,12 @@ public: const typename Simd::Float32x4 v_r0 = Simd::v_dup(data->gradient.radial.focal.radius); const typename Simd::Float32x4 v_dr = Simd::v_dup(op->radial.dr); +#if defined(__ARM_NEON__) + // NEON doesn't have SIMD sqrt, but uses rsqrt instead that can't be taken of 0. + const typename Simd::Float32x4 v_min = Simd::v_dup(std::numeric_limits::epsilon()); +#else const typename Simd::Float32x4 v_min = Simd::v_dup(0.0f); +#endif const typename Simd::Float32x4 v_max = Simd::v_dup(float(GRADIENT_STOPTABLE_SIZE-1)); const typename Simd::Float32x4 v_half = Simd::v_dup(0.5f); diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index ba405e2860..181c609c6e 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -2963,10 +2963,6 @@ void fpe_steepSlopes() void fpe_radialGradients() { -#if defined(Q_PROCESSOR_ARM) - QEXPECT_FAIL("", "Test fails for ARM (QTBUG-59961)", Continue); -#endif - FpExceptionChecker checker(FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID | FE_DIVBYZERO); QImage img(21, 21, QImage::Format_ARGB32_Premultiplied); From a4e6117c53c3984585b3bbb74c00d6d863c98fcd Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 17 Dec 2015 16:29:08 -0800 Subject: [PATCH 05/21] Style sheets: detect and use font set on QHeaderViews We also ask the parent style to draw the header label instead of the base style which is more likely to respect other text related parameters. Change-Id: I6dd658fa4d016a76d7c450478dc42f07e4b807c4 Task-number: QTBUG-33855 Task-number: QTBUG-37153 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/styles/qstylesheetstyle.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index c4fc353803..cdeb6a5768 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -3837,7 +3837,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q if(hasStyleRule(w, PseudoElement_HeaderViewSection)) { QRenderRule subRule = renderRule(w, opt, PseudoElement_HeaderViewSection); if (!subRule.hasNativeBorder() || !subRule.baseStyleCanDraw() - || subRule.hasBackground() || subRule.hasPalette()) { + || subRule.hasBackground() || subRule.hasPalette() || subRule.hasFont) { ParentStyle::drawControl(ce, opt, p, w); return; } @@ -3874,12 +3874,14 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q QStyleOptionHeader hdr(*header); QRenderRule subRule = renderRule(w, opt, PseudoElement_HeaderViewSection); subRule.configurePalette(&hdr.palette, QPalette::ButtonText, QPalette::Button); - QFont oldFont = p->font(); - if (subRule.hasFont) + if (subRule.hasFont) { + QFont oldFont = p->font(); p->setFont(subRule.font.resolve(p->font())); - baseStyle()->drawControl(ce, &hdr, p, w); - if (subRule.hasFont) + ParentStyle::drawControl(ce, &hdr, p, w); p->setFont(oldFont); + } else { + baseStyle()->drawControl(ce, &hdr, p, w); + } return; } break; From c7eb2c173e79f2936985cd7589347e59b6005c7c Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 20 Apr 2018 12:22:35 -0700 Subject: [PATCH 06/21] QCocoaFontDialogHelper: Fix NSFontManager delegate warning According to Apple's documentation, there's no delegate in NSFontManager. We set its target instead. The action is changeFont: by default. Change-Id: I8c01bfa97c78dd8097f38c27353748d13f51489f Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm index 9a96895d07..815882ab06 100644 --- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm @@ -73,8 +73,6 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont) return newFont; } -@class QT_MANGLE_NAMESPACE(QNSFontPanelDelegate); - @interface QT_MANGLE_NAMESPACE(QNSFontPanelDelegate) : NSObject { @public @@ -110,7 +108,8 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); [mFontPanel setRestorable:NO]; [mFontPanel setDelegate:self]; - [[NSFontManager sharedFontManager] setDelegate:self]; + + [NSFontManager sharedFontManager].target = self; // Action is changeFont: [mFontPanel retain]; return self; @@ -120,7 +119,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); { [mStolenContentView release]; [mFontPanel setDelegate:nil]; - [[NSFontManager sharedFontManager] setDelegate:nil]; + [NSFontManager sharedFontManager].target = nil; [[NSNotificationCenter defaultCenter] removeObserver:self]; [super dealloc]; From 0f6a6b2bffb9b9d0a5db8b9473fda108d14e9915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Wed, 11 Apr 2018 12:31:11 +0200 Subject: [PATCH 07/21] =?UTF-8?q?Cocoa:=20Don=E2=80=99t=20starve=20the=20e?= =?UTF-8?q?vent=20loop=20on=20requestUpdate()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some of our examples, and perhaps also some applications, call requestUpdate() immediately after producing a frame. This can cause Cocoa to immediately start (trying to) draw a new frame without processing e.g. input events. This should (and will) be handled by rate limiting updates with CVDisplayLink. In the mean time fall back to using the base class QPlatformWindow implementation, which is implemented using a timer, which will allow for input event processing. Change-Id: Ic2541f344b2f4018d785404a06274959a7bad2df Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoawindow.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index f9d16ab1c6..965a15a548 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1336,7 +1336,7 @@ void QCocoaWindow::recreateWindowIfNeeded() void QCocoaWindow::requestUpdate() { qCDebug(lcQpaCocoaDrawing) << "QCocoaWindow::requestUpdate" << window(); - [qnsview_cast(m_view) requestUpdate]; + QPlatformWindow::requestUpdate(); } void QCocoaWindow::requestActivateWindow() From 8ac0e6592bdf0f846586cfe9f15c2c4bf80f01e7 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 12 Apr 2018 11:43:07 +0200 Subject: [PATCH 08/21] Skip flaky tst_QWindow::childWindowPositioning on Wayland Sometimes causes protocol errors (i.e. termination) on Wayland with xdg-shell v6. Task-number: QTBUG-67648 Change-Id: I6c855affb145590f47a425d233c5fd6b7e1e8914 Reviewed-by: Gatis Paeglis Reviewed-by: Pier Luigi Fiorini --- tests/auto/gui/kernel/qwindow/tst_qwindow.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index 5a87ae6067..722405377e 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -588,6 +588,9 @@ void tst_QWindow::childWindowPositioning_data() void tst_QWindow::childWindowPositioning() { + if (isPlatformWayland()) + QSKIP("Wayland: This is flaky (protocol errors for xdg-shell v6). See QTBUG-67648."); + const QPoint topLeftOrigin(0, 0); ColoredWindow topLevelWindowFirst(Qt::green); From 73031ebb998b687b0997bae7beeef37571c2b360 Mon Sep 17 00:00:00 2001 From: Kari Oikarinen Date: Thu, 5 Apr 2018 15:57:35 +0300 Subject: [PATCH 09/21] tests/auto/widgets/{effects,styles}: Avoid unconditional qWait()s Task-number: QTBUG-63992 Change-Id: I1af537bae705d4627880c5ae50669b1ef72562f2 Reviewed-by: Friedemann Kleint --- .../effects/qgraphicseffect/tst_qgraphicseffect.cpp | 3 +-- .../qstylesheetstyle/tst_qstylesheetstyle.cpp | 13 ++++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp index a1cb729849..5b142048b5 100644 --- a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp @@ -365,9 +365,8 @@ void tst_QGraphicsEffect::draw() // Make sure we update the source when disabling/enabling the effect. effect->setEnabled(false); - QTest::qWait(50); + QTRY_COMPARE(item->numRepaints, 1); QCOMPARE(effect->numRepaints, 0); - QCOMPARE(item->numRepaints, 1); effect->reset(); item->reset(); diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp index 7953077152..28a099de83 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -1136,7 +1136,7 @@ void tst_QStyleSheetStyle::minmaxSizes() centerOnScreen(&tabWidget); tabWidget.show(); - QTest::qWait(50); + QVERIFY(QTest::qWaitForWindowActive(&tabWidget)); //i allow 4px additional border from the native style (hence the -2, <=2) QVERIFY(qAbs(page2->maximumSize().width() - 500 - 2) <= 2); QVERIFY(qAbs(page2->minimumSize().width() - 250 - 2) <= 2); @@ -1165,7 +1165,7 @@ void tst_QStyleSheetStyle::task206238_twice() w.setStyleSheet("background: red;"); centerOnScreen(&w); w.show(); - QTest::qWait(20); + QVERIFY(QTest::qWaitForWindowActive(&w)); QCOMPARE(BACKGROUND(w) , red); QCOMPARE(BACKGROUND(*tw), red); w.setStyleSheet("background: red;"); @@ -1366,8 +1366,7 @@ void tst_QStyleSheetStyle::proxyStyle() layout->addWidget(pb5); w->show(); - - QTest::qWait(100); + QVERIFY(QTest::qWaitForWindowActive(w)); // Test for QTBUG-7198 - style sheet overrides custom element size QStyleOptionViewItem opt; @@ -1557,9 +1556,9 @@ void tst_QStyleSheetStyle::embeddedFonts() box.addItems(QStringList() << "First" << "Second" << "Third"); box.setStyleSheet("QComboBox { font-size: 32px; }"); box.show(); + QVERIFY(QTest::qWaitForWindowActive(&box)); embedded = box.findChild(); QVERIFY(embedded); - QTest::qWait(20); QCOMPARE(box.font().pixelSize(), 32); QCOMPARE(embedded->font().pixelSize(), 32); } @@ -1652,7 +1651,7 @@ void tst_QStyleSheetStyle::task188195_baseBackground() tree.setStyleSheet( "QTreeView:disabled { background-color:#ab1251; }" ); tree.move(QGuiApplication::primaryScreen()->availableGeometry().topLeft() + QPoint(20, 100)); tree.show(); - QTest::qWait(20); + QVERIFY(QTest::qWaitForWindowActive(&tree)); QImage image(tree.width(), tree.height(), QImage::Format_ARGB32); tree.render(&image); @@ -1673,7 +1672,7 @@ void tst_QStyleSheetStyle::task188195_baseBackground() table.setStyleSheet( "QTableView {background-color: #ff0000}" ); table.move(QGuiApplication::primaryScreen()->availableGeometry().topLeft() + QPoint(300, 100)); table.show(); - QTest::qWait(20); + QVERIFY(QTest::qWaitForWindowActive(&table)); image = QImage(table.width(), table.height(), QImage::Format_ARGB32); table.render(&image); QVERIFY(testForColors(image, Qt::red, true)); From 18db0b49c61790e5a984ca93b9023a547fca8022 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 24 Apr 2018 15:47:15 +0200 Subject: [PATCH 10/21] Don't crash on
following a A
has a new-line but no text, so be able to handle no lines. Task-number: QTBUG-60853 Change-Id: I3d4dbd529114bbe8afe760c3622b52446202ec7c Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qtextdocumentlayout.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index 9877a23fa6..2957b8d5c0 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -2494,7 +2494,7 @@ void QTextDocumentLayoutPrivate::layoutFlow(QTextFrame::Iterator it, QTextLayout QTextTableData *td = static_cast(data(lastIt.currentFrame())); QTextLayout *layout = block.layout(); - QFixed height = QFixed::fromReal(layout->lineAt(0).height()); + QFixed height = layout->lineCount() > 0 ? QFixed::fromReal(layout->lineAt(0).height()) : QFixed(); if (layoutStruct->pageBottom == origPageBottom) { layoutStruct->y -= height; @@ -2506,10 +2506,12 @@ void QTextDocumentLayoutPrivate::layoutFlow(QTextFrame::Iterator it, QTextLayout layoutBlock(block, docPos, blockFormat, layoutStruct, layoutFrom, layoutTo, previousBlockFormatPtr); } - QPointF linePos((td->position.x + td->size.width).toReal(), - (td->position.y + td->size.height - height).toReal()); + if (layout->lineCount() > 0) { + QPointF linePos((td->position.x + td->size.width).toReal(), + (td->position.y + td->size.height - height).toReal()); - layout->lineAt(0).setPosition(linePos - layout->position()); + layout->lineAt(0).setPosition(linePos - layout->position()); + } } if (blockFormat.pageBreakPolicy() & QTextFormat::PageBreak_AlwaysAfter) From f7980f4eda0ab2d7684357fd28b40bf6bbed260f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 25 Apr 2018 08:38:01 +0200 Subject: [PATCH 11/21] Windows QPA: Fix handling of VK_DECIMAL/VK_SEPARATOR Remove the hardcoded mapping from the key table for fallback keys since the keys are locale-dependent. Task-number: QTBUG-57992 Change-Id: I016ab5f7f7e8abfd30f6416d2e7597db7deecb9b Reviewed-by: Oliver Wolff --- src/plugins/platforms/windows/qwindowskeymapper.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index 2e44626112..5a8a45cbf6 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -317,9 +317,9 @@ static const uint KeyTbl[] = { // Keyboard mapping table Qt::Key_9, // 105 0x69 VK_NUMPAD9 | Numeric keypad 9 key Qt::Key_Asterisk, // 106 0x6A VK_MULTIPLY | Multiply key Qt::Key_Plus, // 107 0x6B VK_ADD | Add key - Qt::Key_Comma, // 108 0x6C VK_SEPARATOR | Separator key + Qt::Key_unknown, // 108 0x6C VK_SEPARATOR | Separator key (locale-dependent) Qt::Key_Minus, // 109 0x6D VK_SUBTRACT | Subtract key - Qt::Key_Period, // 110 0x6E VK_DECIMAL | Decimal key + Qt::Key_unknown, // 110 0x6E VK_DECIMAL | Decimal key (locale-dependent) Qt::Key_Slash, // 111 0x6F VK_DIVIDE | Divide key Qt::Key_F1, // 112 0x70 VK_F1 | F1 key Qt::Key_F2, // 113 0x71 VK_F2 | F2 key From 1b1fd81a811297414d0e7d8090fbc7a682c85313 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 25 Apr 2018 08:46:28 +0200 Subject: [PATCH 12/21] Windows QPA: Add missing calls to keyboard initialization Add calls to changeKeyboard() to the QWindowsKeyMapper constructor and the handling of WM_INPUTLANGCHANGE so that the locale is correctly initialized and changes are processed. Change-Id: Ia30d8c6434ca85165e4882240ae16f9a75dcf4ff Reviewed-by: Oliver Wolff --- src/plugins/platforms/windows/qwindowskeymapper.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index 5a8a45cbf6..35f81f0165 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -102,6 +102,7 @@ QWindowsKeyMapper::QWindowsKeyMapper() QGuiApplication *app = static_cast(QGuiApplication::instance()); QObject::connect(app, &QGuiApplication::applicationStateChanged, app, clearKeyRecorderOnApplicationInActive); + changeKeyboard(); } QWindowsKeyMapper::~QWindowsKeyMapper() @@ -810,7 +811,7 @@ bool QWindowsKeyMapper::translateKeyEvent(QWindow *widget, HWND hwnd, // Reset layout map when system keyboard layout is changed if (msg.message == WM_INPUTLANGCHANGE) { - deleteLayouts(); + changeKeyboard(); return true; } From 5155942a0d42538d1d45cd66ddf76c513cb692ab Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Fri, 13 Apr 2018 15:41:36 +0200 Subject: [PATCH 13/21] Doc: Update Gradients Example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit modify to latest syntax for connect statements Task-number: QTBUG-60635 Change-Id: Ie0f8f6bdbd5aec7379f7572e978adf65b9a96bdc Reviewed-by: Paul Wicking Reviewed-by: Topi Reiniƶ --- .../widgets/painting/gradients/gradients.cpp | 72 ++++++++++++------- 1 file changed, 45 insertions(+), 27 deletions(-) diff --git a/examples/widgets/painting/gradients/gradients.cpp b/examples/widgets/painting/gradients/gradients.cpp index 5433b28025..78c174a8bf 100644 --- a/examples/widgets/painting/gradients/gradients.cpp +++ b/examples/widgets/painting/gradients/gradients.cpp @@ -88,7 +88,8 @@ ShadeWidget::ShadeWidget(ShadeType type, QWidget *parent) setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); - connect(m_hoverPoints, SIGNAL(pointsChanged(QPolygonF)), this, SIGNAL(colorsChanged())); + connect(m_hoverPoints, &HoverPoints::pointsChanged, + this, &ShadeWidget::colorsChanged); } QPolygonF ShadeWidget::points() const @@ -191,10 +192,14 @@ GradientEditor::GradientEditor(QWidget *parent) vbox->addWidget(m_blue_shade); vbox->addWidget(m_alpha_shade); - connect(m_red_shade, SIGNAL(colorsChanged()), this, SLOT(pointsUpdated())); - connect(m_green_shade, SIGNAL(colorsChanged()), this, SLOT(pointsUpdated())); - connect(m_blue_shade, SIGNAL(colorsChanged()), this, SLOT(pointsUpdated())); - connect(m_alpha_shade, SIGNAL(colorsChanged()), this, SLOT(pointsUpdated())); + connect(m_red_shade, &ShadeWidget::colorsChanged, + this, &GradientEditor::pointsUpdated); + connect(m_green_shade, &ShadeWidget::colorsChanged, + this, &GradientEditor::pointsUpdated); + connect(m_blue_shade, &ShadeWidget::colorsChanged, + this, &GradientEditor::pointsUpdated); + connect(m_alpha_shade, &ShadeWidget::colorsChanged, + this, &GradientEditor::pointsUpdated); } inline static bool x_less_than(const QPointF &p1, const QPointF &p2) @@ -354,33 +359,46 @@ GradientWidget::GradientWidget(QWidget *parent) defaultsGroupLayout->addWidget(default3Button); editorGroupLayout->addWidget(default4Button); - connect(m_editor, SIGNAL(gradientStopsChanged(QGradientStops)), - m_renderer, SLOT(setGradientStops(QGradientStops))); + connect(m_editor, &GradientEditor::gradientStopsChanged, + m_renderer, &GradientRenderer::setGradientStops); + connect(m_linearButton, &QRadioButton::clicked, + m_renderer, &GradientRenderer::setLinearGradient); + connect(m_radialButton, &QRadioButton::clicked, + m_renderer, &GradientRenderer::setRadialGradient); + connect(m_conicalButton,&QRadioButton::clicked, + m_renderer, &GradientRenderer::setConicalGradient); - connect(m_linearButton, SIGNAL(clicked()), m_renderer, SLOT(setLinearGradient())); - connect(m_radialButton, SIGNAL(clicked()), m_renderer, SLOT(setRadialGradient())); - connect(m_conicalButton, SIGNAL(clicked()), m_renderer, SLOT(setConicalGradient())); + connect(m_padSpreadButton, &QRadioButton::clicked, + m_renderer, &GradientRenderer::setPadSpread); + connect(m_reflectSpreadButton, &QRadioButton::clicked, + m_renderer, &GradientRenderer::setReflectSpread); + connect(m_repeatSpreadButton, &QRadioButton::clicked, + m_renderer, &GradientRenderer::setRepeatSpread); - connect(m_padSpreadButton, SIGNAL(clicked()), m_renderer, SLOT(setPadSpread())); - connect(m_reflectSpreadButton, SIGNAL(clicked()), m_renderer, SLOT(setReflectSpread())); - connect(m_repeatSpreadButton, SIGNAL(clicked()), m_renderer, SLOT(setRepeatSpread())); + connect(default1Button, &QPushButton::clicked, + this, &GradientWidget::setDefault1); + connect(default2Button, &QPushButton::clicked, + this, &GradientWidget::setDefault2); + connect(default3Button, &QPushButton::clicked, + this, &GradientWidget::setDefault3); + connect(default4Button, &QPushButton::clicked, + this, &GradientWidget::setDefault4); - connect(default1Button, SIGNAL(clicked()), this, SLOT(setDefault1())); - connect(default2Button, SIGNAL(clicked()), this, SLOT(setDefault2())); - connect(default3Button, SIGNAL(clicked()), this, SLOT(setDefault3())); - connect(default4Button, SIGNAL(clicked()), this, SLOT(setDefault4())); - - connect(showSourceButton, SIGNAL(clicked()), m_renderer, SLOT(showSource())); + connect(showSourceButton, &QPushButton::clicked, + m_renderer, &GradientRenderer::showSource); #ifdef QT_OPENGL_SUPPORT - connect(enableOpenGLButton, SIGNAL(clicked(bool)), m_renderer, SLOT(enableOpenGL(bool))); + connect(enableOpenGLButton, QOverload::of(&QPushButton::clicked), + m_renderer, &ArthurFrame::enableOpenGL); #endif - connect(whatsThisButton, SIGNAL(clicked(bool)), m_renderer, SLOT(setDescriptionEnabled(bool))); - connect(whatsThisButton, SIGNAL(clicked(bool)), - m_renderer->hoverPoints(), SLOT(setDisabled(bool))); - connect(m_renderer, SIGNAL(descriptionEnabledChanged(bool)), - whatsThisButton, SLOT(setChecked(bool))); - connect(m_renderer, SIGNAL(descriptionEnabledChanged(bool)), - m_renderer->hoverPoints(), SLOT(setDisabled(bool))); + + connect(whatsThisButton, QOverload::of(&QPushButton::clicked), + m_renderer, &ArthurFrame::setDescriptionEnabled); + connect(whatsThisButton, QOverload::of(&QPushButton::clicked), + m_renderer->hoverPoints(), &HoverPoints::setDisabled); + connect(m_renderer, QOverload::of(&ArthurFrame::descriptionEnabledChanged), + whatsThisButton, &QPushButton::setChecked); + connect(m_renderer, QOverload::of(&ArthurFrame::descriptionEnabledChanged), + m_renderer->hoverPoints(), &HoverPoints::setDisabled); m_renderer->loadSourceFile(":res/gradients/gradients.cpp"); m_renderer->loadDescription(":res/gradients/gradients.html"); From b1bbce26098012f10d18362d53fdf7ced7dbbf8c Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Mon, 16 Apr 2018 15:09:41 +0200 Subject: [PATCH 14/21] Doc: Update doc for Dir View Example Task-number: QTBUG-60635 Change-Id: I4a23f4866c76b9f5c29653ca30e44c3b844a9aa8 Reviewed-by: Paul Wicking Reviewed-by: Venugopal Shivashankar --- examples/widgets/doc/src/dirview.qdoc | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/examples/widgets/doc/src/dirview.qdoc b/examples/widgets/doc/src/dirview.qdoc index d9a16fa58d..6db339eced 100644 --- a/examples/widgets/doc/src/dirview.qdoc +++ b/examples/widgets/doc/src/dirview.qdoc @@ -37,6 +37,10 @@ \borderedimage dirview-example.png + \quotefromfile itemviews/dirview/main.cpp + \skipto QCommandLineParser parser + \printuntil parser.positionalArguments + The example supports a number of command line options. These options include: \list @@ -47,22 +51,17 @@ use custom directory options \endlist - \quotefromfile itemviews/dirview/main.cpp - \skipto QCommandLineParser parser - \printuntil parser.positionalArguments - - Declares a QFileSystemModel as data model for viewing - the local file system. QFileSystem works with a cache, that is, - it is updated continually with QFileSystemWatcher on that folder. - \skipto QFileSystemModel \printuntil tree.setModel - Creates a model/view implementation called \c tree - for viewing the filesystem. + Declares \c model as data model for reading the local filesystem. + \c model.setRootPath("") sets the current folder as the folder from + which \c model will start reading. + QTreeView object \c tree visualizes the filesystem in a tree structure. \skipto tree.setAnimated(false) \printuntil tree.setWindowTitle - Sets some formatting options for \c tree. + Sets layout options for animation, indentation, sorting, and sizing of the + filesystem tree. */ From 7917305aa5acdad117632bc2723d9bec85daa0e0 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 30 Jan 2018 14:52:14 +0100 Subject: [PATCH 15/21] Doc: Show more examples on how to have multiple logging rules Task-number: QTBUG-66050 Change-Id: I6872cd64f9b27b9849e4166af7aa6414c372cd5e Reviewed-by: Leena Miettinen Reviewed-by: hjk --- src/corelib/io/qloggingcategory.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp index b029274329..a6c27d19c0 100644 --- a/src/corelib/io/qloggingcategory.cpp +++ b/src/corelib/io/qloggingcategory.cpp @@ -147,9 +147,15 @@ static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift) Rules are evaluated in text order, from first to last. That is, if two rules apply to a category/type, the rule that comes later is applied. - Rules can be set via \l setFilterRules(). Since Qt 5.3, logging rules can also - be set in the \c QT_LOGGING_RULES environment variable, and - are automatically loaded from the \c [Rules] section of a logging + Rules can be set via \l setFilterRules(): + + \code + QLoggingCategory::setFilterRules("*.debug=false\n" + "driver.usb.debug=true"); + \endcode + + Since Qt 5.3, logging rules are also + automatically loaded from the \c [Rules] section of a logging configuration file. Such configuration files are looked up in the QtProject configuration directory, or explicitly set in a \c QT_LOGGING_CONF environment variable: @@ -160,19 +166,18 @@ static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift) driver.usb.debug=true \endcode - Rules set by \l setFilterRules() take precedence over rules specified - in the QtProject configuration directory, and can, in turn, be - overwritten by rules from the configuration file specified by - \c QT_LOGGING_CONF, and rules set by \c QT_LOGGING_RULES. - - - Since Qt 5.6, \c QT_LOGGING_RULES may contain multiple rules separated - by semicolons: + Since Qt 5.3, logging rules can also be specified in a \c QT_LOGGING_RULES + environment variable. And since Qt 5.6, multiple rules can also be + separated by semicolons: \code QT_LOGGING_RULES="*.debug=false;driver.usb.debug=true" \endcode + Rules set by \l setFilterRules() take precedence over rules specified + in the QtProject configuration directory, and can, in turn, be + overwritten by rules from the configuration file specified by + \c QT_LOGGING_CONF, and rules set by \c QT_LOGGING_RULES. Order of evaluation: \list From 0cb940b1d3b9a1ba50f2d1973fca411706da266d Mon Sep 17 00:00:00 2001 From: Kari Oikarinen Date: Fri, 6 Apr 2018 16:25:21 +0300 Subject: [PATCH 16/21] tests/auto/widgets/widgets: Avoid unconditional qWait()s Task-number: QTBUG-63992 Change-Id: I7b0c259800082284ddae4e25d139ad3adc858467 Reviewed-by: Gatis Paeglis --- .../qabstractbutton/tst_qabstractbutton.cpp | 15 +++----- .../tst_qabstractscrollarea.cpp | 3 +- .../qcalendarwidget/tst_qcalendarwidget.cpp | 3 -- .../widgets/qcheckbox/tst_qcheckbox.cpp | 3 +- .../widgets/qcombobox/tst_qcombobox.cpp | 7 ++-- .../tst_qcommandlinkbutton.cpp | 34 ++----------------- .../qdialogbuttonbox/tst_qdialogbuttonbox.cpp | 3 +- .../widgets/qdockwidget/tst_qdockwidget.cpp | 11 +++--- .../qdoublespinbox/tst_qdoublespinbox.cpp | 6 ++-- .../widgets/widgets/qlabel/tst_qlabel.cpp | 1 - .../widgets/qlineedit/tst_qlineedit.cpp | 4 --- .../widgets/qmainwindow/tst_qmainwindow.cpp | 6 ++-- .../qmdisubwindow/tst_qmdisubwindow.cpp | 14 ++------ .../auto/widgets/widgets/qmenu/tst_qmenu.cpp | 7 ---- .../widgets/qprogressbar/tst_qprogressbar.cpp | 3 -- .../widgets/qpushbutton/tst_qpushbutton.cpp | 23 +++---------- .../widgets/qradiobutton/tst_qradiobutton.cpp | 6 ++-- .../widgets/widgets/qspinbox/tst_qspinbox.cpp | 3 +- .../widgets/qsplitter/tst_qsplitter.cpp | 13 +++---- .../widgets/qtabwidget/tst_qtabwidget.cpp | 3 +- .../widgets/widgets/qtoolbar/tst_qtoolbar.cpp | 12 +++---- .../widgets/qtoolbutton/tst_qtoolbutton.cpp | 3 +- 22 files changed, 42 insertions(+), 141 deletions(-) diff --git a/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp b/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp index bc7756d32f..e77faa1e75 100644 --- a/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp +++ b/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp @@ -473,14 +473,9 @@ void tst_QAbstractButton::setShortcut() QKeySequence seq( Qt::Key_A ); testWidget->setShortcut( seq ); QApplication::setActiveWindow(testWidget); - + testWidget->activateWindow(); // must be active to get shortcuts - for (int i = 0; !testWidget->isActiveWindow() && i < 100; ++i) { - testWidget->activateWindow(); - QApplication::instance()->processEvents(); - QTest::qWait(100); - } - QVERIFY(testWidget->isActiveWindow()); + QVERIFY(QTest::qWaitForWindowActive(testWidget)); QTest::keyClick( testWidget, 'A' ); QTest::qWait(300); // Animate click takes time @@ -508,9 +503,7 @@ void tst_QAbstractButton::animateClick() QVERIFY( testWidget->isDown() ); qApp->processEvents(); QVERIFY( testWidget->isDown() ); - QTest::qWait(200); - qApp->processEvents(); - QVERIFY( !testWidget->isDown() ); + QTRY_VERIFY( !testWidget->isDown() ); } void tst_QAbstractButton::shortcutEvents() @@ -614,7 +607,7 @@ void tst_QAbstractButton::keyNavigation() widget.show(); qApp->setActiveWindow(&widget); widget.activateWindow(); - QTest::qWait(30); + QVERIFY(QTest::qWaitForWindowActive(&widget)); buttons[1][1]->setFocus(); QTest::qWait(400); diff --git a/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp b/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp index 60efcddc60..372a467ada 100644 --- a/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp +++ b/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp @@ -346,6 +346,7 @@ void tst_QAbstractScrollArea::patternBackground() widget.resize(600, 600); scrollArea.setWidget(&widget); topLevel.show(); + QVERIFY(QTest::qWaitForWindowActive(&topLevel)); QLinearGradient linearGrad(QPointF(250, 250), QPointF(300, 300)); linearGrad.setColorAt(0, Qt::yellow); @@ -354,7 +355,6 @@ void tst_QAbstractScrollArea::patternBackground() scrollArea.viewport()->setPalette(QPalette(Qt::black, bg, bg, bg, bg, bg, bg, bg, bg)); widget.setPalette(Qt::transparent); - QTest::qWait(50); QImage image(200, 200, QImage::Format_ARGB32); scrollArea.render(&image); @@ -366,7 +366,6 @@ void tst_QAbstractScrollArea::patternBackground() QScrollBar *vbar = scrollArea.verticalScrollBar(); vbar->setValue(vbar->maximum()); - QTest::qWait(50); scrollArea.render(&image); QCOMPARE(image.pixel(QPoint(20,20)) , QColor(Qt::red).rgb()); diff --git a/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp b/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp index 8e4a800a75..5c0f4b1536 100644 --- a/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp +++ b/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp @@ -174,12 +174,10 @@ void tst_QCalendarWidget::buttonClickCheck() QTest::mouseClick(button, Qt::LeftButton, Qt::NoModifier, button->rect().center(), 2); QVERIFY(!button->isVisible()); QSpinBox *spinbox = object.findChild("qt_calendar_yearedit"); - QTest::qWait(500); QTest::keyClick(spinbox, '2'); QTest::keyClick(spinbox, '0'); QTest::keyClick(spinbox, '0'); QTest::keyClick(spinbox, '6'); - QTest::qWait(500); QWidget *widget = object.findChild("qt_calendar_calendarview"); QTest::mouseMove(widget); QTest::mouseClick(widget, Qt::LeftButton); @@ -305,7 +303,6 @@ void tst_QCalendarWidget::showPrevNext() QCOMPARE(calWidget.monthShown(), expectedDate.month()); // QTBUG-4058 - QTest::qWait(20); QToolButton *button = calWidget.findChild("qt_calendar_prevmonth"); QTest::mouseClick(button, Qt::LeftButton); expectedDate = expectedDate.addMonths(-1); diff --git a/tests/auto/widgets/widgets/qcheckbox/tst_qcheckbox.cpp b/tests/auto/widgets/widgets/qcheckbox/tst_qcheckbox.cpp index c9699bfb81..0cbab5e17c 100644 --- a/tests/auto/widgets/widgets/qcheckbox/tst_qcheckbox.cpp +++ b/tests/auto/widgets/widgets/qcheckbox/tst_qcheckbox.cpp @@ -83,6 +83,7 @@ void tst_QCheckBox::initTestCase() testWidget->setObjectName("testObject"); testWidget->resize( 200, 200 ); testWidget->show(); + QVERIFY(QTest::qWaitForWindowActive(testWidget)); } void tst_QCheckBox::cleanupTestCase() @@ -240,13 +241,11 @@ void tst_QCheckBox::pressed() QVERIFY( !testWidget->isChecked() ); QTest::keyPress( testWidget, Qt::Key_Space ); - QTest::qWait(100); QVERIFY( press_count == 1 ); QVERIFY( release_count == 0 ); QVERIFY( !testWidget->isChecked() ); QTest::keyRelease( testWidget, Qt::Key_Space ); - QTest::qWait(100); QVERIFY( press_count == 1 ); QVERIFY( release_count == 1 ); QVERIFY( testWidget->isChecked() ); diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 0c229c9194..7c1deb8fff 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -1995,19 +1995,16 @@ void tst_QComboBox::flaggedItems() QApplication::setActiveWindow(&comboBox); comboBox.activateWindow(); comboBox.setFocus(); + QVERIFY(QTest::qWaitForWindowActive(&comboBox)); QTRY_VERIFY(comboBox.isVisible()); QTRY_VERIFY(comboBox.hasFocus()); if (editable) comboBox.lineEdit()->selectAll(); - QSignalSpy indexChangedInt(&comboBox, SIGNAL(currentIndexChanged(int))); for (int i = 0; i < keyMovementList.count(); ++i) { Qt::Key key = keyMovementList[i]; QTest::keyClick(&comboBox, key); - if (indexChangedInt.count() != i + 1) { - QTest::qWait(400); - } } QCOMPARE(comboBox.currentIndex() , expectedIndex); @@ -2447,7 +2444,7 @@ void tst_QComboBox::task220195_keyBoardSelection2() combo.addItem( QLatin1String("foo3")); combo.show(); QApplication::setActiveWindow(&combo); - QTRY_COMPARE(QApplication::activeWindow(), static_cast(&combo)); + QVERIFY(QTest::qWaitForWindowActive(&combo)); combo.setCurrentIndex(-1); QVERIFY(combo.currentText().isNull()); diff --git a/tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.cpp b/tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.cpp index 667e348945..c0f33b9c79 100644 --- a/tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.cpp +++ b/tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.cpp @@ -110,6 +110,7 @@ void tst_QCommandLinkButton::initTestCase() testWidget->setObjectName("testWidget"); testWidget->resize( 200, 200 ); testWidget->show(); + QVERIFY(QTest::qWaitForWindowActive(testWidget)); connect( testWidget, SIGNAL(clicked()), this, SLOT(onClicked()) ); connect( testWidget, SIGNAL(pressed()), this, SLOT(onPressed()) ); @@ -166,12 +167,6 @@ void tst_QCommandLinkButton::onReleased() void tst_QCommandLinkButton::setAutoRepeat() { - // Give the last tests time to finish - i.e., wait for the window close - // and deactivate to avoid a race condition here. We can't add this to the - // end of the defaultAndAutoDefault test, since any failure in that test - // will return out of that function. - QTest::qWait( 1000 ); - // If this changes, this test must be completely revised. QVERIFY( !testWidget->isCheckable() ); @@ -194,8 +189,6 @@ void tst_QCommandLinkButton::setAutoRepeat() testWidget->setAutoRepeat( false ); QTest::keyPress( testWidget, Qt::Key_Space ); - QTest::qWait( 300 ); - QVERIFY( testWidget->isDown() ); QVERIFY( toggle_count == 0 ); QVERIFY( press_count == 1 ); @@ -206,18 +199,16 @@ void tst_QCommandLinkButton::setAutoRepeat() resetCounters(); // check that the button is down if we press space while in autorepeat - // we can't actually confirm how many times it is fired, more than 1 is enough. testWidget->setDown( false ); testWidget->setAutoRepeat( true ); QTest::keyPress( testWidget, Qt::Key_Space ); - QTest::qWait(900); + QTRY_VERIFY(press_count > 10); QVERIFY( testWidget->isDown() ); QVERIFY( toggle_count == 0 ); QTest::keyRelease( testWidget, Qt::Key_Space ); QCOMPARE(press_count, release_count); QCOMPARE(release_count, click_count); - QVERIFY(press_count > 1); // #### shouldn't I check here to see if multiple signals have been fired??? @@ -227,8 +218,6 @@ void tst_QCommandLinkButton::setAutoRepeat() testWidget->setAutoRepeat( false ); QTest::keyPress( testWidget, Qt::Key_Enter ); - QTest::qWait( 300 ); - QVERIFY( !testWidget->isDown() ); QVERIFY( toggle_count == 0 ); QVERIFY( press_count == 0 ); @@ -241,7 +230,6 @@ void tst_QCommandLinkButton::setAutoRepeat() testWidget->setDown( false ); testWidget->setAutoRepeat( true ); QTest::keyClick( testWidget, Qt::Key_Enter ); - QTest::qWait( 300 ); QVERIFY( !testWidget->isDown() ); QVERIFY( toggle_count == 0 ); QVERIFY( press_count == 0 ); @@ -252,23 +240,19 @@ void tst_QCommandLinkButton::setAutoRepeat() void tst_QCommandLinkButton::pressed() { QTest::keyPress( testWidget, ' ' ); -// QTest::qWait( 300 ); QCOMPARE( press_count, (uint)1 ); QCOMPARE( release_count, (uint)0 ); QTest::keyRelease( testWidget, ' ' ); -// QTest::qWait( 300 ); QCOMPARE( press_count, (uint)1 ); QCOMPARE( release_count, (uint)1 ); QTest::keyPress( testWidget,Qt::Key_Enter ); -// QTest::qWait( 300 ); QCOMPARE( press_count, (uint)1 ); QCOMPARE( release_count, (uint)1 ); testWidget->setAutoDefault(true); QTest::keyPress( testWidget,Qt::Key_Enter ); -// QTest::qWait( 300 ); QCOMPARE( press_count, (uint)2 ); QCOMPARE( release_count, (uint)2 ); testWidget->setAutoDefault(false); @@ -349,19 +333,7 @@ void tst_QCommandLinkButton::setAccel() // The shortcut will not be activated unless the button is in a active // window and has focus testWidget->setFocus(); - - // QWidget::isActiveWindow() can report window active before application - // has handled the asynchronous activation event on platforms that have - // implemented QPlatformWindow::isActive(), so process events to sync up. - QApplication::instance()->processEvents(); - - for (int i = 0; !testWidget->isActiveWindow() && i < 1000; ++i) { - testWidget->activateWindow(); - QApplication::instance()->processEvents(); - QTest::qWait(100); - } - - QVERIFY(testWidget->isActiveWindow()); + QVERIFY(QTest::qWaitForWindowActive(testWidget)); QTest::keyClick( testWidget, 'A', Qt::AltModifier ); QTest::qWait( 500 ); diff --git a/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp b/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp index f127fd98f7..17b0e9ce5f 100644 --- a/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp +++ b/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp @@ -838,10 +838,9 @@ void tst_QDialogButtonBox::task191642_default() bb->addButton(QDialogButtonBox::Help); dlg.show(); - QTest::qWait(10); + QVERIFY(QTest::qWaitForWindowActive(&dlg)); QVERIFY(def->isDefault()); QTest::keyPress( &dlg, Qt::Key_Enter ); - QTest::qWait(100); QCOMPARE(clicked.count(), 1); } diff --git a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp index 1a1023208a..7d1e736f42 100644 --- a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp +++ b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp @@ -579,8 +579,7 @@ void tst_QDockWidget::visibilityChanged() QCOMPARE(spy.count(), 0); mw.addDockWidget(Qt::RightDockWidgetArea, &dw2); - QTest::qWait(200); - QCOMPARE(spy.count(), 1); + QTRY_COMPARE(spy.count(), 1); QCOMPARE(spy.at(0).at(0).toBool(), true); } @@ -672,8 +671,7 @@ void tst_QDockWidget::dockLocationChanged() dw.setFloating(true); QTest::qWait(100); dw.setFloating(false); - QTest::qWait(100); - QCOMPARE(spy.count(), 1); + QTRY_COMPARE(spy.count(), 1); QCOMPARE(qvariant_cast(spy.at(0).at(0)), Qt::TopDockWidgetArea); spy.clear(); @@ -936,8 +934,7 @@ void tst_QDockWidget::task248604_infiniteResize() d.setContentsMargins(2, 2, 2, 2); d.setMinimumSize(320, 240); d.showNormal(); - QTest::qWait(400); - QCOMPARE(d.size(), QSize(320, 240)); + QTRY_COMPARE(d.size(), QSize(320, 240)); } @@ -950,7 +947,7 @@ void tst_QDockWidget::task258459_visibilityChanged() QSignalSpy spy1(&dock1, SIGNAL(visibilityChanged(bool))); QSignalSpy spy2(&dock2, SIGNAL(visibilityChanged(bool))); win.show(); - QTest::qWait(200); + QVERIFY(QTest::qWaitForWindowActive(&win)); QCOMPARE(spy1.count(), 1); QCOMPARE(spy1.first().first().toBool(), false); //dock1 is invisible QCOMPARE(spy2.count(), 1); diff --git a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp index 59ddd54194..22e8097949 100644 --- a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp +++ b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp @@ -164,6 +164,7 @@ void tst_QDoubleSpinBox::initTestCase() testFocusWidget = new QWidget(0); testFocusWidget->resize(200, 100); testFocusWidget->show(); + QVERIFY(QTest::qWaitForWindowActive(testFocusWidget)); } void tst_QDoubleSpinBox::cleanupTestCase() @@ -770,8 +771,7 @@ void tst_QDoubleSpinBox::editingFinished() testFocusWidget->show(); QApplication::setActiveWindow(testFocusWidget); - QTest::qWait(10); - QTRY_VERIFY(testFocusWidget->isActiveWindow()); + QVERIFY(QTest::qWaitForWindowActive(testFocusWidget)); box->setFocus(); QTRY_VERIFY(box->hasFocus()); @@ -997,7 +997,7 @@ void tst_QDoubleSpinBox::task224497_fltMax() dspin->setMinimum(3); dspin->setMaximum(FLT_MAX); dspin->show(); - QTest::qWait(1000); + QVERIFY(QTest::qWaitForWindowActive(dspin)); dspin->lineEdit()->selectAll(); QTest::keyClick(dspin->lineEdit(), Qt::Key_Delete); QTest::keyClick(dspin->lineEdit(), Qt::Key_1); diff --git a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp index 84071962bc..34862f6810 100644 --- a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp +++ b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp @@ -398,7 +398,6 @@ void tst_QLabel::task226479_movieResize() label.paintedRegion = QRegion(); movie->setFileName(QFINDTESTDATA("green.png")); movie->start(); - QTest::qWait(50); QTRY_COMPARE(label.paintedRegion , QRegion(label.rect()) ); } diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index 0be8d319c2..23e52a8bf9 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -3573,18 +3573,15 @@ void tst_QLineEdit::task174640_editingFinished() QSignalSpy editingFinishedSpy(le1, SIGNAL(editingFinished())); le1->setFocus(); - QTest::qWait(20); QTRY_VERIFY(le1->hasFocus()); QCOMPARE(editingFinishedSpy.count(), 0); le2->setFocus(); - QTest::qWait(20); QTRY_VERIFY(le2->hasFocus()); QCOMPARE(editingFinishedSpy.count(), 1); editingFinishedSpy.clear(); le1->setFocus(); - QTest::qWait(20); QTRY_VERIFY(le1->hasFocus()); QMenu *testMenu1 = new QMenu(le1); @@ -3680,7 +3677,6 @@ void tst_QLineEdit::task229938_dontEmitChangedWhenTextIsNotChanged() QVERIFY(QTest::qWaitForWindowExposed(&lineEdit)); // to be safe and avoid failing setFocus with window managers lineEdit.setFocus(); QSignalSpy changedSpy(&lineEdit, SIGNAL(textChanged(QString))); - QTest::qWait(200); QTest::keyPress(&lineEdit, 'a'); QTest::keyPress(&lineEdit, 'b'); QTest::keyPress(&lineEdit, 'c'); diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp index 30dc1e6043..ae71663036 100644 --- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp @@ -1745,17 +1745,15 @@ void tst_QMainWindow::setCursor() QCOMPARE(cur.shape(), mw.cursor().shape()); mw.resize(200,200); mw.show(); - QTest::qWait(50); + QVERIFY(QTest::qWaitForWindowActive(&mw)); QCOMPARE(cur.shape(), mw.cursor().shape()); QHoverEvent enterE(QEvent::HoverEnter, QPoint(10,10), QPoint()); mw.event(&enterE); - QTest::qWait(50); QCOMPARE(cur.shape(), mw.cursor().shape()); QHoverEvent leaveE(QEvent::HoverLeave, QPoint(), QPoint()); mw.event(&leaveE); - QTest::qWait(50); QCOMPARE(cur.shape(), mw.cursor().shape()); } #endif @@ -1844,7 +1842,7 @@ void tst_QMainWindow::dockWidgetSize() mainWindow.addDockWidget(Qt::TopDockWidgetArea, &dock); mainWindow.show(); - QTest::qWait(100); + QVERIFY(QTest::qWaitForWindowActive(&mainWindow)); if (mainWindow.size() == mainWindow.sizeHint()) { QCOMPARE(widget.size(), widget.sizeHint()); QCOMPARE(dock.widget()->size(), dock.widget()->sizeHint()); diff --git a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp index a9d8c48d63..360e0c93c4 100644 --- a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp @@ -963,8 +963,6 @@ void tst_QMdiSubWindow::setSystemMenu() mainWindow.menuBar()->setNativeMenuBar(false); mainWindow.show(); QVERIFY(QTest::qWaitForWindowExposed(&mainWindow)); - QTest::qWait(60); - QTRY_VERIFY(subWindow->isVisible()); QPoint globalPopupPos; @@ -972,7 +970,6 @@ void tst_QMdiSubWindow::setSystemMenu() // Show system menu QVERIFY(!qApp->activePopupWidget()); subWindow->showSystemMenu(); - QTest::qWait(25); QTRY_COMPARE(qApp->activePopupWidget(), qobject_cast(systemMenu)); QTRY_COMPARE(systemMenu->mapToGlobal(QPoint(0, 0)), (globalPopupPos = subWindow->mapToGlobal(subWindow->contentsRect().topLeft())) ); @@ -997,7 +994,6 @@ void tst_QMdiSubWindow::setSystemMenu() // Show the new system menu QVERIFY(!qApp->activePopupWidget()); subWindow->showSystemMenu(); - QTest::qWait(25); QTRY_COMPARE(qApp->activePopupWidget(), qobject_cast(systemMenu)); QTRY_COMPARE(systemMenu->mapToGlobal(QPoint(0, 0)), globalPopupPos); @@ -1011,7 +1007,6 @@ void tst_QMdiSubWindow::setSystemMenu() QWidget *menuLabel = subWindow->maximizedSystemMenuIconWidget(); QVERIFY(menuLabel); subWindow->showSystemMenu(); - QTest::qWait(25); QTRY_COMPARE(qApp->activePopupWidget(), qobject_cast(systemMenu)); QCOMPARE(systemMenu->mapToGlobal(QPoint(0, 0)), (globalPopupPos = menuLabel->mapToGlobal(QPoint(0, menuLabel->y() + menuLabel->height())))); @@ -1027,7 +1022,6 @@ void tst_QMdiSubWindow::setSystemMenu() QTest::qWait(150); subWindow->showSystemMenu(); - QTest::qWait(250); QTRY_COMPARE(qApp->activePopupWidget(), qobject_cast(systemMenu)); // + QPoint(1, 0) because topRight() == QPoint(left() + width() -1, top()) globalPopupPos = subWindow->mapToGlobal(subWindow->contentsRect().topRight()) + QPoint(1, 0); @@ -1044,7 +1038,6 @@ void tst_QMdiSubWindow::setSystemMenu() menuLabel = subWindow->maximizedSystemMenuIconWidget(); QVERIFY(menuLabel); subWindow->showSystemMenu(); - QTest::qWait(250); QTRY_COMPARE(qApp->activePopupWidget(), qobject_cast(systemMenu)); globalPopupPos = menuLabel->mapToGlobal(QPoint(menuLabel->width(), menuLabel->y() + menuLabel->height())); globalPopupPos -= QPoint(systemMenu->sizeHint().width(), 0); @@ -1648,8 +1641,6 @@ void tst_QMdiSubWindow::resizeTimer() QMdiSubWindow *subWindow = mdiArea.addSubWindow(new QWidget); mdiArea.show(); QVERIFY(QTest::qWaitForWindowExposed(&mdiArea)); - QTest::qWait(300); - EventSpy timerEventSpy(subWindow, QEvent::Timer); QCOMPARE(timerEventSpy.count(), 0); @@ -1809,10 +1800,9 @@ void tst_QMdiSubWindow::closeOnDoubleClick() QVERIFY(QTest::qWaitForWindowExposed(&mdiArea)); subWindow->showSystemMenu(); - QTest::qWait(200); - QPointer systemMenu = subWindow->systemMenu(); - QVERIFY(systemMenu); + QPointer systemMenu; + QTRY_VERIFY( (systemMenu = subWindow->systemMenu()) ); QVERIFY(systemMenu->isVisible()); const QRect actionGeometry = systemMenu->actionGeometry(systemMenu->actions().at(actionIndex)); diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index 28e8ba81d6..0dde385bdb 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -991,18 +991,14 @@ void tst_QMenu::task258920_mouseBorder() #endif menu.popup(center); QVERIFY(QTest::qWaitForWindowExposed(&menu)); - QTest::qWait(100); QRect actionRect = menu.actionGeometry(action); const QPoint actionCenter = actionRect.center(); QTest::mouseMove(&menu, actionCenter - QPoint(-10, 0)); - QTest::qWait(30); QTest::mouseMove(&menu, actionCenter); - QTest::qWait(30); QTest::mouseMove(&menu, actionCenter + QPoint(10, 0)); QTRY_COMPARE(action, menu.activeAction()); menu.painted = false; QTest::mouseMove(&menu, QPoint(actionRect.center().x(), actionRect.bottom() + 1)); - QTest::qWait(30); QTRY_COMPARE(static_cast(0), menu.activeAction()); QTRY_VERIFY(menu.painted); } @@ -1109,7 +1105,6 @@ void tst_QMenu::QTBUG7907_submenus_autoselect() menu.show(); QVERIFY(QTest::qWaitForWindowExposed(&menu)); QTest::mouseClick(&menu, Qt::LeftButton, Qt::NoModifier, QPoint(5,5) ); - QTest::qWait(500); QVERIFY(!subset.isVisible()); } @@ -1410,7 +1405,6 @@ void tst_QMenu::QTBUG_56917_wideMenuSize() menu.addAction(longString); QSize menuSizeHint = menu.sizeHint(); menu.popup(QPoint()); - QTest::qWait(100); QVERIFY(QTest::qWaitForWindowExposed(&menu)); QVERIFY(menu.isVisible()); QVERIFY(menu.height() <= menuSizeHint.height()); @@ -1428,7 +1422,6 @@ void tst_QMenu::QTBUG_56917_wideMenuScreenNumber() QMenu menu; menu.addAction(longString); menu.popup(QApplication::desktop()->screen(i)->geometry().center()); - QTest::qWait(100); QVERIFY(QTest::qWaitForWindowExposed(&menu)); QVERIFY(menu.isVisible()); QCOMPARE(QApplication::desktop()->screenNumber(&menu), i); diff --git a/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp index 35209c2501..39989c6dbb 100644 --- a/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp +++ b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp @@ -163,12 +163,9 @@ void tst_QProgressBar::format() bar.move(300, 300); bar.show(); QVERIFY(QTest::qWaitForWindowExposed(&bar)); - QVERIFY(QTest::qWaitForWindowExposed(&bar)); - QTest::qWait(20); bar.repainted = false; bar.setFormat("%v of %m (%p%)"); - QTest::qWait(20); QTRY_VERIFY(bar.repainted); bar.repainted = false; bar.setFormat("%v of %m (%p%)"); diff --git a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp index 2b54008de7..625f38d8ae 100644 --- a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp +++ b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp @@ -183,9 +183,7 @@ void tst_QPushButton::autoRepeat() testWidget->setAutoRepeat( false ); QTest::keyPress( testWidget, Qt::Key_Space ); - QTest::qWait( 300 ); - - QVERIFY( testWidget->isDown() ); + QTRY_VERIFY( testWidget->isDown() ); QVERIFY( toggle_count == 0 ); QVERIFY( press_count == 1 ); QVERIFY( release_count == 0 ); @@ -200,13 +198,12 @@ void tst_QPushButton::autoRepeat() testWidget->setDown( false ); testWidget->setAutoRepeat( true ); QTest::keyPress( testWidget, Qt::Key_Space ); - QTest::qWait(900); + QTRY_VERIFY(press_count > 3); QVERIFY( testWidget->isDown() ); QVERIFY( toggle_count == 0 ); QTest::keyRelease( testWidget, Qt::Key_Space ); QCOMPARE(press_count, release_count); QCOMPARE(release_count, click_count); - QVERIFY(press_count > 1); // #### shouldn't I check here to see if multiple signals have been fired??? @@ -241,23 +238,19 @@ void tst_QPushButton::autoRepeat() void tst_QPushButton::pressed() { QTest::keyPress( testWidget, ' ' ); -// QTest::qWait( 300 ); QCOMPARE( press_count, (uint)1 ); QCOMPARE( release_count, (uint)0 ); QTest::keyRelease( testWidget, ' ' ); -// QTest::qWait( 300 ); QCOMPARE( press_count, (uint)1 ); QCOMPARE( release_count, (uint)1 ); QTest::keyPress( testWidget,Qt::Key_Enter ); -// QTest::qWait( 300 ); QCOMPARE( press_count, (uint)1 ); QCOMPARE( release_count, (uint)1 ); testWidget->setAutoDefault(true); QTest::keyPress( testWidget,Qt::Key_Enter ); -// QTest::qWait( 300 ); QCOMPARE( press_count, (uint)2 ); QCOMPARE( release_count, (uint)2 ); testWidget->setAutoDefault(false); @@ -340,14 +333,8 @@ void tst_QPushButton::setAccel() // window and has focus QApplication::setActiveWindow(testWidget); testWidget->setFocus(); - for (int i = 0; !testWidget->isActiveWindow() && i < 1000; ++i) { - testWidget->activateWindow(); - QApplication::instance()->processEvents(); - QTest::qWait(100); - } - QVERIFY(testWidget->isActiveWindow()); + QVERIFY(QTest::qWaitForWindowActive(testWidget)); QTest::keyClick( testWidget, 'A', Qt::AltModifier ); - QTest::qWait( 50 ); QTRY_VERIFY( click_count == 1 ); QVERIFY( press_count == 1 ); QVERIFY( release_count == 1 ); @@ -576,10 +563,8 @@ void tst_QPushButton::sizeHint() dialog->showNormal(); tabWidget->setCurrentWidget(tab2); tabWidget->setCurrentWidget(tab1); - QTest::qWait(100); - QApplication::processEvents(); - QCOMPARE(button1_2->size(), button2_2->size()); + QTRY_COMPARE(button1_2->size(), button2_2->size()); } } diff --git a/tests/auto/widgets/widgets/qradiobutton/tst_qradiobutton.cpp b/tests/auto/widgets/widgets/qradiobutton/tst_qradiobutton.cpp index e3752df09e..a4edea23bc 100644 --- a/tests/auto/widgets/widgets/qradiobutton/tst_qradiobutton.cpp +++ b/tests/auto/widgets/widgets/qradiobutton/tst_qradiobutton.cpp @@ -70,15 +70,13 @@ void tst_QRadioButton::task190739_focus() widget.show(); widget.activateWindow(); - QApplication::setActiveWindow(&widget); - QTest::qWait(100); + QVERIFY(QTest::qWaitForWindowActive(&widget)); QVERIFY(edit.hasFocus()); QVERIFY(!radio1.isChecked()); QTest::keyClick(&edit, Qt::Key_O, Qt::ControlModifier, 20); - QTest::qWait(200); - QVERIFY(radio1.isChecked()); + QTRY_VERIFY(radio1.isChecked()); QVERIFY(edit.hasFocus()); QVERIFY(!radio1.hasFocus()); } diff --git a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp index 07a2fd859d..57816f9f70 100644 --- a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp @@ -852,12 +852,11 @@ void tst_QSpinBox::editingFinished() testFocusWidget.hide(); QCOMPARE(editingFinishedSpy1.count(), 4); QCOMPARE(editingFinishedSpy2.count(), 4); - QTest::qWait(100); //task203285 editingFinishedSpy1.clear(); testFocusWidget.show(); - QTest::qWait(100); + QVERIFY(QTest::qWaitForWindowActive(&testFocusWidget)); box->setKeyboardTracking(false); qApp->setActiveWindow(&testFocusWidget); testFocusWidget.activateWindow(); diff --git a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp index cad7bd69d7..77abf5e5a7 100644 --- a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp +++ b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp @@ -287,7 +287,7 @@ void tst_QSplitter::saveAndRestoreStateOfNotYetShownSplitter() QByteArray ba = spl->saveState(); spl->restoreState(ba); spl->show(); - QTest::qWait(500); + QVERIFY(QTest::qWaitForWindowActive(spl)); QCOMPARE(l1->geometry().isValid(), true); QCOMPARE(l2->geometry().isValid(), true); @@ -607,8 +607,7 @@ void tst_QSplitter::testShowHide() lay->addWidget(split); widget.setLayout(lay); topLevel.show(); - - QTest::qWait(100); + QVERIFY(QTest::qWaitForWindowActive(&topLevel)); widget.hide(); split->widget(0)->setHidden(hideWidget1); @@ -976,14 +975,13 @@ void tst_QSplitter::task169702_sizes() outerSplitter->setGeometry(100, 100, 500, 500); topLevel.show(); + QVERIFY(QTest::qWaitForWindowActive(&topLevel)); - QTest::qWait(100); testW->m_iFactor++; testW->updateGeometry(); - QTest::qWait(500); //Make sure the minimimSizeHint is respected - QCOMPARE(testW->size().height(), testW->minimumSizeHint().height()); + QTRY_COMPARE(testW->size().height(), testW->minimumSizeHint().height()); } void tst_QSplitter::taskQTBUG_4101_ensureOneNonCollapsedWidget_data() @@ -1012,8 +1010,7 @@ void tst_QSplitter::taskQTBUG_4101_ensureOneNonCollapsedWidget() l->hide(); else delete l; - QTest::qWait(100); - QVERIFY(s.sizes().at(0) > 0); + QTRY_VERIFY(s.sizes().at(0) > 0); } void tst_QSplitter::setLayout() diff --git a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp index b5ffb90e42..cd7fe3710d 100644 --- a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp +++ b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp @@ -549,8 +549,7 @@ void tst_QTabWidget::paintEventCount() QCOMPARE(tw->currentIndex(), 0); tw->show(); - - QTest::qWait(1000); + QVERIFY(QTest::qWaitForWindowActive(tw)); // Mac, Windows and Windows CE get multiple repaints on the first show, so use those as a starting point. static const int MaxInitialPaintCount = diff --git a/tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp b/tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp index 3525dcddd6..301801ed2e 100644 --- a/tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp +++ b/tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp @@ -1038,11 +1038,9 @@ void tst_QToolBar::accel() mw.show(); QApplication::setActiveWindow(&mw); - QTest::qWait(100); - QTRY_COMPARE(QApplication::activeWindow(), static_cast(&mw)); + QVERIFY(QTest::qWaitForWindowActive(&mw)); QTest::keyClick(&mw, Qt::Key_T, Qt::AltModifier); - QTest::qWait(300); QTRY_COMPARE(spy.count(), 1); #ifdef Q_OS_MAC @@ -1085,19 +1083,19 @@ void tst_QToolBar::task197996_visibility() pAction->setVisible(true); mw.show(); + QVERIFY(QTest::qWaitForWindowActive(&mw)); QVERIFY(toolBar->widgetForAction(pAction)->isVisible()); toolBar->setVisible(false); pAction->setVisible(false); + QVERIFY(!toolBar->widgetForAction(pAction)->isVisible()); + toolBar->setVisible(true); pAction->setVisible(true); - QTest::qWait(100); - - QVERIFY(toolBar->widgetForAction(pAction)->isVisible()); - + QTRY_VERIFY(toolBar->widgetForAction(pAction)->isVisible()); } QTEST_MAIN(tst_QToolBar) diff --git a/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp b/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp index 1775f03680..a7a62496e6 100644 --- a/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp +++ b/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp @@ -141,8 +141,7 @@ void tst_QToolButton::triggered() timer->start(); QTimer::singleShot(10000, &mainWidget, SLOT(close())); // Emergency bail-out toolButton->showMenu(); - QTest::qWait(20); - QCOMPARE(spy.count(),2); + QTRY_COMPARE(spy.count(),2); QCOMPARE(qvariant_cast(spy.at(1).at(0)), one); } From 3d863ae798ecea87eaf02b2364d45cb79d90c3f5 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 16 Apr 2018 11:12:58 +0200 Subject: [PATCH 17/21] Fix build with -no-feature-graphicsview Change-Id: Idddd353695d2a24ed90c29f557abfedf11d82fbc Reviewed-by: Richard Moe Gustavsen Reviewed-by: Oswald Buddenhagen --- src/widgets/kernel/qwindowcontainer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp index d388327687..097931913e 100644 --- a/src/widgets/kernel/qwindowcontainer.cpp +++ b/src/widgets/kernel/qwindowcontainer.cpp @@ -48,6 +48,7 @@ #include #endif #include +#include QT_BEGIN_NAMESPACE From b55176df08898190fcee684319d6e3778b8835de Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 19 Apr 2018 18:03:31 +0200 Subject: [PATCH 18/21] syncqt: prune references to @ignore_for_master_contents this variable hasn't been used in any syncqt.profile for many years, and if it would, it would cause quite some side effects. Change-Id: Ia936eff8f6a2a801fc644eee991821165d51dc1f Reviewed-by: Joerg Bornemann Reviewed-by: Lars Knoll --- bin/syncqt.pl | 5 ----- 1 file changed, 5 deletions(-) diff --git a/bin/syncqt.pl b/bin/syncqt.pl index c6aced4412..9a889c062b 100755 --- a/bin/syncqt.pl +++ b/bin/syncqt.pl @@ -882,7 +882,6 @@ die "The -version argument is mandatory" if (!$module_version); $build_basedir = $out_basedir if (!defined($build_basedir)); our @ignore_headers = (); -our @ignore_for_master_contents = (); our @ignore_for_include_check = (); our @ignore_for_qt_begin_namespace_check = (); our @ignore_for_qt_module_check = (); @@ -1026,10 +1025,6 @@ foreach my $lib (@modules_to_sync) { $qpa_header = 1; } elsif ($allheadersprivate || $thisprivate || $public_header =~ /_p(ch)?\.h$/) { $public_header = 0; - } else { - foreach (@ignore_for_master_contents) { - $public_header = 0 if($header eq $_); - } } my $clean_header; From 395a19f0325e883749dde76849bd1092a711d802 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 12 Apr 2018 21:10:59 +0200 Subject: [PATCH 19/21] improve documentation, mostly of the QT_TR*_NOOP macros MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I65ccddec84a01945a6aee2a859d4f92ea830785b Reviewed-by: Paul Wicking Reviewed-by: Topi Reiniƶ Reviewed-by: Mateusz Starzycki Reviewed-by: Martin Smith --- .../code/src_corelib_global_qglobal.cpp | 16 ++--- src/corelib/global/qglobal.cpp | 58 +++++++++---------- src/corelib/global/qglobal.h | 2 +- 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp b/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp index ceb3f8adf3..2d7b9a9ac8 100644 --- a/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_global_qglobal.cpp @@ -387,11 +387,11 @@ CONFIG += no_keywords //! [34] QString FriendlyConversation::greeting(int type) { -static const char *greeting_strings[] = { - QT_TR_NOOP("Hello"), - QT_TR_NOOP("Goodbye") -}; -return tr(greeting_strings[type]); + static const char *greeting_strings[] = { + QT_TR_NOOP("Hello"), + QT_TR_NOOP("Goodbye") + }; + return tr(greeting_strings[type]); } //! [34] @@ -410,7 +410,7 @@ QString FriendlyConversation::greeting(int type) QString global_greeting(int type) { return qApp->translate("FriendlyConversation", - greeting_strings[type]); + greeting_strings[type]); } //! [35] @@ -434,8 +434,8 @@ QString FriendlyConversation::greeting(int type) QString global_greeting(int type) { return qApp->translate("FriendlyConversation", - greeting_strings[type].source, - greeting_strings[type].comment); + greeting_strings[type].source, + greeting_strings[type].comment); } //! [36] diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 30c80b8b6f..21f22a32ba 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -648,10 +648,10 @@ Q_STATIC_ASSERT((std::is_same::value)); compiler or platform specific code to their application. The remaining macros are convenience macros for larger operations: - The QT_TRANSLATE_NOOP() and QT_TR_NOOP() macros provide the - possibility of marking text for dynamic translation, - i.e. translation without changing the stored source text. The - Q_ASSERT() and Q_ASSERT_X() enables warning messages of various + The QT_TR_NOOP(), QT_TRANSLATE_NOOP(), and QT_TRANSLATE_NOOP3() + macros provide the possibility of marking strings for delayed + translation. + The Q_ASSERT() and Q_ASSERT_X() enables warning messages of various level of refinement. The Q_FOREACH() and foreach() macros implement Qt's foreach loop. @@ -662,11 +662,11 @@ Q_STATIC_ASSERT((std::is_same::value)); memory, if the pointer is 0. The qPrintable() and qUtf8Printable() macros represent an easy way of printing text. - Finally, the QT_POINTER_SIZE macro expands to the size of a - pointer in bytes, and the QT_VERSION and QT_VERSION_STR macros - expand to a numeric value or a string, respectively, specifying - Qt's version number, i.e the version the application is compiled - against. + The QT_POINTER_SIZE macro expands to the size of a pointer in bytes. + + The macros QT_VERSION and QT_VERSION_STR expand to a numeric value + or a string, respectively, that specifies the version of Qt that the + application is compiled against. \sa , QSysInfo */ @@ -3676,19 +3676,18 @@ bool qunsetenv(const char *varName) \macro QT_TR_NOOP(sourceText) \relates - Marks the string literal \a sourceText for dynamic translation in - the current context (class), i.e the stored \a sourceText will not - be altered. + Marks the UTF-8 encoded string literal \a sourceText for delayed + translation in the current context (class). - The macro expands to \a sourceText. + The macro tells lupdate to collect the string, and expands to + \a sourceText itself. Example: \snippet code/src_corelib_global_qglobal.cpp 34 - The macro QT_TR_NOOP_UTF8() is identical except that it tells lupdate - that the source string is encoded in UTF-8. Corresponding variants - exist in the QT_TRANSLATE_NOOP() family of macros, too. + The macro QT_TR_NOOP_UTF8() is identical and obsolete; this applies + to all other _UTF8 macros as well. \sa QT_TRANSLATE_NOOP(), {Internationalization with Qt} */ @@ -3697,12 +3696,12 @@ bool qunsetenv(const char *varName) \macro QT_TRANSLATE_NOOP(context, sourceText) \relates - Marks the string literal \a sourceText for dynamic translation in - the given \a context; i.e, the stored \a sourceText will not be - altered. The \a context is typically a class and also needs to - be specified as string literal. + Marks the UTF-8 encoded string literal \a sourceText for delayed + translation in the given \a context. The \a context is typically + a class name and also needs to be specified as a string literal. - The macro expands to \a sourceText. + The macro tells lupdate to collect the string, and expands to + \a sourceText itself. Example: @@ -3712,18 +3711,19 @@ bool qunsetenv(const char *varName) */ /*! - \macro QT_TRANSLATE_NOOP3(context, sourceText, comment) + \macro QT_TRANSLATE_NOOP3(context, sourceText, disambiguation) \relates \since 4.4 - Marks the string literal \a sourceText for dynamic translation in the - given \a context and with \a comment, i.e the stored \a sourceText will - not be altered. The \a context is typically a class and also needs to - be specified as string literal. The string literal \a comment - will be available for translators using e.g. Qt Linguist. + Marks the UTF-8 encoded string literal \a sourceText for delayed + translation in the given \a context with the given \a disambiguation. + The \a context is typically a class and also needs to be specified + as a string literal. The string literal \a disambiguation should be + a short semantic tag to tell apart otherwise identical strings. - The macro expands to anonymous struct of the two string - literals passed as \a sourceText and \a comment. + The macro tells lupdate to collect the string, and expands to an + anonymous struct of the two string literals passed as \a sourceText + and \a disambiguation. Example: diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index e31d4d9ad7..3684c6b5de 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1062,7 +1062,7 @@ template static inline typename Wrapper::pointer qGetPtrHelpe #define QT_TRANSLATE_NOOP3(scope, x, comment) {x, comment} #define QT_TRANSLATE_NOOP3_UTF8(scope, x, comment) {x, comment} -#ifndef QT_NO_TRANSLATION // ### This should enclose the NOOPs above +#ifndef QT_NO_TRANSLATION // ### Qt6: This should enclose the NOOPs above // Defined in qcoreapplication.cpp // The better name qTrId() is reserved for an upcoming function which would From 75587c8030ff8057b90200cb20cff1e4549c00b5 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 9 Apr 2018 18:34:18 +0200 Subject: [PATCH 20/21] qmake: fix look-up of relative files from .depend_command in shadow builds the dependency paths are fixified against the output directory, so we must resolve them accordingly. Change-Id: Id92750aad358153bd2db5daca3194c54eda58dbb Reviewed-by: Joerg Bornemann --- qmake/generators/makefile.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 82573347b6..99aecdd8ce 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -1953,11 +1953,12 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) } QT_PCLOSE(proc); if(!indeps.isEmpty()) { + QDir outDir(Option::output_dir); // ### This is basically fubar. Add 'lines' flag to CONFIG? QStringList dep_cmd_deps = indeps.replace('\n', ' ').simplified().split(' '); for(int i = 0; i < dep_cmd_deps.count(); ++i) { QString &file = dep_cmd_deps[i]; - QString absFile = QDir(Option::output_dir).absoluteFilePath(file); + QString absFile = outDir.absoluteFilePath(file); if (exists(absFile)) { file = absFile; } else { @@ -1965,8 +1966,9 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) QList depdirs = QMakeSourceFileInfo::dependencyPaths(); for (QList::Iterator dit = depdirs.begin(); dit != depdirs.end(); ++dit) { - if (exists((*dit).local() + '/' + file)) { - localFile = (*dit).local() + '/' + file; + QString lf = outDir.absoluteFilePath((*dit).local() + '/' + file); + if (exists(lf)) { + localFile = lf; break; } } @@ -2045,11 +2047,12 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) } QT_PCLOSE(proc); if(!indeps.isEmpty()) { + QDir outDir(Option::output_dir); // ### This is basically fubar. Add 'lines' flag to CONFIG? QStringList dep_cmd_deps = indeps.replace('\n', ' ').simplified().split(' '); for(int i = 0; i < dep_cmd_deps.count(); ++i) { QString &file = dep_cmd_deps[i]; - QString absFile = QDir(Option::output_dir).absoluteFilePath(file); + QString absFile = outDir.absoluteFilePath(file); if (exists(absFile)) { file = absFile; } else { @@ -2057,8 +2060,9 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) QList depdirs = QMakeSourceFileInfo::dependencyPaths(); for (QList::Iterator dit = depdirs.begin(); dit != depdirs.end(); ++dit) { - if (exists((*dit).local() + '/' + file)) { - localFile = (*dit).local() + '/' + file; + QString lf = outDir.absoluteFilePath((*dit).local() + '/' + file); + if (exists(lf)) { + localFile = lf; break; } } From 4bab1b0d7c2462ee9c5369c949b45bc4dedc1194 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 8 May 2017 12:14:32 +0200 Subject: [PATCH 21/21] configure: don't emit empty GCC_MACHINE_DUMP to qdevice.pri there is no point in doing that. Change-Id: Ie09edeed340ea87eddb38980b0df7ed777ec6280 Reviewed-by: Joerg Bornemann --- configure.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.json b/configure.json index ae2aa22070..b4a87f5505 100644 --- a/configure.json +++ b/configure.json @@ -521,11 +521,11 @@ "output": [ "prepareSpec", "prepareOptions", "preparePaths", "reloadSpec" ] }, "machineTuple": { - "condition": "!config.linux || config.android || tests.machineTuple", + "condition": "config.linux && !config.android && tests.machineTuple", "output": [ "machineTuple" ] }, "commit": { - "condition": "features.machineTuple", + "condition": "features.machineTuple || true", "output": [ "commitOptions" ] }, "android-style-assets": {