diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2012-08-07 11:26:37 +1000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-10-16 07:24:06 +0200 |
commit | f21e9ba6efa2b1c8169491db271f79b87b5b0ce4 (patch) | |
tree | 6eabf1ad37e12247f210e3fe77f64abf6255aa56 /src | |
parent | cc39a7d7affe37741292989c634aec3f60660c0e (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/accessible/quick/qaccessiblequickview.cpp | 4 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_qtquick2/highlight.cpp | 22 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp | 58 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.h | 2 | ||||
-rw-r--r-- | src/plugins/qmltooling/qmldbg_qtquick2/qquickviewinspector.cpp | 6 | ||||
-rw-r--r-- | src/qmltest/quicktestresult.cpp | 2 | ||||
-rw-r--r-- | src/quick/items/items.pri | 1 | ||||
-rw-r--r-- | src/quick/items/qquickcanvas.h | 58 | ||||
-rw-r--r-- | src/quick/items/qquickitem.h | 2 | ||||
-rw-r--r-- | src/quick/items/qquickmousearea.cpp | 2 | ||||
-rw-r--r-- | src/quick/items/qquickview.cpp | 2 | ||||
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 84 | ||||
-rw-r--r-- | src/quick/items/qquickwindow.h | 2 | ||||
-rw-r--r-- | src/quick/items/qquickwindow_p.h | 4 |
14 files changed, 93 insertions, 156 deletions
diff --git a/src/plugins/accessible/quick/qaccessiblequickview.cpp b/src/plugins/accessible/quick/qaccessiblequickview.cpp index d7f2b943c3..764db834d2 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 3d316005c5..d6fc0b27a5 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 69b2dd4e21..8cd40b4e0c 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<QQuickItem*>()); // 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 dabb41e549..5c480697af 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<QQuickItem> m_rootItem; + QPointer<QQuickItem> 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 1cb24064f1..4f6ee51c5d 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<QQuickItem *> QQuickViewInspector::itemsAt(const QPointF &pos) const { - QQuickItem *root = m_view->rootItem(); + QQuickItem *root = m_view->contentItem(); QList<QQuickItem *> resultList; collectItemsAt(root, root->mapFromScene(pos), m_overlay, resultList); diff --git a/src/qmltest/quicktestresult.cpp b/src/qmltest/quicktestresult.cpp index 8a15062cd6..4344fb6b5e 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 a73766895e..13abf7b958 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 907cf30752..0000000000 --- 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 75a8a8ecd5..fa6aa62907 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 e4c821f046..803840aeaf 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 f3610ea53a..7182e74c0c 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<QQuickItem *>(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 7cc645f48a..f1cfdf8597 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<QObject> 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<QQuickItem *, 20> 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<QQuickItem *, 20> 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<int> 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<QQuickItem *>::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 62b0aa3945..7f9af82d88 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 530e547f3e..fdf5fe2abb 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<QQuickItem *> parentlessItems; QQmlListProperty<QObject> data(); |