Skip to content

Commit d5a4766

Browse files
author
hekra
committed
cleanup code
1 parent eb799e6 commit d5a4766

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/webdriver/extension_qt/qml_view_util.cc

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,9 @@ QQmlEngine* QQmlViewUtil::getQMLEngine(QQuickWindow* qquickWindow) {
112112
if (pView != NULL)
113113
return pView->engine();
114114

115-
QQuickWindow* pWin = qobject_cast<QQuickWindow*>(qquickWindow);
116-
117-
if (pView != NULL) {
118-
QQuickItem* item = pWin->contentItem();
119-
return QQmlEngine::contextForObject(item)->engine();
120-
}
115+
QQmlContext *rootContext = QQmlEngine::contextForObject(qquickWindow->contentItem());
121116

122-
return NULL;
117+
return rootContext->engine();
123118
}
124119

125120
void QQmlViewUtil::setSource(const Logger& logger, const QUrl &url, bool sync, QQuickWindow* qquickWindow) {

0 commit comments

Comments
 (0)