Deprecate the qWaitForWindowShown(QWindow *) method.

While the qWaitForWindowShown(QWidget *) is inherited
from Qt 4.8, the qWaitForWindowShown(QWindow *) was introduced
in Qt 5. As it is identical to qWaitForWindowExposed()
and removed already, it can be deprecated in Qt 5.

Remove its usages in qtbase.

Change-Id: I28788d120ad687a49f02b2b44de6b38a2832fe5c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
This commit is contained in:
Friedemann Kleint 2012-07-20 12:49:12 +02:00 committed by Qt by Nokia
parent a4cd6ef25d
commit 4677cf3d01
7 changed files with 43 additions and 44 deletions

View File

@ -129,12 +129,13 @@ namespace QTest
}
#endif
#if QT_DEPRECATED_SINCE(6, 0)
#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED inline static bool qWaitForWindowShown(QWindow *window, int timeout = 1000)
{
return qWaitForWindowExposed(window, timeout);
}
#endif // QT_DEPRECATED_SINCE(5, 0)
#if QT_DEPRECATED_SINCE(6, 0)
# ifdef QT_WIDGETS_LIB
QT_DEPRECATED inline static bool qWaitForWindowShown(QWidget *widget, int timeout = 1000)
{

View File

@ -107,9 +107,9 @@ void tst_QGuiApplication::focusObject()
// verify active window focus propagates to qguiapplication
QTest::qWaitForWindowShown(&window1);
window1.requestActivateWindow();
QTRY_COMPARE(app.focusWindow(), &window1);
QVERIFY(QTest::qWaitForWindowActive(&window1));
QCOMPARE(app.focusWindow(), &window1);
window1.setFocusObject(&obj1);
QCOMPARE(app.focusObject(), &obj1);
@ -124,7 +124,7 @@ void tst_QGuiApplication::focusObject()
window2.setFocusObject(&obj3);
QCOMPARE(app.focusObject(), &obj2); // not yet changed
window2.show();
QTest::qWaitForWindowShown(&window2);
QVERIFY(QTest::qWaitForWindowExposed(&window2));
QTRY_COMPARE(app.focusWindow(), &window2);
QCOMPARE(app.focusObject(), &obj3);
QCOMPARE(spy.count(), 1);
@ -241,8 +241,8 @@ void tst_QGuiApplication::changeFocusWindow()
FocusChangeWindow window1, window2;
window1.show();
window2.show();
QTest::qWaitForWindowShown(&window1);
QTest::qWaitForWindowShown(&window2);
QVERIFY(QTest::qWaitForWindowExposed(&window1));
QVERIFY(QTest::qWaitForWindowExposed(&window2));
window1.requestActivateWindow();
QTRY_COMPARE(app.focusWindow(), &window1);
@ -259,7 +259,7 @@ void tst_QGuiApplication::keyboardModifiers()
QWindow *window = new QWindow;
window->show();
QTest::qWaitForWindowShown(window);
QVERIFY(QTest::qWaitForWindowExposed(window));
QCOMPARE(QGuiApplication::keyboardModifiers(), Qt::NoModifier);
// mouse events
@ -378,8 +378,8 @@ void tst_QGuiApplication::modalWindow()
// show the 2 windows, nothing is blocked
window1->show();
window2->show();
QTest::qWaitForWindowShown(window1);
QTest::qWaitForWindowShown(window2);
QVERIFY(QTest::qWaitForWindowExposed(window1));
QVERIFY(QTest::qWaitForWindowExposed(window2));
QCOMPARE(app.modalWindow(), static_cast<QWindow *>(0));
QCOMPARE(window1->blocked, 0);
QCOMPARE(window2->blocked, 0);

View File

@ -313,7 +313,7 @@ void tst_qinputmethod::inputMethodAccepted()
DummyWindow window;
window.show();
QTest::qWaitForWindowShown(&window);
QVERIFY(QTest::qWaitForWindowExposed(&window));
window.requestActivateWindow();
QTRY_COMPARE(qApp->focusWindow(), &window);
window.setFocusObject(&disabledItem);

View File

@ -1503,7 +1503,7 @@ void tst_QTouchEvent::testQGuiAppDelivery()
QWindow *w = new QWindow;
w->setGeometry(100, 100, 100, 100);
w->show();
QTest::qWaitForWindowShown(w);
QVERIFY(QTest::qWaitForWindowExposed(w));
WindowTouchEventFilter filter;
w->installEventFilter(&filter);
@ -1563,7 +1563,7 @@ void tst_QTouchEvent::testMultiDevice()
QWindow *w = new QWindow;
w->setGeometry(100, 100, 100, 100);
w->show();
QTest::qWaitForWindowShown(w);
QVERIFY(QTest::qWaitForWindowExposed(w));
WindowTouchEventFilter filter;
w->installEventFilter(&filter);

View File

@ -420,7 +420,7 @@ void tst_QWindow::testInputEvents()
InputTestWindow window;
window.setGeometry(80, 80, 40, 40);
window.show();
QTest::qWaitForWindowShown(&window);
QVERIFY(QTest::qWaitForWindowExposed(&window));
QWindowSystemInterface::handleKeyEvent(&window, QEvent::KeyPress, Qt::Key_A, Qt::NoModifier);
QWindowSystemInterface::handleKeyEvent(&window, QEvent::KeyRelease, Qt::Key_A, Qt::NoModifier);
@ -478,7 +478,7 @@ void tst_QWindow::touchToMouseTranslation()
window.ignoreTouch = true;
window.setGeometry(80, 80, 40, 40);
window.show();
QTest::qWaitForWindowShown(&window);
QVERIFY(QTest::qWaitForWindowExposed(&window));
QList<QWindowSystemInterface::TouchPoint> points;
QWindowSystemInterface::TouchPoint tp1, tp2;
@ -554,7 +554,7 @@ void tst_QWindow::mouseToTouchTranslation()
window.ignoreMouse = true;
window.setGeometry(80, 80, 40, 40);
window.show();
QTest::qWaitForWindowShown(&window);
QVERIFY(QTest::qWaitForWindowExposed(&window));
QWindowSystemInterface::handleMouseEvent(&window, QPoint(10, 10), window.mapToGlobal(QPoint(10, 10)), Qt::LeftButton);
QWindowSystemInterface::handleMouseEvent(&window, QPoint(10, 10), window.mapToGlobal(QPoint(10, 10)), Qt::NoButton);
@ -603,7 +603,7 @@ void tst_QWindow::mouseToTouchLoop()
window.ignoreTouch = true;
window.setGeometry(80, 80, 40, 40);
window.show();
QTest::qWaitForWindowShown(&window);
QVERIFY(QTest::qWaitForWindowExposed(&window));
QWindowSystemInterface::handleMouseEvent(&window, QPoint(10, 10), window.mapToGlobal(QPoint(10, 10)), Qt::LeftButton);
QWindowSystemInterface::handleMouseEvent(&window, QPoint(10, 10), window.mapToGlobal(QPoint(10, 10)), Qt::NoButton);
@ -618,7 +618,7 @@ void tst_QWindow::touchCancel()
InputTestWindow window;
window.setGeometry(80, 80, 40, 40);
window.show();
QTest::qWaitForWindowShown(&window);
QVERIFY(QTest::qWaitForWindowExposed(&window));
QList<QWindowSystemInterface::TouchPoint> points;
QWindowSystemInterface::TouchPoint tp1;
@ -678,7 +678,7 @@ void tst_QWindow::touchCancelWithTouchToMouse()
window.ignoreTouch = true;
window.setGeometry(80, 80, 40, 40);
window.show();
QTest::qWaitForWindowShown(&window);
QVERIFY(QTest::qWaitForWindowExposed(&window));
QList<QWindowSystemInterface::TouchPoint> points;
QWindowSystemInterface::TouchPoint tp1;
@ -757,9 +757,9 @@ void tst_QWindow::activateAndClose()
for (int i = 0; i < 10; ++i) {
QWindow window;
window.show();
QTest::qWaitForWindowShown(&window);
window.requestActivateWindow();
QTRY_COMPARE(qGuiApp->focusWindow(), &window);
QVERIFY(QTest::qWaitForWindowActive(&window));
QCOMPARE(qGuiApp->focusWindow(), &window);
}
}
@ -770,7 +770,7 @@ void tst_QWindow::mouseEventSequence()
InputTestWindow window;
window.setGeometry(80, 80, 40, 40);
window.show();
QTest::qWaitForWindowShown(&window);
QVERIFY(QTest::qWaitForWindowExposed(&window));
ulong timestamp = 0;
QPointF local(12, 34);
@ -892,7 +892,7 @@ void tst_QWindow::inputReentrancy()
window.setGeometry(80, 80, 40, 40);
window.show();
QTest::qWaitForWindowShown(&window);
QVERIFY(QTest::qWaitForWindowExposed(&window));
// Queue three events.
QPointF local(12, 34);

View File

@ -1078,7 +1078,7 @@ void tst_QGraphicsScene::addItem()
CustomView view;
view.setScene(&scene);
view.show();
QTest::qWaitForWindowShown(view.windowHandle());
QVERIFY(QTest::qWaitForWindowExposed(&view));
qApp->processEvents();
view.repaints = 0;
@ -1606,10 +1606,9 @@ void tst_QGraphicsScene::hoverEvents_siblings()
view.rotate(10);
view.scale(1.7, 1.7);
view.show();
QTest::qWaitForWindowShown(view.windowHandle());
qApp->setActiveWindow(&view);
view.activateWindow();
QTest::qWait(70);
QVERIFY(QTest::qWaitForWindowActive(&view));
QCursor::setPos(view.mapToGlobal(QPoint(-5, -5)));
@ -2737,8 +2736,8 @@ void tst_QGraphicsScene::contextMenuEvent()
QGraphicsView view(&scene);
view.show();
QTest::qWaitForWindowShown(view.windowHandle());
view.activateWindow();
QVERIFY(QTest::qWaitForWindowActive(&view));
view.centerOn(item);
{
@ -2771,7 +2770,7 @@ void tst_QGraphicsScene::contextMenuEvent_ItemIgnoresTransformations()
QGraphicsView view(&scene, &topLevel);
view.resize(200, 200);
topLevel.show();
QTest::qWaitForWindowShown(topLevel.windowHandle());
QVERIFY(QTest::qWaitForWindowExposed(&topLevel));
{
QPoint pos(50, 50);

View File

@ -1645,8 +1645,7 @@ void tst_QWidget::setTabOrder()
container.show();
container.activateWindow();
qApp->setActiveWindow(&container);
QTest::qWaitForWindowShown(container.windowHandle());
QTest::qWait(100);
QVERIFY(QTest::qWaitForWindowActive(&container));
QTRY_VERIFY(lastEdit->hasFocus());
container.tab();
@ -3085,7 +3084,7 @@ void tst_QWidget::restoreVersion1Geometry()
widgetToSave.move(expectedPosition);
widgetToSave.resize(expectedSize);
widgetToSave.show();
QTest::qWaitForWindowShown(widget.windowHandle());
QVERIFY(QTest::qWaitForWindowExposed(&widget));
QTest::qWait(500); // stabilize
widgetToSave.setWindowState(Qt::WindowStates(expectedWindowState));
QTest::qWait(500); // stabilize
@ -4768,7 +4767,7 @@ void tst_QWidget::popupEnterLeave()
parent.show();
QTest::qWaitForWindowShown(parent.windowHandle());
QVERIFY(QTest::qWaitForWindowExposed(&parent));
QWindowSystemInterface::handleMouseEvent(parent.windowHandle(), QPointF(5, 5), QPointF(), Qt::LeftButton, Qt::NoModifier);
QTest::qWait(100);
@ -4788,7 +4787,7 @@ void tst_QWidget::popupEnterLeave()
popup.show();
QTest::qWaitForWindowShown(popup.windowHandle());
QVERIFY(QTest::qWaitForWindowExposed(&popup));
QTest::qWait(100);
@ -5491,7 +5490,7 @@ void tst_QWidget::minAndMaxSizeWithX11BypassWindowManagerHint()
QCOMPARE(widget.size(), newMaximumSize);
widget.show();
QTest::qWaitForWindowShown(widget.windowHandle());
QVERIFY(QTest::qWaitForWindowExposed(&widget));
QCOMPARE(widget.size(), newMaximumSize);
}
@ -5503,7 +5502,7 @@ void tst_QWidget::minAndMaxSizeWithX11BypassWindowManagerHint()
QCOMPARE(widget.size(), newMinimumSize);
widget.show();
QTest::qWaitForWindowShown(widget.windowHandle());
QVERIFY(QTest::qWaitForWindowExposed(&widget));
QCOMPARE(widget.size(), newMinimumSize);
}
}
@ -6909,7 +6908,7 @@ void tst_QWidget::moveWindowInShowEvent()
// show it
widget.show();
QTest::qWaitForWindowShown(widget.windowHandle());
QVERIFY(QTest::qWaitForWindowShown(&widget));
QTest::qWait(100);
// it should have moved
QCOMPARE(widget.pos(), position);
@ -7052,7 +7051,7 @@ void tst_QWidget::alienWidgets()
QWidget greatGrandChild(&grandChild);
parent.show();
QTest::qWaitForWindowShown(parent.windowHandle());
QVERIFY(QTest::qWaitForWindowExposed(&parent));
// Verify that the WA_WState_Created attribute is set
// and the top-level is the only native window.
@ -7501,7 +7500,7 @@ void tst_QWidget::sendUpdateRequestImmediately()
UpdateWidget updateWidget;
updateWidget.show();
QTest::qWaitForWindowShown(updateWidget.windowHandle());
QVERIFY(QTest::qWaitForWindowExposed(&updateWidget));
qApp->processEvents();
updateWidget.reset();
@ -7586,7 +7585,7 @@ void tst_QWidget::opaqueChildren()
greatGrandChild.setAutoFillBackground(true); // Opaque child widget.
widget.show();
QTest::qWaitForWindowShown(widget.windowHandle());
QVERIFY(QTest::qWaitForWindowExposed(&widget));
QTest::qWait(100);
// Child, grandChild and greatGrandChild are outside the ancestor clip.
@ -7740,7 +7739,7 @@ void tst_QWidget::immediateRepaintAfterInvalidateBuffer()
QWidget *widget = new UpdateWidget;
widget->show();
QTest::qWaitForWindowShown(widget->windowHandle());
QVERIFY(QTest::qWaitForWindowExposed(widget));
QTest::qWait(200);
static_cast<UpdateWidget *>(widget)->numPaintEvents = 0;
@ -8097,7 +8096,7 @@ void tst_QWidget::translucentWidget()
const QPoint labelPos = qApp->desktop()->availableGeometry().topLeft();
label.move(labelPos);
label.show();
QTest::qWaitForWindowShown(label.windowHandle());
QVERIFY(QTest::qWaitForWindowExposed(&label));
QTest::qWait(200);
QPixmap widgetSnapshot;
@ -8484,7 +8483,7 @@ void tst_QWidget::syntheticEnterLeave()
window.show();
window.raise();
QTest::qWaitForWindowShown(window.windowHandle());
QVERIFY(QTest::qWaitForWindowExposed(&window));
QTest::qWait(300);
#define RESET_EVENT_COUNTS \
@ -8587,7 +8586,7 @@ void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave()
SELChild child(&parent);
child.resize(200, 200);
parent.show();
QTest::qWaitForWindowShown(parent.windowHandle());
QVERIFY(QTest::qWaitForWindowExposed(&parent));
QTest::qWait(150);
QCursor::setPos(child.mapToGlobal(QPoint(100, 100)));
@ -8689,7 +8688,7 @@ void tst_QWidget::updateOnDestroyedSignal()
child->setPalette(Qt::red);
widget.show();
QTest::qWaitForWindowShown(widget.windowHandle());
QVERIFY(QTest::qWaitForWindowExposed(&widget));
QTest::qWait(200);
// Please do not crash.