From f21e9ba6efa2b1c8169491db271f79b87b5b0ce4 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 7 Aug 2012 11:26:37 +1000 Subject: [PATCH] Remove interim compatibility measures Also update some variables in qtdeclarative which failed to update rootItem->contentItem. Change-Id: Id34e29546a22a74a7ae2ad90ee3a8def6fc541d3 Reviewed-by: Alan Alpert <416365416c@gmail.com> --- .../quick/scenegraph/openglunderqml/squircle.cpp | 6 +- .../accessible/quick/qaccessiblequickview.cpp | 4 +- .../qmltooling/qmldbg_qtquick2/highlight.cpp | 22 +++--- .../qmltooling/qmldbg_qtquick2/inspecttool.cpp | 58 +++++++-------- .../qmltooling/qmldbg_qtquick2/inspecttool.h | 2 +- .../qmldbg_qtquick2/qquickviewinspector.cpp | 6 +- src/qmltest/quicktestresult.cpp | 2 +- src/quick/items/items.pri | 1 - src/quick/items/qquickcanvas.h | 58 --------------- src/quick/items/qquickitem.h | 2 - src/quick/items/qquickmousearea.cpp | 2 +- src/quick/items/qquickview.cpp | 2 +- src/quick/items/qquickwindow.cpp | 84 +++++++++++----------- src/quick/items/qquickwindow.h | 2 - src/quick/items/qquickwindow_p.h | 4 +- tests/auto/quick/examples/tst_examples.cpp | 4 +- .../qquickapplication/tst_qquickapplication.cpp | 2 +- tests/auto/quick/qquickdrag/tst_qquickdrag.cpp | 36 +++++----- .../quick/qquickdroparea/tst_qquickdroparea.cpp | 18 ++--- .../qquickfocusscope/tst_qquickfocusscope.cpp | 2 +- tests/auto/quick/qquickitem/tst_qquickitem.cpp | 82 ++++++++++----------- .../quick/qquickitemlayer/tst_qquickitemlayer.cpp | 6 +- .../qquickpainteditem/tst_qquickpainteditem.cpp | 16 ++--- .../qquickpositioners/tst_qquickpositioners.cpp | 6 +- .../quick/qquicktextedit/tst_qquicktextedit.cpp | 12 ++-- .../quick/qquicktextinput/tst_qquicktextinput.cpp | 24 +++---- .../tst_qquickvisualdatamodel.cpp | 8 +-- tests/auto/quick/qquickwindow/tst_qquickwindow.cpp | 28 ++++---- 28 files changed, 218 insertions(+), 281 deletions(-) delete mode 100644 src/quick/items/qquickcanvas.h diff --git a/examples/quick/scenegraph/openglunderqml/squircle.cpp b/examples/quick/scenegraph/openglunderqml/squircle.cpp index 24e8533..867ce4a 100644 --- a/examples/quick/scenegraph/openglunderqml/squircle.cpp +++ b/examples/quick/scenegraph/openglunderqml/squircle.cpp @@ -59,8 +59,8 @@ void Squircle::setT(qreal t) return; m_t = t; emit tChanged(); - if (canvas()) - canvas()->update(); + if (window()) + window()->update(); } //! [8] @@ -113,7 +113,7 @@ void Squircle::paint() m_program->bindAttributeLocation("vertices", 0); m_program->link(); - connect(canvas()->openglContext(), SIGNAL(aboutToBeDestroyed()), + connect(window()->openglContext(), SIGNAL(aboutToBeDestroyed()), this, SLOT(cleanup()), Qt::DirectConnection); } //! [4] //! [5] diff --git a/src/plugins/accessible/quick/qaccessiblequickview.cpp b/src/plugins/accessible/quick/qaccessiblequickview.cpp index d7f2b94..764db83 100644 --- a/src/plugins/accessible/quick/qaccessiblequickview.cpp +++ b/src/plugins/accessible/quick/qaccessiblequickview.cpp @@ -60,7 +60,7 @@ QAccessibleQuickView::QAccessibleQuickView(QQuickView *object) int QAccessibleQuickView::childCount() const { - return view()->rootItem() ? 1 : 0; + return view()->contentItem() ? 1 : 0; } QAccessibleInterface *QAccessibleQuickView::parent() const @@ -155,7 +155,7 @@ static QQuickItem *childAt_helper(QQuickItem *item, int x, int y) QAccessibleInterface *QAccessibleQuickView::childAt(int x, int y) const { Q_ASSERT(view()); - QQuickItem *root = view()->rootItem(); + QQuickItem *root = view()->contentItem(); if (root) { if (QQuickItem *item = childAt_helper(root, x, y)) return QAccessible::queryAccessibleInterface(item); diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/highlight.cpp b/src/plugins/qmltooling/qmldbg_qtquick2/highlight.cpp index 3d31600..d6fc0b2 100644 --- a/src/plugins/qmltooling/qmldbg_qtquick2/highlight.cpp +++ b/src/plugins/qmltooling/qmldbg_qtquick2/highlight.cpp @@ -82,14 +82,14 @@ void Highlight::setItem(QQuickItem *item) SLOT(adjust())); } QQuickWindow *view = item->window(); - QQuickItem * rootItem = view->rootItem(); - if (rootItem) { - connect(rootItem, SIGNAL(xChanged()), SLOT(adjust())); - connect(rootItem, SIGNAL(yChanged()), SLOT(adjust())); - connect(rootItem, SIGNAL(widthChanged()), SLOT(adjust())); - connect(rootItem, SIGNAL(heightChanged()), SLOT(adjust())); - connect(rootItem, SIGNAL(rotationChanged()), SLOT(adjust())); - connect(rootItem, SIGNAL(transformOriginChanged(TransformOrigin)), + QQuickItem * contentItem = view->contentItem(); + if (contentItem) { + connect(contentItem, SIGNAL(xChanged()), SLOT(adjust())); + connect(contentItem, SIGNAL(yChanged()), SLOT(adjust())); + connect(contentItem, SIGNAL(widthChanged()), SLOT(adjust())); + connect(contentItem, SIGNAL(heightChanged()), SLOT(adjust())); + connect(contentItem, SIGNAL(rotationChanged()), SLOT(adjust())); + connect(contentItem, SIGNAL(transformOriginChanged(TransformOrigin)), SLOT(adjust())); } m_item = item; @@ -111,9 +111,9 @@ void Highlight::adjust() qreal scaleFactor = 1; QPointF originOffset = QPointF(0,0); QQuickWindow *view = m_item->window(); - if (view->rootItem()) { - scaleFactor = view->rootItem()->scale(); - originOffset -= view->rootItem()->pos(); + if (view->contentItem()) { + scaleFactor = view->contentItem()->scale(); + originOffset -= view->contentItem()->pos(); } // The scale transform for the overlay needs to be cancelled // as the Item's transform which will be applied to the painter diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp b/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp index 69b2dd4..8cd40b4 100644 --- a/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp +++ b/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp @@ -61,17 +61,17 @@ namespace QtQuick2 { InspectTool::InspectTool(QQuickViewInspector *inspector, QQuickView *view) : AbstractTool(inspector), - m_originalSmooth(view->rootItem()->smooth()), + m_originalSmooth(view->contentItem()->smooth()), m_dragStarted(false), m_pinchStarted(false), m_didPressAndHold(false), m_tapEvent(false), - m_rootItem(view->rootItem()), - m_originalPosition(view->rootItem()->pos()), + m_contentItem(view->contentItem()), + m_originalPosition(view->contentItem()->pos()), m_smoothScaleFactor(Constants::ZoomSnapDelta), m_minScale(0.125f), m_maxScale(48.0f), - m_originalScale(view->rootItem()->scale()), + m_originalScale(view->contentItem()->scale()), m_touchTimestamp(0), m_hoverHighlight(new HoverHighlight(inspector->overlay())), m_lastItem(0), @@ -98,17 +98,17 @@ void InspectTool::enable(bool enable) if (!enable) { inspector()->setSelectedItems(QList()); // restoring the original states. - if (m_rootItem) { - m_rootItem->setScale(m_originalScale); - m_rootItem->setPos(m_originalPosition); - m_rootItem->setSmooth(m_originalSmooth); + if (m_contentItem) { + m_contentItem->setScale(m_originalScale); + m_contentItem->setPos(m_originalPosition); + m_contentItem->setSmooth(m_originalSmooth); } } else { - if (m_rootItem) { - m_originalSmooth = m_rootItem->smooth(); - m_originalScale = m_rootItem->scale(); - m_originalPosition = m_rootItem->pos(); - m_rootItem->setSmooth(true); + if (m_contentItem) { + m_originalSmooth = m_contentItem->smooth(); + m_originalScale = m_contentItem->scale(); + m_originalPosition = m_contentItem->pos(); + m_contentItem->setSmooth(true); } } } @@ -174,8 +174,8 @@ void InspectTool::wheelEvent(QWheelEvent *event) Qt::KeyboardModifier smoothZoomModifier = Qt::ControlModifier; if (event->modifiers() & smoothZoomModifier) { int numDegrees = event->delta() / 8; - qreal newScale = m_rootItem->scale() + m_smoothScaleFactor * (numDegrees / 15.0f); - scaleView(newScale / m_rootItem->scale(), m_mousePosition, m_mousePosition); + qreal newScale = m_contentItem->scale() + m_smoothScaleFactor * (numDegrees / 15.0f); + scaleView(newScale / m_contentItem->scale(), m_mousePosition, m_mousePosition); } else if (!event->modifiers()) { if (event->delta() > 0) { zoomIn(); @@ -204,7 +204,7 @@ void InspectTool::keyReleaseEvent(QKeyEvent *event) case Qt::Key_8: case Qt::Key_9: { qreal newScale = ((event->key() - Qt::Key_0) * 1.0f); - scaleView(newScale / m_rootItem->scale(), m_mousePosition, m_mousePosition); + scaleView(newScale / m_contentItem->scale(), m_mousePosition, m_mousePosition); break; } default: @@ -283,34 +283,34 @@ void InspectTool::touchEvent(QTouchEvent *event) void InspectTool::scaleView(const qreal &factor, const QPointF &newcenter, const QPointF &oldcenter) { m_pressAndHoldTimer.stop(); - if (((m_rootItem->scale() * factor) > m_maxScale) - || ((m_rootItem->scale() * factor) < m_minScale)) { + if (((m_contentItem->scale() * factor) > m_maxScale) + || ((m_contentItem->scale() * factor) < m_minScale)) { return; } //New position = new center + scalefactor * (oldposition - oldcenter) - QPointF newPosition = newcenter + (factor * (m_rootItem->pos() - oldcenter)); - m_rootItem->setScale(m_rootItem->scale() * factor); - m_rootItem->setPos(newPosition); + QPointF newPosition = newcenter + (factor * (m_contentItem->pos() - oldcenter)); + m_contentItem->setScale(m_contentItem->scale() * factor); + m_contentItem->setPos(newPosition); } void InspectTool::zoomIn() { qreal newScale = nextZoomScale(ZoomIn); - scaleView(newScale / m_rootItem->scale(), m_mousePosition, m_mousePosition); + scaleView(newScale / m_contentItem->scale(), m_mousePosition, m_mousePosition); } void InspectTool::zoomOut() { qreal newScale = nextZoomScale(ZoomOut); - scaleView(newScale / m_rootItem->scale(), m_mousePosition, m_mousePosition); + scaleView(newScale / m_contentItem->scale(), m_mousePosition, m_mousePosition); } void InspectTool::zoomTo100() { m_didPressAndHold = true; - m_rootItem->setPos(QPointF(0, 0)); - m_rootItem->setScale(1.0); + m_contentItem->setPos(QPointF(0, 0)); + m_contentItem->setScale(1.0); } qreal InspectTool::nextZoomScale(ZoomDirection direction) @@ -338,13 +338,13 @@ qreal InspectTool::nextZoomScale(ZoomDirection direction) if (direction == ZoomIn) { for (int i = 0; i < zoomScales.length(); ++i) { - if (zoomScales[i] > m_rootItem->scale()) + if (zoomScales[i] > m_contentItem->scale()) return zoomScales[i]; } return zoomScales.last(); } else { for (int i = zoomScales.length() - 1; i >= 0; --i) { - if (zoomScales[i] < m_rootItem->scale()) + if (zoomScales[i] < m_contentItem->scale()) return zoomScales[i]; } return zoomScales.first(); @@ -361,9 +361,9 @@ void InspectTool::initializeDrag(const QPointF &pos) void InspectTool::dragItemToPosition() { - QPointF newPosition = m_rootItem->pos() + m_mousePosition - m_dragStartPosition; + QPointF newPosition = m_contentItem->pos() + m_mousePosition - m_dragStartPosition; m_dragStartPosition = m_mousePosition; - m_rootItem->setPos(newPosition); + m_contentItem->setPos(newPosition); } void InspectTool::moveItem(bool valid) diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.h b/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.h index dabb41e..5c48069 100644 --- a/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.h +++ b/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.h @@ -108,7 +108,7 @@ private: bool m_pinchStarted; bool m_didPressAndHold; bool m_tapEvent; - QPointer m_rootItem; + QPointer m_contentItem; QPointF m_dragStartPosition; QPointF m_mousePosition; QPointF m_originalPosition; diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.cpp b/src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.cpp index 1cb2406..4f6ee51 100644 --- a/src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.cpp +++ b/src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.cpp @@ -128,7 +128,7 @@ QQuickViewInspector::QQuickViewInspector(QQuickView *view, QObject *parent) : // Try to make sure the overlay is always on top m_overlay->setZ(FLT_MAX); - if (QQuickItem *root = view->rootItem()) + if (QQuickItem *root = view->contentItem()) m_overlay->setParentItem(root); view->installEventFilter(this); @@ -190,13 +190,13 @@ QQmlEngine *QQuickViewInspector::declarativeEngine() const QQuickItem *QQuickViewInspector::topVisibleItemAt(const QPointF &pos) const { - QQuickItem *root = m_view->rootItem(); + QQuickItem *root = m_view->contentItem(); return itemAt(root, root->mapFromScene(pos), m_overlay); } QList QQuickViewInspector::itemsAt(const QPointF &pos) const { - QQuickItem *root = m_view->rootItem(); + QQuickItem *root = m_view->contentItem(); QList resultList; collectItemsAt(root, root->mapFromScene(pos), m_overlay, resultList); diff --git a/src/qmltest/quicktestresult.cpp b/src/qmltest/quicktestresult.cpp index 8a15062..4344fb6 100644 --- a/src/qmltest/quicktestresult.cpp +++ b/src/qmltest/quicktestresult.cpp @@ -579,7 +579,7 @@ bool QuickTestResult::waitForRendering(QQuickItem *item, int timeout) { Q_ASSERT(item); - return qWaitForSignal(item->canvas(), SIGNAL(frameSwapped()), timeout); + return qWaitForSignal(item->window(), SIGNAL(frameSwapped()), timeout); } void QuickTestResult::startMeasurement() diff --git a/src/quick/items/items.pri b/src/quick/items/items.pri index a737668..13abf7b 100644 --- a/src/quick/items/items.pri +++ b/src/quick/items/items.pri @@ -10,7 +10,6 @@ HEADERS += \ $$PWD/qquickrectangle_p_p.h \ $$PWD/qquickwindow.h \ $$PWD/qquickwindow_p.h \ - $$PWD/qquickcanvas.h \ $$PWD/qquickfocusscope_p.h \ $$PWD/qquickitemsmodule_p.h \ $$PWD/qquickpainteditem.h \ diff --git a/src/quick/items/qquickcanvas.h b/src/quick/items/qquickcanvas.h deleted file mode 100644 index 907cf30..0000000 --- a/src/quick/items/qquickcanvas.h +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKCANVAS_H -#define QQUICKCANVAS_H - -#include "qquickwindow.h" - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -typedef QQuickWindow QQuickCanvas; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QQUICKCANVAS_H - diff --git a/src/quick/items/qquickitem.h b/src/quick/items/qquickitem.h index 75a8a8e..fa6aa62 100644 --- a/src/quick/items/qquickitem.h +++ b/src/quick/items/qquickitem.h @@ -196,8 +196,6 @@ public: QQuickItem(QQuickItem *parent = 0); virtual ~QQuickItem(); - //canvas() is being removed in favor of window() really soon now - QQuickWindow *canvas() const { return window(); } QQuickWindow *window() const; QQuickItem *parentItem() const; void setParentItem(QQuickItem *parent); diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp index e4c821f..803840a 100644 --- a/src/quick/items/qquickmousearea.cpp +++ b/src/quick/items/qquickmousearea.cpp @@ -264,7 +264,7 @@ void QQuickMouseAreaPrivate::propagate(QQuickMouseEvent* event, PropagateType t) if (!propagateComposedEvents) return; QPointF scenePos = q->mapToScene(QPointF(event->x(), event->y())); - propagateHelper(event, window->rootItem(), scenePos, t); + propagateHelper(event, window->contentItem(), scenePos, t); } bool QQuickMouseAreaPrivate::propagateHelper(QQuickMouseEvent *ev, QQuickItem *item,const QPointF &sp, PropagateType sig) diff --git a/src/quick/items/qquickview.cpp b/src/quick/items/qquickview.cpp index f3610ea..7182e74 100644 --- a/src/quick/items/qquickview.cpp +++ b/src/quick/items/qquickview.cpp @@ -461,7 +461,7 @@ void QQuickViewPrivate::setRootObject(QObject *obj) return; if (QQuickItem *sgItem = qobject_cast(obj)) { root = sgItem; - sgItem->setParentItem(q->QQuickWindow::rootItem()); + sgItem->setParentItem(q->QQuickWindow::contentItem()); } else { qWarning() << "QQuickView only supports loading of root objects that derive from QQuickItem." << endl << endl diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 7cc645f..f1cfdf8 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -222,14 +222,14 @@ void QQuickWindow::hideEvent(QHideEvent *) void QQuickWindow::focusOutEvent(QFocusEvent *) { Q_D(QQuickWindow); - d->rootItem->setFocus(false); + d->contentItem->setFocus(false); } /*! \reimp */ void QQuickWindow::focusInEvent(QFocusEvent *) { Q_D(QQuickWindow); - d->rootItem->setFocus(true); + d->contentItem->setFocus(true); d->updateFocusItemTransform(); } @@ -309,10 +309,10 @@ void QQuickWindowPrivate::syncSceneGraph() emit q->beforeSynchronizing(); if (!renderer) { - forceUpdate(rootItem); + forceUpdate(contentItem); QSGRootNode *rootNode = new QSGRootNode; - rootNode->appendChildNode(QQuickItemPrivate::get(rootItem)->itemNode()); + rootNode->appendChildNode(QQuickItemPrivate::get(contentItem)->itemNode()); renderer = context->createRenderer(); renderer->setRootNode(rootNode); } @@ -348,7 +348,7 @@ void QQuickWindowPrivate::renderSceneGraph(const QSize &size) } QQuickWindowPrivate::QQuickWindowPrivate() - : rootItem(0) + : contentItem(0) , activeFocusItem(0) , mouseGrabberItem(0) #ifndef QT_NO_CURSOR @@ -382,18 +382,18 @@ void QQuickWindowPrivate::init(QQuickWindow *c) Q_Q(QQuickWindow); - rootItem = new QQuickRootItem; - QQmlEngine::setObjectOwnership(rootItem, QQmlEngine::CppOwnership); - QQuickItemPrivate *rootItemPrivate = QQuickItemPrivate::get(rootItem); - rootItemPrivate->window = q; - rootItemPrivate->windowRefCount = 1; - rootItemPrivate->flags |= QQuickItem::ItemIsFocusScope; + contentItem = new QQuickRootItem; + QQmlEngine::setObjectOwnership(contentItem, QQmlEngine::CppOwnership); + QQuickItemPrivate *contentItemPrivate = QQuickItemPrivate::get(contentItem); + contentItemPrivate->window = q; + contentItemPrivate->windowRefCount = 1; + contentItemPrivate->flags |= QQuickItem::ItemIsFocusScope; // In the absence of a focus in event on some platforms assume the window will - // be activated immediately and set focus on the rootItem + // be activated immediately and set focus on the contentItem // ### Remove when QTBUG-22415 is resolved. - //It is important that this call happens after the rootItem has a window.. - rootItem->setFocus(true); + //It is important that this call happens after the contentItem has a window.. + contentItem->setFocus(true); windowManager = QQuickWindowManager::instance(); context = windowManager->sceneGraphContext(); @@ -412,19 +412,19 @@ void QQuickWindowPrivate::init(QQuickWindow *c) QQmlListProperty QQuickWindowPrivate::data() { - initRootItem(); - return QQuickItemPrivate::get(rootItem)->data(); + initContentItem(); + return QQuickItemPrivate::get(contentItem)->data(); } -void QQuickWindowPrivate::initRootItem() +void QQuickWindowPrivate::initContentItem() { Q_Q(QQuickWindow); q->connect(q, SIGNAL(widthChanged(int)), - rootItem, SLOT(setWidth(int))); + contentItem, SLOT(setWidth(int))); q->connect(q, SIGNAL(heightChanged(int)), - rootItem, SLOT(setHeight(int))); - rootItem->setWidth(q->width()); - rootItem->setHeight(q->height()); + contentItem, SLOT(setHeight(int))); + contentItem->setWidth(q->width()); + contentItem->setHeight(q->height()); } static QMouseEvent *touchToMouseEvent(QEvent::Type type, const QTouchEvent::TouchPoint &p, QTouchEvent *event, QQuickItem *item, bool transformNeeded = true) @@ -527,7 +527,7 @@ bool QQuickWindowPrivate::translateTouchToMouse(QQuickItem *item, QTouchEvent *e lastMousePosition = me->windowPos(); bool accepted = me->isAccepted(); - bool delivered = deliverHoverEvent(rootItem, me->windowPos(), last, me->modifiers(), accepted); + bool delivered = deliverHoverEvent(contentItem, me->windowPos(), last, me->modifiers(), accepted); if (!delivered) { //take care of any exits accepted = clearHover(); @@ -594,7 +594,7 @@ void QQuickWindowPrivate::setFocusInScope(QQuickItem *scope, QQuickItem *item, F Q_Q(QQuickWindow); Q_ASSERT(item); - Q_ASSERT(scope || item == rootItem); + Q_ASSERT(scope || item == contentItem); #ifdef FOCUS_DEBUG qWarning() << "QQuickWindowPrivate::setFocusInScope():"; @@ -614,7 +614,7 @@ void QQuickWindowPrivate::setFocusInScope(QQuickItem *scope, QQuickItem *item, F QVarLengthArray changed; // Does this change the active focus? - if (item == rootItem || (scopePrivate->activeFocus && item->isEnabled())) { + if (item == contentItem || (scopePrivate->activeFocus && item->isEnabled())) { oldActiveFocusItem = activeFocusItem; newActiveFocusItem = item; while (newActiveFocusItem->isFocusScope() @@ -643,7 +643,7 @@ void QQuickWindowPrivate::setFocusInScope(QQuickItem *scope, QQuickItem *item, F } } - if (item != rootItem && !(options & DontChangeSubFocusItem)) { + if (item != contentItem && !(options & DontChangeSubFocusItem)) { QQuickItem *oldSubFocusItem = scopePrivate->subFocusItem; if (oldSubFocusItem) { QQuickItemPrivate::get(oldSubFocusItem)->focus = false; @@ -654,13 +654,13 @@ void QQuickWindowPrivate::setFocusInScope(QQuickItem *scope, QQuickItem *item, F } if (!(options & DontChangeFocusProperty)) { -// if (item != rootItem || QGuiApplication::focusWindow() == q) { // QTBUG-22415 +// if (item != contentItem || QGuiApplication::focusWindow() == q) { // QTBUG-22415 itemPrivate->focus = true; changed << item; // } } - if (newActiveFocusItem && rootItem->hasFocus()) { + if (newActiveFocusItem && contentItem->hasFocus()) { activeFocusItem = newActiveFocusItem; QQuickItemPrivate::get(newActiveFocusItem)->activeFocus = true; @@ -690,7 +690,7 @@ void QQuickWindowPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem *item, Q_Q(QQuickWindow); Q_ASSERT(item); - Q_ASSERT(scope || item == rootItem); + Q_ASSERT(scope || item == contentItem); #ifdef FOCUS_DEBUG qWarning() << "QQuickWindowPrivate::clearFocusInScope():"; @@ -711,10 +711,10 @@ void QQuickWindowPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem *item, QVarLengthArray changed; - Q_ASSERT(item == rootItem || item == scopePrivate->subFocusItem); + Q_ASSERT(item == contentItem || item == scopePrivate->subFocusItem); // Does this change the active focus? - if (item == rootItem || scopePrivate->activeFocus) { + if (item == contentItem || scopePrivate->activeFocus) { oldActiveFocusItem = activeFocusItem; newActiveFocusItem = scope; @@ -738,7 +738,7 @@ void QQuickWindowPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem *item, } } - if (item != rootItem && !(options & DontChangeSubFocusItem)) { + if (item != contentItem && !(options & DontChangeSubFocusItem)) { QQuickItem *oldSubFocusItem = scopePrivate->subFocusItem; if (oldSubFocusItem && !(options & DontChangeFocusProperty)) { QQuickItemPrivate::get(oldSubFocusItem)->focus = false; @@ -953,7 +953,7 @@ QQuickWindow::~QQuickWindow() QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); delete d->incubationController; d->incubationController = 0; - delete d->rootItem; d->rootItem = 0; + delete d->contentItem; d->contentItem = 0; } @@ -1055,7 +1055,7 @@ QQuickItem *QQuickWindow::contentItem() const { Q_D(const QQuickWindow); - return d->rootItem; + return d->contentItem; } /*! @@ -1149,7 +1149,7 @@ bool QQuickWindow::event(QEvent *e) break; #endif case QEvent::WindowDeactivate: - rootItem()->windowDeactivateEvent(); + contentItem()->windowDeactivateEvent(); break; case QEvent::FocusAboutToChange: if (d->activeFocusItem) @@ -1241,7 +1241,7 @@ bool QQuickWindowPrivate::deliverMouseEvent(QMouseEvent *event) if (!mouseGrabberItem && event->type() == QEvent::MouseButtonPress && (event->buttons() & event->button()) == event->buttons()) { - if (deliverInitialMousePressEvent(rootItem, event)) + if (deliverInitialMousePressEvent(contentItem, event)) event->accept(); else event->ignore(); @@ -1299,7 +1299,7 @@ void QQuickWindow::mouseDoubleClickEvent(QMouseEvent *event) #endif if (!d->mouseGrabberItem && (event->buttons() & event->button()) == event->buttons()) { - if (d->deliverInitialMousePressEvent(d->rootItem, event)) + if (d->deliverInitialMousePressEvent(d->contentItem, event)) event->accept(); else event->ignore(); @@ -1344,7 +1344,7 @@ void QQuickWindow::mouseMoveEvent(QMouseEvent *event) d->lastMousePosition = event->windowPos(); bool accepted = event->isAccepted(); - bool delivered = d->deliverHoverEvent(d->rootItem, event->windowPos(), last, event->modifiers(), accepted); + bool delivered = d->deliverHoverEvent(d->contentItem, event->windowPos(), last, event->modifiers(), accepted); if (!delivered) { //take care of any exits accepted = d->clearHover(); @@ -1472,7 +1472,7 @@ void QQuickWindow::wheelEvent(QWheelEvent *event) return; event->ignore(); - d->deliverWheelEvent(d->rootItem, event); + d->deliverWheelEvent(d->contentItem, event); d->lastWheelEventAccepted = event->isAccepted(); } #endif // QT_NO_WHEELEVENT @@ -1543,7 +1543,7 @@ bool QQuickWindowPrivate::deliverTouchEvent(QTouchEvent *event) // or some item accepted a point and should receive an update if (newPoints.count() > 0 || updatedPoints.count() > 0) { QSet acceptedNewPoints; - event->setAccepted(deliverTouchPoints(rootItem, event, newPoints, &acceptedNewPoints, &updatedPoints)); + event->setAccepted(deliverTouchPoints(contentItem, event, newPoints, &acceptedNewPoints, &updatedPoints)); } else event->ignore(); @@ -1814,7 +1814,7 @@ void QQuickWindowPrivate::deliverDragEvent(QQuickDragGrabber *grabber, QEvent *e e->mouseButtons(), e->keyboardModifiers()); QQuickDropEventEx::copyActions(&enterEvent, *e); - event->setAccepted(deliverDragEvent(grabber, rootItem, &enterEvent)); + event->setAccepted(deliverDragEvent(grabber, contentItem, &enterEvent)); } } @@ -1874,7 +1874,7 @@ void QQuickWindowPrivate::updateCursor(const QPointF &scenePos) Q_Q(QQuickWindow); QQuickItem *oldCursorItem = cursorItem; - cursorItem = findCursorItem(rootItem, scenePos); + cursorItem = findCursorItem(contentItem, scenePos); if (cursorItem != oldCursorItem) { if (cursorItem) @@ -2118,7 +2118,7 @@ void QQuickWindowPrivate::cleanupNodesOnShutdown() { Q_Q(QQuickWindow); cleanupNodes(); - cleanupNodesOnShutdown(rootItem); + cleanupNodesOnShutdown(contentItem); QSet::const_iterator it = parentlessItems.begin(); for (; it != parentlessItems.end(); ++it) cleanupNodesOnShutdown(*it); diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h index 62b0aa3..7f9af82 100644 --- a/src/quick/items/qquickwindow.h +++ b/src/quick/items/qquickwindow.h @@ -82,8 +82,6 @@ public: virtual ~QQuickWindow(); QQuickItem *contentItem() const; - //XXX rootItem renamed contentItem - this function must be removed before 5.0 - QQuickItem *rootItem() const { return contentItem(); } QQuickItem *activeFocusItem() const; QObject *focusObject() const; diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h index 530e547..fdf5fe2 100644 --- a/src/quick/items/qquickwindow_p.h +++ b/src/quick/items/qquickwindow_p.h @@ -103,9 +103,9 @@ public: virtual ~QQuickWindowPrivate(); void init(QQuickWindow *); - void initRootItem();//Currently only used if items added in QML + void initContentItem();//Currently only used if items added in QML - QQuickRootItem *rootItem; + QQuickRootItem *contentItem; QSet parentlessItems; QQmlListProperty data(); diff --git a/tests/auto/quick/examples/tst_examples.cpp b/tests/auto/quick/examples/tst_examples.cpp index 70efc5e..f651655 100644 --- a/tests/auto/quick/examples/tst_examples.cpp +++ b/tests/auto/quick/examples/tst_examples.cpp @@ -275,7 +275,7 @@ void tst_examples::sgexamples() window->show(); QVERIFY(QTest::qWaitForWindowExposed(window)); } - root->setParentItem(window->rootItem()); + root->setParentItem(window->contentItem()); component.completeCreate(); qApp->processEvents(); @@ -319,7 +319,7 @@ void tst_examples::sgsnippets() window->show(); QVERIFY(QTest::qWaitForWindowExposed(window)); } - root->setParentItem(window->rootItem()); + root->setParentItem(window->contentItem()); component.completeCreate(); qApp->processEvents(); diff --git a/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp b/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp index 247f987..7c07a16 100644 --- a/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp +++ b/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp @@ -81,7 +81,7 @@ void tst_qquickapplication::active() QQuickItem *item = qobject_cast(component.create()); QVERIFY(item); QQuickWindow window; - item->setParentItem(window.rootItem()); + item->setParentItem(window.contentItem()); // not active QVERIFY(!item->property("active").toBool()); diff --git a/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp b/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp index 8e13e21..562863b 100644 --- a/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp +++ b/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp @@ -180,7 +180,7 @@ void tst_QQuickDrag::cleanupTestCase() void tst_QQuickDrag::active() { QQuickWindow window; - TestDropTarget dropTarget(window.rootItem()); + TestDropTarget dropTarget(window.contentItem()); dropTarget.setSize(QSizeF(100, 100)); QQmlComponent component(&engine); component.setData( @@ -390,7 +390,7 @@ void tst_QQuickDrag::active() void tst_QQuickDrag::drop() { QQuickWindow window; - TestDropTarget outerTarget(window.rootItem()); + TestDropTarget outerTarget(window.contentItem()); outerTarget.setSize(QSizeF(100, 100)); outerTarget.acceptAction = Qt::CopyAction; TestDropTarget innerTarget(&outerTarget); @@ -526,7 +526,7 @@ void tst_QQuickDrag::drop() void tst_QQuickDrag::move() { QQuickWindow window; - TestDropTarget outerTarget(window.rootItem()); + TestDropTarget outerTarget(window.contentItem()); outerTarget.setSize(QSizeF(100, 100)); TestDropTarget leftTarget(&outerTarget); leftTarget.setPos(QPointF(0, 35)); @@ -680,11 +680,11 @@ void tst_QQuickDrag::move() void tst_QQuickDrag::parentChange() { QQuickWindow window1; - TestDropTarget dropTarget1(window1.rootItem()); + TestDropTarget dropTarget1(window1.contentItem()); dropTarget1.setSize(QSizeF(100, 100)); QQuickWindow window2; - TestDropTarget dropTarget2(window2.rootItem()); + TestDropTarget dropTarget2(window2.contentItem()); dropTarget2.setSize(QSizeF(100, 100)); QQmlComponent component(&engine); @@ -704,7 +704,7 @@ void tst_QQuickDrag::parentChange() QCOMPARE(evaluate(item, "Drag.active"), true); // Verify setting a parent item for an item with an active drag sends an enter event. - item->setParentItem(window1.rootItem()); + item->setParentItem(window1.contentItem()); QCOMPARE(dropTarget1.enterEvents, 0); QCoreApplication::processEvents(); QCOMPARE(dropTarget1.enterEvents, 1); @@ -719,7 +719,7 @@ void tst_QQuickDrag::parentChange() // Changing the parent to an item in another window sends a leave event in the old window // and an enter on the new window. - item->setParentItem(window2.rootItem()); + item->setParentItem(window2.contentItem()); QCOMPARE(dropTarget1.enterEvents, 1); QCOMPARE(dropTarget1.moveEvents, 1); QCOMPARE(dropTarget1.leaveEvents, 0); @@ -746,13 +746,13 @@ void tst_QQuickDrag::parentChange() // Go around again and verify no events if active is false. evaluate(item, "Drag.active = false"); - item->setParentItem(window1.rootItem()); + item->setParentItem(window1.contentItem()); QCoreApplication::processEvents(); item->setParentItem(&dropTarget1); QCoreApplication::processEvents(); - item->setParentItem(window2.rootItem()); + item->setParentItem(window2.contentItem()); QCoreApplication::processEvents(); item->setParentItem(0); @@ -767,7 +767,7 @@ void tst_QQuickDrag::parentChange() void tst_QQuickDrag::hotSpot() { QQuickWindow window; - TestDropTarget dropTarget(window.rootItem()); + TestDropTarget dropTarget(window.contentItem()); dropTarget.setSize(QSizeF(100, 100)); QQmlComponent component(&engine); component.setData( @@ -831,7 +831,7 @@ void tst_QQuickDrag::hotSpot() void tst_QQuickDrag::supportedActions() { QQuickWindow window; - TestDropTarget dropTarget(window.rootItem()); + TestDropTarget dropTarget(window.contentItem()); dropTarget.setSize(QSizeF(100, 100)); QQmlComponent component(&engine); component.setData( @@ -889,7 +889,7 @@ void tst_QQuickDrag::supportedActions() void tst_QQuickDrag::proposedAction() { QQuickWindow window; - TestDropTarget dropTarget(window.rootItem()); + TestDropTarget dropTarget(window.contentItem()); dropTarget.setSize(QSizeF(100, 100)); QQmlComponent component(&engine); component.setData( @@ -958,8 +958,8 @@ void tst_QQuickDrag::keys() // Test changing the keys restarts a drag. QQuickWindow window; - item->setParentItem(window.rootItem()); - TestDropTarget dropTarget(window.rootItem()); + item->setParentItem(window.contentItem()); + TestDropTarget dropTarget(window.contentItem()); dropTarget.setSize(QSizeF(100, 100)); evaluate(item, "Drag.start()"); @@ -1006,8 +1006,8 @@ void tst_QQuickDrag::source() // Test changing the source restarts a drag. QQuickWindow window; - item->setParentItem(window.rootItem()); - TestDropTarget dropTarget(window.rootItem()); + item->setParentItem(window.contentItem()); + TestDropTarget dropTarget(window.contentItem()); dropTarget.setSize(QSizeF(100, 100)); evaluate(item, "Drag.start()"); @@ -1183,7 +1183,7 @@ void tst_QQuickDrag::recursion() QTest::ignoreMessage(QtWarningMsg, warning.constData()); QQuickWindow window; - RecursingDropTarget dropTarget(script, type, window.rootItem()); + RecursingDropTarget dropTarget(script, type, window.contentItem()); dropTarget.setSize(QSizeF(100, 100)); QQmlComponent component(&engine); component.setData( @@ -1195,7 +1195,7 @@ void tst_QQuickDrag::recursion() QScopedPointer object(component.create()); QQuickItem *item = qobject_cast(object.data()); QVERIFY(item); - item->setParentItem(window.rootItem()); + item->setParentItem(window.contentItem()); dropTarget.setItem(item); diff --git a/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp b/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp index 42dc6ff..927a57b 100644 --- a/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp +++ b/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp @@ -122,7 +122,7 @@ void tst_QQuickDropArea::containsDrag_internal() QScopedPointer object(component.create()); QQuickItem *dropArea = qobject_cast(object.data()); QVERIFY(dropArea); - dropArea->setParentItem(window.rootItem()); + dropArea->setParentItem(window.contentItem()); QQuickItem *dragItem = dropArea->findChild("dragItem"); QVERIFY(dragItem); @@ -188,7 +188,7 @@ void tst_QQuickDropArea::containsDrag_external() QScopedPointer object(component.create()); QQuickItem *dropArea = qobject_cast(object.data()); QVERIFY(dropArea); - dropArea->setParentItem(window.rootItem()); + dropArea->setParentItem(window.contentItem()); QMimeData data; QQuickWindow alternateWindow; @@ -256,7 +256,7 @@ void tst_QQuickDropArea::keys_internal() QScopedPointer object(component.create()); QQuickItem *dropArea = qobject_cast(object.data()); QVERIFY(dropArea); - dropArea->setParentItem(window.rootItem()); + dropArea->setParentItem(window.contentItem()); QQuickItem *dragItem = dropArea->findChild("dragItem"); QVERIFY(dragItem); @@ -356,7 +356,7 @@ void tst_QQuickDropArea::keys_external() "}", QUrl()); QScopedPointer object(component.create()); QQuickItem *dropArea = qobject_cast(object.data()); - dropArea->setParentItem(window.rootItem()); + dropArea->setParentItem(window.contentItem()); QMimeData data; QQuickWindow alternateWindow; @@ -463,7 +463,7 @@ void tst_QQuickDropArea::source_internal() QScopedPointer object(component.create()); QQuickItem *dropArea = qobject_cast(object.data()); QVERIFY(dropArea); - dropArea->setParentItem(window.rootItem()); + dropArea->setParentItem(window.contentItem()); QQuickItem *dragItem = dropArea->findChild("dragItem"); QVERIFY(dragItem); @@ -528,7 +528,7 @@ void tst_QQuickDropArea::position_internal() QScopedPointer object(component.create()); QQuickItem *dropArea = qobject_cast(object.data()); QVERIFY(dropArea); - dropArea->setParentItem(window.rootItem()); + dropArea->setParentItem(window.contentItem()); QQuickItem *dragItem = dropArea->findChild("dragItem"); QVERIFY(dragItem); @@ -590,7 +590,7 @@ void tst_QQuickDropArea::position_external() QScopedPointer object(component.create()); QQuickItem *dropArea = qobject_cast(object.data()); QVERIFY(dropArea); - dropArea->setParentItem(window.rootItem()); + dropArea->setParentItem(window.contentItem()); QMimeData data; @@ -667,7 +667,7 @@ void tst_QQuickDropArea::drop_internal() QScopedPointer object(component.create()); QQuickItem *dropArea = qobject_cast(object.data()); QVERIFY(dropArea); - dropArea->setParentItem(window.rootItem()); + dropArea->setParentItem(window.contentItem()); QQuickItem *dragItem = dropArea->findChild("dragItem"); QVERIFY(dragItem); @@ -806,7 +806,7 @@ void tst_QQuickDropArea::simultaneousDrags() QScopedPointer object(component.create()); QQuickItem *dropArea1 = qobject_cast(object.data()); QVERIFY(dropArea1); - dropArea1->setParentItem(window.rootItem()); + dropArea1->setParentItem(window.contentItem()); QQuickItem *dropArea2 = dropArea1->findChild("dropArea2"); QVERIFY(dropArea2); diff --git a/tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp b/tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp index 1cf07d3..a614bbb 100644 --- a/tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp +++ b/tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp @@ -503,7 +503,7 @@ void tst_qquickfocusscope::canvasFocus() QQuickItem *rootObject = view->rootObject(); QVERIFY(rootObject); - QQuickItem *rootItem = view->rootItem(); + QQuickItem *rootItem = view->contentItem(); QQuickItem *scope1 = findItem(rootObject, QLatin1String("scope1")); QQuickItem *item1 = findItem(rootObject, QLatin1String("item1")); QQuickItem *scope2 = findItem(rootObject, QLatin1String("scope2")); diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp index f98fe75..1050308 100644 --- a/tests/auto/quick/qquickitem/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp @@ -254,7 +254,7 @@ struct FocusState : public QHash else if (qobject_cast(window.activeFocusItem())) \ QCOMPARE(qobject_cast(window.activeFocusItem())->focused, true); \ } else { \ - QCOMPARE(window.activeFocusItem(), window.rootItem()); \ + QCOMPARE(window.activeFocusItem(), window.contentItem()); \ } \ for (QHash::Iterator iter = focusState.begin(); \ iter != focusState.end(); \ @@ -276,9 +276,9 @@ void tst_qquickitem::simpleFocus() QTRY_VERIFY(QGuiApplication::focusWindow() == &window); - QQuickItem *l1c1 = new TestItem(window.rootItem()); - QQuickItem *l1c2 = new TestItem(window.rootItem()); - QQuickItem *l1c3 = new TestItem(window.rootItem()); + QQuickItem *l1c1 = new TestItem(window.contentItem()); + QQuickItem *l1c2 = new TestItem(window.contentItem()); + QQuickItem *l1c3 = new TestItem(window.contentItem()); QQuickItem *l2c1 = new TestItem(l1c1); QQuickItem *l2c2 = new TestItem(l1c1); @@ -327,9 +327,9 @@ void tst_qquickitem::scopedFocus() ensureFocus(&window); QTRY_VERIFY(QGuiApplication::focusWindow() == &window); - QQuickItem *l1c1 = new TestItem(window.rootItem()); - QQuickItem *l1c2 = new TestItem(window.rootItem()); - QQuickItem *l1c3 = new TestItem(window.rootItem()); + QQuickItem *l1c1 = new TestItem(window.contentItem()); + QQuickItem *l1c2 = new TestItem(window.contentItem()); + QQuickItem *l1c3 = new TestItem(window.contentItem()); QQuickItem *l2c1 = new TestItem(l1c1); QQuickItem *l2c2 = new TestItem(l1c1); @@ -416,7 +416,7 @@ void tst_qquickitem::addedToWindow() focusState[item].set(true, false); FVERIFY(); - item->setParentItem(window.rootItem()); + item->setParentItem(window.contentItem()); focusState[item].set(true, true); focusState.active(item); FVERIFY(); @@ -427,7 +427,7 @@ void tst_qquickitem::addedToWindow() ensureFocus(&window); QTRY_VERIFY(QGuiApplication::focusWindow() == &window); - QQuickItem *item = new TestItem(window.rootItem()); + QQuickItem *item = new TestItem(window.contentItem()); QQuickItem *tree = new TestItem; QQuickItem *c1 = new TestItem(tree); @@ -468,7 +468,7 @@ void tst_qquickitem::addedToWindow() focusState[c2].set(true, false); FVERIFY(); - tree->setParentItem(window.rootItem()); + tree->setParentItem(window.contentItem()); focusState[c1].set(false, false); focusState[c2].set(true, true); focusState.active(c2); @@ -491,7 +491,7 @@ void tst_qquickitem::addedToWindow() focusState[c2].set(true, false); FVERIFY(); - tree->setParentItem(window.rootItem()); + tree->setParentItem(window.contentItem()); focusState[c1].set(false, false); focusState[c2].set(true, false); FVERIFY(); @@ -521,7 +521,7 @@ void tst_qquickitem::addedToWindow() focusState[c2].set(true, false); FVERIFY(); - tree->setParentItem(window.rootItem()); + tree->setParentItem(window.contentItem()); focusState[tree].set(true, true); focusState[c1].set(false, false); focusState[c2].set(true, true); @@ -533,7 +533,7 @@ void tst_qquickitem::addedToWindow() QQuickWindow window; ensureFocus(&window); QTRY_VERIFY(QGuiApplication::focusWindow() == &window); - QQuickItem *child = new TestItem(window.rootItem()); + QQuickItem *child = new TestItem(window.contentItem()); QQuickItem *tree = new TestFocusScope; QQuickItem *c1 = new TestItem(tree); QQuickItem *c2 = new TestItem(tree); @@ -551,7 +551,7 @@ void tst_qquickitem::addedToWindow() focusState.active(child); FVERIFY(); - tree->setParentItem(window.rootItem()); + tree->setParentItem(window.contentItem()); focusState[tree].set(false, false); focusState[c1].set(false, false); focusState[c2].set(true, false); @@ -573,7 +573,7 @@ void tst_qquickitem::changeParent() QQuickWindow window; ensureFocus(&window); QTRY_VERIFY(QGuiApplication::focusWindow() == &window); - QQuickItem *child = new TestItem(window.rootItem()); + QQuickItem *child = new TestItem(window.contentItem()); FocusState focusState; focusState << child; @@ -595,8 +595,8 @@ void tst_qquickitem::changeParent() QQuickWindow window; ensureFocus(&window); QTRY_VERIFY(QGuiApplication::focusWindow() == &window); - QQuickItem *child = new TestItem(window.rootItem()); - QQuickItem *child2 = new TestItem(window.rootItem()); + QQuickItem *child = new TestItem(window.contentItem()); + QQuickItem *child2 = new TestItem(window.contentItem()); FocusState focusState; focusState << child << child2; @@ -616,8 +616,8 @@ void tst_qquickitem::changeParent() QQuickWindow window; ensureFocus(&window); QTRY_VERIFY(QGuiApplication::focusWindow() == &window); - QQuickItem *child = new TestItem(window.rootItem()); - QQuickItem *child2 = new TestFocusScope(window.rootItem()); + QQuickItem *child = new TestItem(window.contentItem()); + QQuickItem *child2 = new TestFocusScope(window.contentItem()); QQuickItem *item = new TestItem(child); FocusState focusState; @@ -638,8 +638,8 @@ void tst_qquickitem::changeParent() QQuickWindow window; ensureFocus(&window); QTRY_VERIFY(QGuiApplication::focusWindow() == &window); - QQuickItem *child = new TestItem(window.rootItem()); - QQuickItem *child2 = new TestFocusScope(window.rootItem()); + QQuickItem *child = new TestItem(window.contentItem()); + QQuickItem *child2 = new TestFocusScope(window.contentItem()); QQuickItem *item = new TestItem(child2); FocusState focusState; @@ -660,8 +660,8 @@ void tst_qquickitem::changeParent() QQuickWindow window; ensureFocus(&window); QTRY_VERIFY(QGuiApplication::focusWindow() == &window); - QQuickItem *child = new TestItem(window.rootItem()); - QQuickItem *child2 = new TestFocusScope(window.rootItem()); + QQuickItem *child = new TestItem(window.contentItem()); + QQuickItem *child2 = new TestFocusScope(window.contentItem()); QQuickItem *item = new TestItem(child2); FocusState focusState; @@ -686,7 +686,7 @@ void tst_qquickitem::changeParent() QQuickWindow window; ensureFocus(&window); QTRY_VERIFY(QGuiApplication::focusWindow() == &window); - QQuickItem *item = new TestFocusScope(window.rootItem()); + QQuickItem *item = new TestFocusScope(window.contentItem()); QQuickItem *child = new TestItem(item); QQuickItem *child2 = new TestItem; @@ -709,7 +709,7 @@ void tst_qquickitem::changeParent() focusState.remove(child); delete child; - item->setParentItem(window.rootItem()); + item->setParentItem(window.contentItem()); focusState[item].set(true, true); focusState.active(item); FVERIFY(); @@ -777,7 +777,7 @@ void tst_qquickitem::parentItemWithFocus() focusState[&child].set(false, false); FVERIFY(); - parent.setParentItem(window.rootItem()); + parent.setParentItem(window.contentItem()); focusState[&parent].set(true, true); focusState[&child].set(false, false); focusState.active(&parent); @@ -810,7 +810,7 @@ void tst_qquickitem::parentItemWithFocus() focusState[&grandchild].set(false, false); FVERIFY(); - parent.setParentItem(window.rootItem()); + parent.setParentItem(window.contentItem()); focusState[&parent].set(true, true); focusState[&child].set(false, false); focusState[&grandchild].set(false, false); @@ -858,7 +858,7 @@ void tst_qquickitem::reparentFocusedItem() ensureFocus(&window); QTRY_VERIFY(QGuiApplication::focusWindow() == &window); - QQuickItem parent(window.rootItem()); + QQuickItem parent(window.contentItem()); QQuickItem child(&parent); QQuickItem sibling(&parent); QQuickItem grandchild(&child); @@ -1035,12 +1035,12 @@ void tst_qquickitem::enabledFocus() QCOMPARE(root.hasFocus(), true); QCOMPARE(root.hasActiveFocus(), false); - root.setParentItem(window.rootItem()); + root.setParentItem(window.contentItem()); QCOMPARE(root.isEnabled(), false); QCOMPARE(root.hasFocus(), true); QCOMPARE(root.hasActiveFocus(), false); - QCOMPARE(window.activeFocusItem(), window.rootItem()); + QCOMPARE(window.activeFocusItem(), window.contentItem()); root.setEnabled(true); QCOMPARE(root.isEnabled(), true); @@ -1108,7 +1108,7 @@ void tst_qquickitem::enabledFocus() QCOMPARE(child1.isEnabled(), true); QCOMPARE(child1.hasFocus(), true); QCOMPARE(child1.hasActiveFocus(), false); - QCOMPARE(window.activeFocusItem(), window.rootItem()); + QCOMPARE(window.activeFocusItem(), window.contentItem()); child2.forceActiveFocus(); QCOMPARE(root.isEnabled(), true); @@ -1132,7 +1132,7 @@ void tst_qquickitem::enabledFocus() QCOMPARE(child2.isEnabled(), false); QCOMPARE(child2.hasFocus(), true); QCOMPARE(child2.hasActiveFocus(), false); - QCOMPARE(window.activeFocusItem(), window.rootItem()); + QCOMPARE(window.activeFocusItem(), window.contentItem()); child1.forceActiveFocus(); QCOMPARE(root.isEnabled(), false); @@ -1144,7 +1144,7 @@ void tst_qquickitem::enabledFocus() QCOMPARE(child2.isEnabled(), false); QCOMPARE(child2.hasFocus(), false); QCOMPARE(child2.hasActiveFocus(), false); - QCOMPARE(window.activeFocusItem(), window.rootItem()); + QCOMPARE(window.activeFocusItem(), window.contentItem()); root.setEnabled(true); QCOMPARE(root.isEnabled(), true); @@ -1168,13 +1168,13 @@ void tst_qquickitem::mouseGrab() TestItem *child1 = new TestItem; child1->setAcceptedMouseButtons(Qt::LeftButton); child1->setSize(QSizeF(200, 100)); - child1->setParentItem(window->rootItem()); + child1->setParentItem(window->contentItem()); TestItem *child2 = new TestItem; child2->setAcceptedMouseButtons(Qt::LeftButton); child2->setY(51); child2->setSize(QSizeF(200, 100)); - child2->setParentItem(window->rootItem()); + child2->setParentItem(window->contentItem()); QTest::mousePress(window, Qt::LeftButton, 0, QPoint(50,50)); QTest::qWait(100); @@ -1253,7 +1253,7 @@ void tst_qquickitem::touchEventAcceptIgnore() TestItem *item = new TestItem; item->setSize(QSizeF(100, 100)); - item->setParentItem(window->rootItem()); + item->setParentItem(window->contentItem()); item->acceptIncomingTouchEvents = itemSupportsTouch; static QTouchDevice* device = 0; @@ -1335,7 +1335,7 @@ void tst_qquickitem::polishOutsideAnimation() window->resize(200, 200); window->show(); - TestPolishItem *item = new TestPolishItem(window->rootItem()); + TestPolishItem *item = new TestPolishItem(window->contentItem()); item->setSize(QSizeF(200, 100)); QTest::qWait(50); @@ -1384,7 +1384,7 @@ void tst_qquickitem::wheelEvent() TestItem *item = new TestItem; item->setSize(QSizeF(200, 100)); - item->setParentItem(window->rootItem()); + item->setParentItem(window->contentItem()); item->setEnabled(enabled); item->setVisible(visible); @@ -1470,7 +1470,7 @@ void tst_qquickitem::hoverEvent() HoverItem *item = new HoverItem; item->setSize(QSizeF(100, 100)); - item->setParentItem(window->rootItem()); + item->setParentItem(window->contentItem()); item->setEnabled(enabled); item->setVisible(visible); @@ -1509,7 +1509,7 @@ void tst_qquickitem::hoverEventInParent() window->resize(200, 200); window->show(); - HoverItem *parentItem = new HoverItem(window->rootItem()); + HoverItem *parentItem = new HoverItem(window->contentItem()); parentItem->setSize(QSizeF(200, 200)); parentItem->setAcceptHoverEvents(true); @@ -1670,7 +1670,7 @@ void tst_qquickitem::acceptedMouseButtons() QQuickWindow window; item.setSize(QSizeF(200,100)); - item.setParentItem(window.rootItem()); + item.setParentItem(window.contentItem()); QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(50, 50)); QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(50, 50)); diff --git a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp index 61762cb..fdf834c 100644 --- a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp +++ b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp @@ -259,7 +259,7 @@ void tst_QQuickItemLayer::layerVisibility() QQuickView view; view.setSource(testFileUrl("Visible.qml")); - QQuickItem *child = view.rootItem()->childItems().at(0); + QQuickItem *child = view.contentItem()->childItems().at(0); child->setProperty("layerVisible", visible); child->setProperty("layerEffect", effect); child->setProperty("layerOpacity", opacity); @@ -305,7 +305,7 @@ void tst_QQuickItemLayer::layerZOrder() QQuickView view; view.setSource(testFileUrl("ZOrder.qml")); - QQuickItem *child = view.rootItem()->childItems().at(0); + QQuickItem *child = view.contentItem()->childItems().at(0); child->setProperty("layerEffect", effect); view.show(); @@ -340,7 +340,7 @@ void tst_QQuickItemLayer::changeZOrder() QQuickView view; view.setSource(testFileUrl("ZOrderChange.qml")); - QQuickItem *child = view.rootItem()->childItems().at(0); + QQuickItem *child = view.contentItem()->childItems().at(0); child->setProperty("layerEnabled", layered); child->setProperty("layerEffect", effect); child->setProperty("layerZ", 1); diff --git a/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp b/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp index c3bf77d..03e4b40 100644 --- a/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp +++ b/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp @@ -110,7 +110,7 @@ void tst_QQuickPaintedItem::initTestCase() void tst_QQuickPaintedItem::update() { TestPaintedItem item; - item.setParentItem(window.rootItem()); + item.setParentItem(window.contentItem()); QCOMPARE(hasDirtyContentFlag(&item), false); item.update(); @@ -149,7 +149,7 @@ void tst_QQuickPaintedItem::opaquePainting() { TestPaintedItem item; item.setSize(QSizeF(320, 240)); - item.setParentItem(window.rootItem()); + item.setParentItem(window.contentItem()); QCOMPARE(item.opaquePainting(), false); @@ -187,7 +187,7 @@ void tst_QQuickPaintedItem::antialiasing() { TestPaintedItem item; item.setSize(QSizeF(320, 240)); - item.setParentItem(window.rootItem()); + item.setParentItem(window.contentItem()); QCOMPARE(item.antialiasing(), false); @@ -225,7 +225,7 @@ void tst_QQuickPaintedItem::mipmap() { TestPaintedItem item; item.setSize(QSizeF(320, 240)); - item.setParentItem(window.rootItem()); + item.setParentItem(window.contentItem()); QCOMPARE(item.mipmap(), false); @@ -263,7 +263,7 @@ void tst_QQuickPaintedItem::performanceHints() { TestPaintedItem item; item.setSize(QSizeF(320, 240)); - item.setParentItem(window.rootItem()); + item.setParentItem(window.contentItem()); QCOMPARE(item.performanceHints(), QQuickPaintedItem::PerformanceHints()); @@ -332,7 +332,7 @@ void tst_QQuickPaintedItem::contentScale() { TestPaintedItem item; item.setSize(QSizeF(320, 240)); - item.setParentItem(window.rootItem()); + item.setParentItem(window.contentItem()); QSignalSpy spy(&item, SIGNAL(contentsScaleChanged())); @@ -376,7 +376,7 @@ void tst_QQuickPaintedItem::contentsBoundingRect() { TestPaintedItem item; item.setSize(QSizeF(320, 240)); - item.setParentItem(window.rootItem()); + item.setParentItem(window.contentItem()); QCOMPARE(item.contentsBoundingRect(), QRectF(0, 0, 320, 240)); @@ -414,7 +414,7 @@ void tst_QQuickPaintedItem::fillColor() { TestPaintedItem item; item.setSize(QSizeF(320, 240)); - item.setParentItem(window.rootItem()); + item.setParentItem(window.contentItem()); QSignalSpy spy(&item, SIGNAL(fillColorChanged())); diff --git a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp index cb161c0..b9a18ee 100644 --- a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp +++ b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp @@ -1481,13 +1481,13 @@ void tst_qquickpositioners::test_repeater() { QQuickView *window = createView(testFile("repeatertest.qml")); - QQuickRectangle *one = findItem(window->rootItem(), "one"); + QQuickRectangle *one = findItem(window->contentItem(), "one"); QVERIFY(one != 0); - QQuickRectangle *two = findItem(window->rootItem(), "two"); + QQuickRectangle *two = findItem(window->contentItem(), "two"); QVERIFY(two != 0); - QQuickRectangle *three = findItem(window->rootItem(), "three"); + QQuickRectangle *three = findItem(window->contentItem(), "three"); QVERIFY(three != 0); QCOMPARE(one->x(), 0.0); diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp index 0f69009..a5a5efb 100644 --- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp +++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp @@ -1191,7 +1191,7 @@ void tst_qquicktextedit::focusOnPress() QQuickWindow window; window.resize(100, 50); - textEditObject->setParentItem(window.rootItem()); + textEditObject->setParentItem(window.contentItem()); window.show(); window.requestActivateWindow(); QTest::qWaitForWindowActive(&window); @@ -2903,7 +2903,7 @@ void tst_qquicktextedit::openInputPanel() anotherEdit.setFocus(false); QVERIFY(qApp->focusObject() != &anotherEdit); - QCOMPARE(view.activeFocusItem(), view.rootItem()); + QCOMPARE(view.activeFocusItem(), view.contentItem()); anotherEdit.setFocus(true); qApp->inputMethod()->hide(); @@ -4253,7 +4253,7 @@ void tst_qquicktextedit::keySequence() QVERIFY(textEdit != 0); QQuickWindow window; - textEdit->setParentItem(window.rootItem()); + textEdit->setParentItem(window.contentItem()); window.show(); window.requestActivateWindow(); QTest::qWaitForWindowActive(&window); @@ -4416,7 +4416,7 @@ void tst_qquicktextedit::undo() QVERIFY(textEdit != 0); QQuickWindow window; - textEdit->setParentItem(window.rootItem()); + textEdit->setParentItem(window.contentItem()); window.show(); window.requestActivateWindow(); QTest::qWaitForWindowActive(&window); @@ -4502,7 +4502,7 @@ void tst_qquicktextedit::redo() QVERIFY(textEdit != 0); QQuickWindow window; - textEdit->setParentItem(window.rootItem()); + textEdit->setParentItem(window.contentItem()); window.show(); window.requestActivateWindow(); QTest::qWaitForWindowActive(&window); @@ -4726,7 +4726,7 @@ void tst_qquicktextedit::undo_keypressevents() QVERIFY(textEdit != 0); QQuickWindow window; - textEdit->setParentItem(window.rootItem()); + textEdit->setParentItem(window.contentItem()); window.show(); window.requestActivateWindow(); QTest::qWaitForWindowActive(&window); diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp index 1d65cef..3c9e882 100644 --- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp @@ -2502,7 +2502,7 @@ void tst_qquicktextinput::copyAndPasteKeySequence() QVERIFY(textInput != 0); QQuickWindow window; - textInput->setParentItem(window.rootItem()); + textInput->setParentItem(window.contentItem()); window.show(); window.requestActivateWindow(); QTest::qWaitForWindowActive(&window); @@ -3297,7 +3297,7 @@ void tst_qquicktextinput::focusOnPress() QQuickWindow window; window.resize(100, 50); - textInputObject->setParentItem(window.rootItem()); + textInputObject->setParentItem(window.contentItem()); window.show(); window.requestActivateWindow(); QTest::qWaitForWindowActive(&window); @@ -3405,7 +3405,7 @@ void tst_qquicktextinput::openInputPanel() anotherInput.setFocus(false); QVERIFY(qApp->focusObject() != &anotherInput); - QCOMPARE(view.activeFocusItem(), view.rootItem()); + QCOMPARE(view.activeFocusItem(), view.contentItem()); anotherInput.setFocus(true); qApp->inputMethod()->hide(); @@ -3449,7 +3449,7 @@ void tst_qquicktextinput::setHAlignClearCache() QQuickView view; MyTextInput input; input.setText("Hello world"); - input.setParentItem(view.rootItem()); + input.setParentItem(view.contentItem()); view.show(); view.requestActivateWindow(); QTest::qWaitForWindowActive(&view); @@ -3469,8 +3469,8 @@ void tst_qquicktextinput::focusOutClearSelection() QQuickTextInput input2; input.setText(QLatin1String("Hello world")); input.setFocus(true); - input2.setParentItem(view.rootItem()); - input.setParentItem(view.rootItem()); + input2.setParentItem(view.contentItem()); + input.setParentItem(view.contentItem()); input.componentComplete(); input2.componentComplete(); view.show(); @@ -4967,7 +4967,7 @@ void tst_qquicktextinput::keySequence() textInput->setEchoMode(echoMode); QQuickWindow window; - textInput->setParentItem(window.rootItem()); + textInput->setParentItem(window.contentItem()); window.show(); window.requestActivateWindow(); QTest::qWaitForWindowActive(&window); @@ -5128,7 +5128,7 @@ void tst_qquicktextinput::undo() QVERIFY(textInput != 0); QQuickWindow window; - textInput->setParentItem(window.rootItem()); + textInput->setParentItem(window.contentItem()); window.show(); window.requestActivateWindow(); QTest::qWaitForWindowActive(&window); @@ -5214,7 +5214,7 @@ void tst_qquicktextinput::redo() QVERIFY(textInput != 0); QQuickWindow window; - textInput->setParentItem(window.rootItem()); + textInput->setParentItem(window.contentItem()); window.show(); window.requestActivateWindow(); QTest::qWaitForWindowActive(&window); @@ -5546,7 +5546,7 @@ void tst_qquicktextinput::undo_keypressevents() QVERIFY(textInput != 0); QQuickWindow window; - textInput->setParentItem(window.rootItem()); + textInput->setParentItem(window.contentItem()); window.show(); window.requestActivateWindow(); QTest::qWaitForWindowActive(&window); @@ -5953,7 +5953,7 @@ void tst_qquicktextinput::setInputMask() textInput->insert(0, input); } else { QQuickWindow window; - textInput->setParentItem(window.rootItem()); + textInput->setParentItem(window.contentItem()); window.show(); window.requestActivateWindow(); QTest::qWaitForWindowActive(&window); @@ -6083,7 +6083,7 @@ void tst_qquicktextinput::keypress_inputMask() QVERIFY(textInput != 0); QQuickWindow window; - textInput->setParentItem(window.rootItem()); + textInput->setParentItem(window.contentItem()); window.show(); window.requestActivateWindow(); QTest::qWaitForWindowActive(&window); diff --git a/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp index 2b60ac3..78ff64d 100644 --- a/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp +++ b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp @@ -956,7 +956,7 @@ void tst_qquickvisualdatamodel::itemsDestroyed() view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - QVERIFY(delegate = findItem(view.rootItem(), "delegate", 1)); + QVERIFY(delegate = findItem(view.contentItem(), "delegate", 1)); } QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); QVERIFY(!delegate); @@ -3073,7 +3073,7 @@ void tst_qquickvisualdatamodel::insert() QScopedPointer object(component.create()); QQuickListView *listView = qobject_cast(object.data()); QVERIFY(listView); - listView->setParentItem(window.rootItem()); + listView->setParentItem(window.contentItem()); QQuickItem *contentItem = listView->contentItem(); QVERIFY(contentItem); @@ -3537,7 +3537,7 @@ void tst_qquickvisualdatamodel::resolve() QScopedPointer object(component.create()); QQuickListView *listView = qobject_cast(object.data()); QVERIFY(listView); - listView->setParentItem(window.rootItem()); + listView->setParentItem(window.contentItem()); QQuickItem *contentItem = listView->contentItem(); QVERIFY(contentItem); @@ -3937,7 +3937,7 @@ void tst_qquickvisualdatamodel::warnings() QScopedPointer object(component.create()); QQuickListView *listView = qobject_cast(object.data()); QVERIFY(listView); - listView->setParentItem(window.rootItem()); + listView->setParentItem(window.contentItem()); QQuickItem *contentItem = listView->contentItem(); QVERIFY(contentItem); diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp index 04bb580..c108ac4 100644 --- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp +++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp @@ -120,11 +120,11 @@ public: , m_rootItem(0) { } - Q_INVOKABLE QQuickItem *rootItem() + Q_INVOKABLE QQuickItem *contentItem() { if (!m_rootItem) { QQuickWindowPrivate *c = QQuickWindowPrivate::get(window()); - m_rootItem = c->rootItem; + m_rootItem = c->contentItem; QObject::connect(m_rootItem, SIGNAL(destroyed()), this, SLOT(rootItemDestroyed())); } return m_rootItem; @@ -326,7 +326,7 @@ void tst_qquickwindow::constantUpdates() { QQuickWindow window; window.resize(250, 250); - ConstantUpdateItem item(window.rootItem()); + ConstantUpdateItem item(window.contentItem()); window.show(); QTRY_VERIFY(item.iterations > 60); } @@ -343,7 +343,7 @@ void tst_qquickwindow::touchEvent_basic() window->show(); QVERIFY(QTest::qWaitForWindowExposed(window)); - TestTouchItem *bottomItem = new TestTouchItem(window->rootItem()); + TestTouchItem *bottomItem = new TestTouchItem(window->contentItem()); bottomItem->setObjectName("Bottom Item"); bottomItem->setSize(QSizeF(150, 150)); @@ -472,7 +472,7 @@ void tst_qquickwindow::touchEvent_propagation() window->show(); QVERIFY(QTest::qWaitForWindowExposed(window)); - TestTouchItem *bottomItem = new TestTouchItem(window->rootItem()); + TestTouchItem *bottomItem = new TestTouchItem(window->contentItem()); bottomItem->setObjectName("Bottom Item"); bottomItem->setSize(QSizeF(150, 150)); @@ -605,7 +605,7 @@ void tst_qquickwindow::touchEvent_cancel() window->show(); QVERIFY(QTest::qWaitForWindowExposed(window)); - TestTouchItem *item = new TestTouchItem(window->rootItem()); + TestTouchItem *item = new TestTouchItem(window->contentItem()); item->setPos(QPointF(50, 50)); item->setSize(QSizeF(150, 150)); @@ -638,7 +638,7 @@ void tst_qquickwindow::touchEvent_reentrant() window->show(); QVERIFY(QTest::qWaitForWindowExposed(window)); - TestTouchItem *item = new TestTouchItem(window->rootItem()); + TestTouchItem *item = new TestTouchItem(window->contentItem()); item->spinLoopWhenPressed = true; // will call processEvents() from the touch handler @@ -676,7 +676,7 @@ void tst_qquickwindow::touchEvent_velocity() QVERIFY(QTest::qWaitForWindowExposed(window)); QTest::qWait(10); - TestTouchItem *item = new TestTouchItem(window->rootItem()); + TestTouchItem *item = new TestTouchItem(window->contentItem()); item->setPos(QPointF(50, 50)); item->setSize(QSizeF(150, 150)); @@ -732,7 +732,7 @@ void tst_qquickwindow::mouseFromTouch_basic() QVERIFY(QTest::qWaitForWindowExposed(window)); QTest::qWait(10); - TestTouchItem *item = new TestTouchItem(window->rootItem()); + TestTouchItem *item = new TestTouchItem(window->contentItem()); item->setPos(QPointF(50, 50)); item->setSize(QSizeF(150, 150)); item->acceptTouchEvents = false; @@ -788,7 +788,7 @@ void tst_qquickwindow::clearWindow() { QQuickWindow *window = new QQuickWindow; QQuickItem *item = new QQuickItem; - item->setParentItem(window->rootItem()); + item->setParentItem(window->contentItem()); QVERIFY(item->window() == window); @@ -810,7 +810,7 @@ void tst_qquickwindow::mouseFiltering() window->show(); QVERIFY(QTest::qWaitForWindowExposed(window)); - TestTouchItem *bottomItem = new TestTouchItem(window->rootItem()); + TestTouchItem *bottomItem = new TestTouchItem(window->contentItem()); bottomItem->setObjectName("Bottom Item"); bottomItem->setSize(QSizeF(150, 150)); @@ -1018,7 +1018,7 @@ void tst_qquickwindow::ignoreUnhandledMouseEvents() QQuickItem* item = new QQuickItem; item->setSize(QSizeF(100, 100)); - item->setParentItem(window->rootItem()); + item->setParentItem(window->contentItem()); { QMouseEvent me(QEvent::MouseButtonPress, QPointF(50, 50), Qt::LeftButton, Qt::LeftButton, @@ -1079,7 +1079,7 @@ void tst_qquickwindow::cursor() QQuickItem parentItem; parentItem.setPos(QPointF(0, 0)); parentItem.setSize(QSizeF(180, 180)); - parentItem.setParentItem(window.rootItem()); + parentItem.setParentItem(window.contentItem()); QQuickItem childItem; childItem.setPos(QPointF(60, 90)); @@ -1090,7 +1090,7 @@ void tst_qquickwindow::cursor() clippingItem.setPos(QPointF(120, 120)); clippingItem.setSize(QSizeF(180, 180)); clippingItem.setClip(true); - clippingItem.setParentItem(window.rootItem()); + clippingItem.setParentItem(window.contentItem()); QQuickItem clippedItem; clippedItem.setPos(QPointF(-30, -30)); -- 2.7.4