本文整理汇总了C++中QQuickView::isTopLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ QQuickView::isTopLevel方法的具体用法?C++ QQuickView::isTopLevel怎么用?C++ QQuickView::isTopLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QQuickView
的用法示例。
在下文中一共展示了QQuickView::isTopLevel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: basic
void tst_qquickfocusscope::basic()
{
QQuickView *view = new QQuickView;
view->setSource(testFileUrl("test.qml"));
QQuickFocusScope *item0 = findItem<QQuickFocusScope>(view->rootObject(), QLatin1String("item0"));
QQuickRectangle *item1 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item1"));
QQuickRectangle *item2 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item2"));
QQuickRectangle *item3 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item3"));
QVERIFY(item0 != 0);
QVERIFY(item1 != 0);
QVERIFY(item2 != 0);
QVERIFY(item3 != 0);
view->show();
view->requestActivate();
QTest::qWaitForWindowActive(view);
QTRY_VERIFY(view == qGuiApp->focusWindow());
QVERIFY(view->isTopLevel());
QVERIFY(item0->hasActiveFocus() == true);
QVERIFY(item1->hasActiveFocus() == true);
QVERIFY(item2->hasActiveFocus() == false);
QVERIFY(item3->hasActiveFocus() == false);
QTest::keyClick(view, Qt::Key_Right);
QTest::qWait(50);
QVERIFY(item0->hasActiveFocus() == true);
QVERIFY(item1->hasActiveFocus() == false);
QVERIFY(item2->hasActiveFocus() == true);
QVERIFY(item3->hasActiveFocus() == false);
QTest::keyClick(view, Qt::Key_Down);
QTest::qWait(50);
QVERIFY(item0->hasActiveFocus() == false);
QVERIFY(item1->hasActiveFocus() == false);
QVERIFY(item2->hasActiveFocus() == false);
QVERIFY(item3->hasActiveFocus() == true);
delete view;
}