From f21e9ba6efa2b1c8169491db271f79b87b5b0ce4 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 7 Aug 2012 11:26:37 +1000 Subject: 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> --- 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 +- 8 files changed, 46 insertions(+), 109 deletions(-) delete mode 100644 src/quick/items/qquickcanvas.h (limited to 'src/quick') 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(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 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 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 parentlessItems; QQmlListProperty data(); -- cgit v1.2.3