summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp19
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp11
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp67
-rw-r--r--tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp31
-rw-r--r--tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp24
-rw-r--r--tests/auto/qgraphicsview/tst_qgraphicsview.cpp24
-rw-r--r--tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp17
7 files changed, 164 insertions, 29 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 86c60be..e553517 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -1026,8 +1026,12 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent)
dirtySceneTransform = 1;
// Restore the sub focus chain.
- if (lastSubFocusItem)
- lastSubFocusItem->d_ptr->setSubFocus();
+ if (lastSubFocusItem) {
+ if (parent && parent->isActive())
+ lastSubFocusItem->setFocus();
+ else
+ lastSubFocusItem->d_ptr->setSubFocus();
+ }
// Deliver post-change notification
q->itemChange(QGraphicsItem::ItemParentHasChanged, newParentVariant);
@@ -2746,7 +2750,7 @@ void QGraphicsItem::setFocus(Qt::FocusReason focusReason)
// Update the scene's focus item.
if (d_ptr->scene) {
QGraphicsItem *p = panel();
- if (!p || p->isActive()) {
+ if ((!p && d_ptr->scene->isActive()) || p->isActive()) {
// Visible items immediately gain focus from scene.
d_ptr->scene->d_func()->setFocusItemHelper(f, focusReason);
}
@@ -4850,13 +4854,16 @@ void QGraphicsItemPrivate::ensureSceneTransform()
*/
void QGraphicsItemPrivate::setSubFocus()
{
- // Update focus child chain.
+ // Update focus child chain. Stop at panels, or if this item
+ // is hidden, stop at the first item with a visible parent.
QGraphicsItem *item = q_ptr;
QGraphicsItem *parent = item;
- bool hidden = !visible;
do {
parent->d_func()->subFocusItem = item;
- } while (!parent->isPanel() && (parent = parent->d_ptr->parent) && (!hidden || !parent->d_func()->visible));
+ } while (!parent->isPanel() && (parent = parent->d_ptr->parent) && (visible || !parent->d_ptr->visible));
+
+ if (!parent && scene && !scene->isActive())
+ scene->d_func()->lastFocusItem = q_ptr;
}
/*!
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index b09c5f4..43f2932 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -665,9 +665,14 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item,
QInputMethodEvent imEvent;
sendEvent(lastFocusItem, &imEvent);
- // Close any external input method panel
- for (int i = 0; i < views.size(); ++i)
- views.at(i)->inputContext()->reset();
+ // Close any external input method panel. This happens
+ // automatically by removing WA_InputMethodEnabled on
+ // the views, but if we are changing focus, we have to
+ // do it ourselves.
+ if (item) {
+ for (int i = 0; i < views.size(); ++i)
+ views.at(i)->inputContext()->reset();
+ }
}
}
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index cefff80..65837ae 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -704,6 +704,9 @@ void tst_QGraphicsItem::flags()
QCOMPARE(item->flags(), 0);
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
scene.addItem(item);
{
@@ -888,6 +891,9 @@ void tst_QGraphicsItem::visible()
QVERIFY(item->isVisible());
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
scene.addItem(item);
QVERIFY(item->isVisible());
QCOMPARE(scene.itemAt(0, 0), item);
@@ -1035,6 +1041,9 @@ void tst_QGraphicsItem::enabled()
item->setEnabled(false);
item->setFlag(QGraphicsItem::ItemIsFocusable);
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
scene.addItem(item);
item->setFocus();
QVERIFY(!item->hasFocus());
@@ -1714,6 +1723,9 @@ void tst_QGraphicsItem::hasFocus()
QVERIFY(!line->hasFocus());
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
scene.addItem(line);
line->setFocus();
@@ -1723,6 +1735,8 @@ void tst_QGraphicsItem::hasFocus()
QVERIFY(line->hasFocus());
QGraphicsScene scene2;
+ QApplication::sendEvent(&scene2, &activate);
+
scene2.addItem(line);
QVERIFY(!line->hasFocus());
@@ -3493,6 +3507,9 @@ void tst_QGraphicsItem::handlesChildEvents2()
void tst_QGraphicsItem::handlesChildEvents3()
{
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
ChildEventTester *group2 = new ChildEventTester(QRectF(), 0);
ChildEventTester *group1 = new ChildEventTester(QRectF(), group2);
ChildEventTester *leaf = new ChildEventTester(QRectF(), group1);
@@ -4466,8 +4483,13 @@ protected:
void tst_QGraphicsItem::sceneEventFilter()
{
QGraphicsScene scene;
+
QGraphicsView view(&scene);
view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QTest::qWait(250);
QGraphicsTextItem *text1 = scene.addText(QLatin1String("Text1"));
QGraphicsTextItem *text2 = scene.addText(QLatin1String("Text2"));
@@ -4584,8 +4606,10 @@ void tst_QGraphicsItem::paint()
QGraphicsView view(&scene);
view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
QTest::qWait(250);
-
#ifdef Q_OS_WIN32
//we try to switch the desktop: if it fails, we skip the test
if (::SwitchDesktop( ::GetThreadDesktop( ::GetCurrentThreadId() ) ) == 0) {
@@ -4593,8 +4617,7 @@ void tst_QGraphicsItem::paint()
}
#endif
- QVERIFY(paintTester.widget == view.viewport());
-
+ QCOMPARE(paintTester.widget, view.viewport());
view.hide();
@@ -5599,6 +5622,9 @@ void tst_QGraphicsItem::task240400_clickOnTextItem()
QFETCH(int, textFlags);
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
QGraphicsTextItem *item = scene.addText("Hello");
item->setFlags(QGraphicsItem::GraphicsItemFlags(flags));
item->setTextInteractionFlags(Qt::TextInteractionFlags(textFlags));
@@ -6434,6 +6460,7 @@ void tst_QGraphicsItem::tabChangesFocus()
QDial *dial1 = new QDial;
QGraphicsView *view = new QGraphicsView(&scene);
+
QDial *dial2 = new QDial;
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(dial1);
@@ -6446,6 +6473,8 @@ void tst_QGraphicsItem::tabChangesFocus()
#ifdef Q_WS_X11
qt_x11_wait_for_window_manager(&widget);
#endif
+ QTest::qWait(250);
+ QVERIFY(scene.isActive());
dial1->setFocus();
QTest::qWait(125);
@@ -7472,6 +7501,9 @@ void tst_QGraphicsItem::hitTestGraphicsEffectItem()
void tst_QGraphicsItem::focusProxy()
{
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
QGraphicsItem *item = scene.addRect(0, 0, 10, 10);
item->setFlag(QGraphicsItem::ItemIsFocusable);
QVERIFY(!item->focusProxy());
@@ -7570,6 +7602,9 @@ void tst_QGraphicsItem::subFocus()
// Add both items to a scene and check that it's text that
// got input focus.
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
scene.addItem(text);
scene.addItem(text2);
QVERIFY(text->hasFocus());
@@ -7578,18 +7613,15 @@ void tst_QGraphicsItem::subFocus()
text2->setData(0, "text2");
// Remove text2 and set subfocus on it. Then readd. Reparent it onto the
- // other item and see that although it becomes text's focus
- // item, it does not immediately gain input focus.
+ // other item and see that it gains input focus.
scene.removeItem(text2);
text2->setFocus();
scene.addItem(text2);
QCOMPARE(text2->focusItem(), (QGraphicsItem *)text2);
text2->setParentItem(text);
- qDebug() << text->data(0).toString() << (void*)(QGraphicsItem *)text;
- qDebug() << text2->data(0).toString() << (void*)(QGraphicsItem *)text2;
QCOMPARE(text->focusItem(), (QGraphicsItem *)text2);
- QVERIFY(text->hasFocus());
- QVERIFY(!text2->hasFocus());
+ QVERIFY(!text->hasFocus());
+ QVERIFY(text2->hasFocus());
// Remove both items from the scene, restore subfocus and
// readd them. Now the subfocus should kick in and give
@@ -7605,6 +7637,23 @@ void tst_QGraphicsItem::subFocus()
// Hiding and showing text should pass focus to text2.
QCOMPARE(text->focusItem(), (QGraphicsItem *)text2);
QVERIFY(text2->hasFocus());
+
+ // Subfocus should repropagate to root when reparenting.
+ QGraphicsRectItem *rect = new QGraphicsRectItem;
+ QGraphicsRectItem *rect2 = new QGraphicsRectItem(rect);
+ QGraphicsRectItem *rect3 = new QGraphicsRectItem(rect2);
+ rect3->setFlag(QGraphicsItem::ItemIsFocusable);
+
+ rect3->setFocus();
+ QVERIFY(!rect3->hasFocus());
+ QCOMPARE(rect->focusItem(), (QGraphicsItem *)rect3);
+ QCOMPARE(rect2->focusItem(), (QGraphicsItem *)rect3);
+ QCOMPARE(rect3->focusItem(), (QGraphicsItem *)rect3);
+ rect->setParentItem(text2);
+ QCOMPARE(text->focusItem(), (QGraphicsItem *)rect3);
+ QVERIFY(!rect->hasFocus());
+ QVERIFY(!rect2->hasFocus());
+ QVERIFY(rect3->hasFocus());
}
void tst_QGraphicsItem::focusProxyDeletion()
diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
index 9249f6d..1ee8e51 100644
--- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
+++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
@@ -554,6 +554,9 @@ void tst_QGraphicsProxyWidget::eventFilter()
QFETCH(bool, fromObject);
QGraphicsScene scene;
+ QEvent windowActivate(QEvent::WindowActivate);
+ qApp->sendEvent(&scene, &windowActivate);
+
SubQGraphicsProxyWidget *proxy = new SubQGraphicsProxyWidget;
scene.addItem(proxy);
@@ -682,18 +685,18 @@ void tst_QGraphicsProxyWidget::focusInEvent_data()
// protected void focusInEvent(QFocusEvent* event)
void tst_QGraphicsProxyWidget::focusInEvent()
{
+ // ### This test is just plain old broken
QFETCH(bool, widgetHasFocus);
QFETCH(bool, widgetCanHaveFocus);
- QGraphicsView view;
- QGraphicsScene scene(&view);
+ QGraphicsScene scene;
+ QEvent windowActivate(QEvent::WindowActivate);
+ qApp->sendEvent(&scene, &windowActivate);
+
SubQGraphicsProxyWidget *proxy = new SubQGraphicsProxyWidget;
proxy->setEnabled(true);
scene.addItem(proxy);
proxy->setVisible(true);
- view.show();
- QApplication::setActiveWindow(&view);
- view.activateWindow();
QWidget *widget = new QWidget;
widget->resize(100, 100);
@@ -706,7 +709,11 @@ void tst_QGraphicsProxyWidget::focusInEvent()
proxy->setWidget(widget);
proxy->setFlag(QGraphicsItem::ItemIsFocusable, true); // <- shouldn't need to do this
- QTRY_VERIFY(widget->isVisible() && view.isVisible());
+
+ // ### This test is just plain old broken - sending a focus in event
+ // does not cause items to gain input focus. The widget has focus
+ // because the proxy has focus, not because it got this event.
+
QFocusEvent event(QEvent::FocusIn, Qt::TabFocusReason);
event.ignore();
proxy->call_focusInEvent(&event);
@@ -776,6 +783,10 @@ void tst_QGraphicsProxyWidget::focusNextPrevChild()
QGraphicsScene scene;
QGraphicsView view(&scene);
view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QTest::qWait(250);
if (hasScene) {
scene.addItem(proxy);
proxy->show();
@@ -819,6 +830,9 @@ void tst_QGraphicsProxyWidget::focusOutEvent()
SubQGraphicsProxyWidget *proxy = new SubQGraphicsProxyWidget;
scene.addItem(proxy);
view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
QApplication::setActiveWindow(&view);
view.activateWindow();
view.setFocus();
@@ -1084,6 +1098,7 @@ void tst_QGraphicsProxyWidget::keyPressEvent()
#ifdef Q_WS_X11
qt_x11_wait_for_window_manager(&view);
#endif
+ QTest::qWait(250);
SubQGraphicsProxyWidget *proxy = new SubQGraphicsProxyWidget;
proxy->setFlag(QGraphicsItem::ItemIsFocusable, true); // ### remove me!!!
@@ -1122,6 +1137,10 @@ void tst_QGraphicsProxyWidget::keyReleaseEvent()
QGraphicsScene scene;
QGraphicsView view(&scene);
view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QTest::qWait(250);
SubQGraphicsProxyWidget *proxy = new SubQGraphicsProxyWidget;
proxy->setFlag(QGraphicsItem::ItemIsFocusable, true); // ### remove me!!!
diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
index f78c59e..6998684 100644
--- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -1376,6 +1376,9 @@ void tst_QGraphicsScene::removeItem()
void tst_QGraphicsScene::focusItem()
{
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
QVERIFY(!scene.focusItem());
QGraphicsItem *item = scene.addText("Qt");
QVERIFY(!scene.focusItem());
@@ -1434,6 +1437,9 @@ protected:
void tst_QGraphicsScene::focusItemLostFocus()
{
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
FocusItem *item = new FocusItem;
item->setTextInteractionFlags(Qt::TextEditorInteraction);
scene.addItem(item);
@@ -1458,6 +1464,9 @@ void tst_QGraphicsScene::clear()
void tst_QGraphicsScene::setFocusItem()
{
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
QGraphicsItem *item = scene.addText("Qt");
QVERIFY(!scene.focusItem());
QVERIFY(!scene.hasFocus());
@@ -1885,6 +1894,9 @@ void tst_QGraphicsScene::mouseEventPropagation()
// scene -> a -> b -> c -> d
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
scene.addItem(a);
// Prepare some events
@@ -2069,6 +2081,9 @@ void tst_QGraphicsScene::mouseEventPropagation_focus()
// scene -> a -> b -> c -> d
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
scene.addItem(a);
// Prepare some events
@@ -2680,6 +2695,9 @@ void tst_QGraphicsScene::render()
void tst_QGraphicsScene::contextMenuEvent()
{
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
EventTester *item = new EventTester;
scene.addItem(item);
item->setFlag(QGraphicsItem::ItemIsFocusable);
@@ -3649,6 +3667,9 @@ void tst_QGraphicsScene::stickyFocus()
QFETCH(bool, sticky);
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
QGraphicsTextItem *text = scene.addText("Hei");
text->setTextInteractionFlags(Qt::TextEditorInteraction);
text->setFocus();
@@ -3703,6 +3724,9 @@ void tst_QGraphicsScene::inputMethod()
item->setFlags((QGraphicsItem::GraphicsItemFlags)flags);
QGraphicsScene scene;
+ QEvent activate(QEvent::WindowActivate);
+ QApplication::sendEvent(&scene, &activate);
+
scene.addItem(item);
QInputMethodEvent event;
diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
index bb0ea70..0b731d5 100644
--- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
@@ -1938,6 +1938,7 @@ void tst_QGraphicsView::wheelEvent()
#ifdef Q_WS_X11
qt_x11_wait_for_window_manager(&view);
#endif
+ QTest::qWait(250);
// Send a wheel event with horizontal orientation.
{
@@ -2941,10 +2942,10 @@ void tst_QGraphicsView::task239729_noViewUpdate()
}
view->show();
- QTest::qWait(250);
#ifdef Q_WS_X11
qt_x11_wait_for_window_manager(view);
#endif
+ QTest::qWait(250);
EventSpy spy(view->viewport(), QEvent::Paint);
QCOMPARE(spy.count(), 0);
@@ -3418,7 +3419,7 @@ void tst_QGraphicsView::exposeRegion()
QRegion expectedExposeRegion = QRect(0, 0, 5, 5);
expectedExposeRegion += QRect(viewport->rect().bottomRight() - QPoint(5, 5), QSize(5, 5));
viewport->update(expectedExposeRegion);
- qApp->processEvents();
+ QTest::qWait(125);
// Make sure it triggers correct repaint on the view.
QCOMPARE(view.lastUpdateRegions.size(), 1);
@@ -3488,7 +3489,7 @@ void tst_QGraphicsView::update()
viewPrivate->processPendingUpdates();
QVERIFY(viewPrivate->dirtyRegion.isEmpty());
QVERIFY(viewPrivate->dirtyBoundingRect.isEmpty());
- QTest::qWait(50);
+ QTest::qWait(150);
if (!intersects) {
QVERIFY(view.lastUpdateRegions.isEmpty());
} else {
@@ -3504,6 +3505,11 @@ void tst_QGraphicsView::inputMethodSensitivity()
{
QGraphicsScene scene;
QGraphicsView view(&scene);
+ view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QTest::qWait(300);
QGraphicsRectItem *item = new QGraphicsRectItem;
@@ -3571,11 +3577,12 @@ void tst_QGraphicsView::inputMethodSensitivity()
class InputContextTester : public QInputContext
{
+ Q_OBJECT
+public:
QString identifierName() { return QString(); }
bool isComposing() const { return false; }
QString language() { return QString(); }
void reset() { ++resets; }
-public:
int resets;
};
@@ -3583,10 +3590,17 @@ void tst_QGraphicsView::inputContextReset()
{
QGraphicsScene scene;
QGraphicsView view(&scene);
+ QVERIFY(view.testAttribute(Qt::WA_InputMethodEnabled));
InputContextTester inputContext;
view.setInputContext(&inputContext);
+ view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QTest::qWait(300);
+
QGraphicsItem *item1 = new QGraphicsRectItem;
item1->setFlags(QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemAcceptsInputMethod);
@@ -3596,6 +3610,8 @@ void tst_QGraphicsView::inputContextReset()
inputContext.resets = 0;
scene.setFocusItem(item1);
+ QCOMPARE(scene.focusItem(), (QGraphicsItem *)item1);
+ QVERIFY(view.testAttribute(Qt::WA_InputMethodEnabled));
QCOMPARE(inputContext.resets, 0);
inputContext.resets = 0;
diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
index 20803a5..5296788 100644
--- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -438,6 +438,8 @@ void tst_QGraphicsWidget::focusWidget()
SubQGraphicsWidget *parent = new SubQGraphicsWidget;
QCOMPARE(parent->focusWidget(), (QGraphicsWidget *)0);
QGraphicsScene scene;
+ QEvent windowActivate(QEvent::WindowActivate);
+ qApp->sendEvent(&scene, &windowActivate);
scene.addItem(parent);
QFETCH(int, childCount);
@@ -459,7 +461,9 @@ void tst_QGraphicsWidget::focusWidget()
void tst_QGraphicsWidget::focusWidget2()
{
QGraphicsScene scene;
-
+ QEvent windowActivate(QEvent::WindowActivate);
+ qApp->sendEvent(&scene, &windowActivate);
+
QGraphicsWidget *widget = new QGraphicsWidget;
EventSpy focusInSpy(widget, QEvent::FocusIn);
EventSpy focusOutSpy(widget, QEvent::FocusOut);
@@ -561,6 +565,9 @@ void tst_QGraphicsWidget::focusPolicy_data()
void tst_QGraphicsWidget::focusPolicy()
{
QGraphicsScene scene;
+ QEvent windowActivate(QEvent::WindowActivate);
+ qApp->sendEvent(&scene, &windowActivate);
+
SubQGraphicsWidget *widget = new SubQGraphicsWidget;
scene.addItem(widget);
QCOMPARE(Qt::NoFocus, widget->focusPolicy());
@@ -788,6 +795,12 @@ void tst_QGraphicsWidget::initStyleOption()
{
QGraphicsScene scene;
QGraphicsView view(&scene);
+ view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QTest::qWait(250);
+
view.setAlignment(Qt::AlignTop | Qt::AlignLeft);
SubQGraphicsWidget *widget = new SubQGraphicsWidget;
widget->setAcceptsHoverEvents(true);
@@ -1183,6 +1196,8 @@ void tst_QGraphicsWidget::setTabOrderAndReparent()
#ifdef Q_WS_X11
qt_x11_wait_for_window_manager(&view);
#endif
+ QTest::qWait(250);
+
int i;
QGraphicsWidget *w1, *w2, *w3, *w4;
for (i = 1; i < 4; ++i) {