From: Gunnar Sletta Date: Wed, 31 Aug 2011 06:55:16 +0000 (+0200) Subject: Merge branch 'master' into refactor X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=71478352376022faa9be6d79f2a760c289945ff5;p=konrad%2Fqtdeclarative.git Merge branch 'master' into refactor Conflicts: src/3rdparty/v8 src/declarative/declarative.pro src/declarative/items/qsgcanvas.cpp src/declarative/items/qsgshadereffectsource_p.h src/declarative/items/qsgview.cpp src/declarative/particles/qsgcustomparticle.cpp src/imports/gestures/gestures.pro src/imports/particles/particles.pro src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro src/qtquick1/qtquick1.pro tests/auto/declarative/examples/examples.pro tests/auto/declarative/qsglistview/qsglistview.pro tests/auto/qtquick1/qdeclarativeviewer/qdeclarativeviewer.pro Change-Id: I423344f83e1835116cad531b877fde6e68a8849a --- 71478352376022faa9be6d79f2a760c289945ff5 diff --cc src/declarative/declarative.pro index 89b9452,22907d8..5db77a7 --- a/src/declarative/declarative.pro +++ b/src/declarative/declarative.pro @@@ -6,8 -6,7 +6,8 @@@ QPRO_PWD = $$PW CONFIG += module MODULE_PRI += ../../modules/qt_declarative.pri - QT = core-private gui gui-private network widgets-private sql -QT = core-private gui-private network opengl-private v8-private ++QT = core-private gui gui-private network widgets-private sql v8-private + contains(QT_CONFIG, svg): QT += svg DEFINES += QT_BUILD_DECLARATIVE_LIB QT_NO_URL_CAST_FROM_STRING win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000 diff --cc src/declarative/items/qsgcanvas.cpp index 8ff7d17,845617c..95ee95d --- a/src/declarative/items/qsgcanvas.cpp +++ b/src/declarative/items/qsgcanvas.cpp @@@ -153,17 -72,17 +153,17 @@@ public Focus behavior ============== --Prior to being added to a valid canvas items can set and clear focus with no ++Prior to being added to a valid canvas items can set and clear focus with no effect. Only once items are added to a canvas (by way of having a parent set that --already belongs to a canvas) do the focus rules apply. Focus goes back to ++already belongs to a canvas) do the focus rules apply. Focus goes back to having no effect if an item is removed from a canvas. When an item is moved into a new focus scope (either being added to a canvas --for the first time, or having its parent changed), if the focus scope already has ++for the first time, or having its parent changed), if the focus scope already has a scope focused item that takes precedence over the item being added. Otherwise, --the focus of the added tree is used. In the case of of a tree of items being ++the focus of the added tree is used. In the case of of a tree of items being added to a canvas for the first time, which may have a conflicted focus state (two --or more items in one scope having focus set), the same rule is applied item by item - ++or more items in one scope having focus set), the same rule is applied item by item - thus the first item that has focus will get it (assuming the scope doesn't already have a scope focused item), and the other items will have their focus cleared. */ @@@ -478,7 -478,7 +478,7 @@@ void QSGCanvasPrivate::sceneMouseEventF sceneEvent.setLastPos(transform.map(sceneEvent.lastScenePos())); for (int ii = 0; ii < 5; ++ii) { if (sceneEvent.buttons() & (1 << ii)) { -- sceneEvent.setButtonDownPos((Qt::MouseButton)(1 << ii), ++ sceneEvent.setButtonDownPos((Qt::MouseButton)(1 << ii), transform.map(sceneEvent.buttonDownScenePos((Qt::MouseButton)(1 << ii)))); } } @@@ -692,7 -695,7 +692,7 @@@ void QSGCanvasPrivate::setFocusInScope( updateInputMethodData(); QFocusEvent event(QEvent::FocusIn, Qt::OtherFocusReason); -- q->sendEvent(newActiveFocusItem, &event); ++ q->sendEvent(newActiveFocusItem, &event); } else { updateInputMethodData(); } @@@ -778,12 -782,12 +778,12 @@@ void QSGCanvasPrivate::clearFocusInScop updateInputMethodData(); QFocusEvent event(QEvent::FocusIn, Qt::OtherFocusReason); -- q->sendEvent(newActiveFocusItem, &event); ++ q->sendEvent(newActiveFocusItem, &event); } else { updateInputMethodData(); } -- if (!changed.isEmpty()) ++ if (!changed.isEmpty()) notifyFocusChangesRecur(changed.data(), changed.count() - 1); } @@@ -807,7 -811,7 +807,7 @@@ void QSGCanvasPrivate::notifyFocusChang itemPrivate->itemChange(QSGItem::ItemActiveFocusHasChanged, itemPrivate->activeFocus); emit item->activeFocusChanged(itemPrivate->activeFocus); } -- } ++ } } void QSGCanvasPrivate::updateInputMethodData() @@@ -891,21 -933,21 +891,21 @@@ QSGCanvas::~QSGCanvas( QSGItem *QSGCanvas::rootItem() const { Q_D(const QSGCanvas); -- ++ return d->rootItem; } QSGItem *QSGCanvas::activeFocusItem() const { Q_D(const QSGCanvas); -- ++ return d->activeFocusItem; } QSGItem *QSGCanvas::mouseGrabberItem() const { Q_D(const QSGCanvas); -- ++ return d->mouseGrabberItem; } @@@ -1016,7 -1081,7 +1016,7 @@@ bool QSGCanvasPrivate::deliverInitialMo event->accept(); mouseGrabberItem = item; q->sendEvent(item, event); -- if (event->isAccepted()) ++ if (event->isAccepted()) return true; mouseGrabberItem->ungrabMouse(); mouseGrabberItem = 0; @@@ -1030,10 -1095,10 +1030,10 @@@ bool QSGCanvasPrivate::deliverMouseEven { Q_Q(QSGCanvas); -- if (!mouseGrabberItem && ++ if (!mouseGrabberItem && sceneEvent->type() == QEvent::GraphicsSceneMousePress && (sceneEvent->button() & sceneEvent->buttons()) == sceneEvent->buttons()) { -- ++ return deliverInitialMousePressEvent(rootItem, sceneEvent); } @@@ -1053,7 -1118,7 +1053,7 @@@ void QSGCanvas::mousePressEvent(QMouseEvent *event) { Q_D(QSGCanvas); -- ++ #ifdef MOUSE_DEBUG qWarning() << "QSGCanvas::mousePressEvent()" << event->pos() << event->button() << event->buttons(); #endif @@@ -1068,7 -1133,7 +1068,7 @@@ void QSGCanvas::mouseReleaseEvent(QMouseEvent *event) { Q_D(QSGCanvas); -- ++ #ifdef MOUSE_DEBUG qWarning() << "QSGCanvas::mouseReleaseEvent()" << event->pos() << event->button() << event->buttons(); #endif @@@ -1090,7 -1155,7 +1090,7 @@@ void QSGCanvas::mouseDoubleClickEvent(QMouseEvent *event) { Q_D(QSGCanvas); -- ++ #ifdef MOUSE_DEBUG qWarning() << "QSGCanvas::mouseDoubleClickEvent()" << event->pos() << event->button() << event->buttons(); #endif @@@ -1104,7 -1169,7 +1104,7 @@@ else event->ignore(); return; -- } ++ } d->deliverMouseEvent(&sceneEvent); event->setAccepted(sceneEvent.isAccepted()); @@@ -1129,7 -1194,7 +1129,7 @@@ bool QSGCanvasPrivate::sendHoverEvent(Q void QSGCanvas::mouseMoveEvent(QMouseEvent *event) { Q_D(QSGCanvas); -- ++ #ifdef MOUSE_DEBUG qWarning() << "QSGCanvas::mouseMoveEvent()" << event->pos() << event->button() << event->buttons(); #endif @@@ -1505,17 -1568,17 +1503,17 @@@ bool QSGCanvasPrivate::sendFilteredMous return true; QSGItemPrivate *targetPrivate = QSGItemPrivate::get(target); -- if (targetPrivate->filtersChildMouseEvents) ++ if (targetPrivate->filtersChildMouseEvents) if (target->childMouseEventFilter(item, event)) return true; return false; } --bool QSGCanvas::sendEvent(QSGItem *item, QEvent *e) --{ ++bool QSGCanvas::sendEvent(QSGItem *item, QEvent *e) ++{ Q_D(QSGCanvas); -- ++ if (!item) { qWarning("QSGCanvas::sendEvent: Cannot send event to a null item"); return false; @@@ -1549,7 -1612,7 +1547,7 @@@ case QEvent::GraphicsSceneMouseRelease: case QEvent::GraphicsSceneMouseDoubleClick: case QEvent::GraphicsSceneMouseMove: -- // XXX todo - should sendEvent be doing this? how does it relate to forwarded events? ++ // XXX todo - should sendEvent be doing this? how does it relate to forwarded events? { QGraphicsSceneMouseEvent *se = static_cast(e); if (!d->sendFilteredMouseEvent(item->parentItem(), item, se)) { @@@ -1581,7 -1644,7 +1579,7 @@@ break; } -- return false; ++ return false; } void QSGCanvasPrivate::cleanupNodes() @@@ -1626,12 -1689,12 +1624,12 @@@ void QSGCanvasPrivate::updateDirtyNode( itemPriv->dirtyAttributes = 0; if ((dirty & QSGItemPrivate::TransformUpdateMask) || -- (dirty & QSGItemPrivate::Size && itemPriv->origin != QSGItem::TopLeft && ++ (dirty & QSGItemPrivate::Size && itemPriv->origin != QSGItem::TopLeft && (itemPriv->scale != 1. || itemPriv->rotation != 0.))) { QMatrix4x4 matrix; -- if (itemPriv->x != 0. || itemPriv->y != 0.) ++ if (itemPriv->x != 0. || itemPriv->y != 0.) matrix.translate(itemPriv->x, itemPriv->y); for (int ii = itemPriv->transforms.count() - 1; ii >= 0; --ii) @@@ -1779,10 -1842,10 +1777,10 @@@ if (dirty & QSGItemPrivate::ContentUpdateMask) { if (itemPriv->flags & QSGItem::ItemHasContents) { -- updatePaintNodeData.transformNode = itemPriv->itemNode(); ++ updatePaintNodeData.transformNode = itemPriv->itemNode(); itemPriv->paintNode = item->updatePaintNode(itemPriv->paintNode, &updatePaintNodeData); -- Q_ASSERT(itemPriv->paintNode == 0 || ++ Q_ASSERT(itemPriv->paintNode == 0 || itemPriv->paintNode->parent() == 0 || itemPriv->paintNode->parent() == itemPriv->childContainerNode()); @@@ -1950,14 -2029,12 +1948,14 @@@ void QSGCanvasRenderThread::run( qDebug("QML Rendering Thread Started"); #endif - renderer->makeCurrent(); - - if (!d->context->isReady()) - d->initializeSceneGraph(); + if (!glContext()) { + createGLContext(); + makeCurrent(); + initializeSceneGraph(); + } else { + makeCurrent(); + } - + - while (!shouldExit) { lock(); diff --cc src/declarative/items/qsgshadereffectsource_p.h index 6cb76dd,0cb449a..77cb412 --- a/src/declarative/items/qsgshadereffectsource_p.h +++ b/src/declarative/items/qsgshadereffectsource_p.h @@@ -116,7 -114,7 +116,8 @@@ public void scheduleUpdate(); + void scheduleForCleanup(); + QImage toImage() const; Q_SIGNALS: void textureChanged(); diff --cc src/declarative/items/qsgview.cpp index 48b3074,e2fb42e..236fd4e --- a/src/declarative/items/qsgview.cpp +++ b/src/declarative/items/qsgview.cpp @@@ -52,47 -53,16 +53,15 @@@ #include #include - // XXX todo - This whole class should probably be merged with QDeclarativeView for + -// XXX todo - This whole class should probably be merged with QDeclarativeView for ++// XXX todo - This whole class should probably be merged with QDeclarativeView for // maximum seamlessness QT_BEGIN_NAMESPACE DEFINE_BOOL_CONFIG_OPTION(frameRateDebug, QML_SHOW_FRAMERATE) - class QSGViewPrivate : public QSGCanvasPrivate, - public QSGItemChangeListener - { - Q_DECLARE_PUBLIC(QSGView) - public: - QSGViewPrivate(); - ~QSGViewPrivate(); - - void execute(); - void itemGeometryChanged(QSGItem *item, const QRectF &newGeometry, const QRectF &oldGeometry); - void initResize(); - void updateSize(); - void setRootObject(QObject *); - - void init(); - - QSize rootObjectSize() const; - - QPointer root; - - QUrl source; - - QDeclarativeEngine engine; - QDeclarativeComponent *component; - QBasicTimer resizetimer; - - QSGView::ResizeMode resizeMode; - QSize initialSize; - QElapsedTimer frameTimer; - - bool resized; - }; - void QSGViewPrivate::init() { - q_func()->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred); QDeclarativeEnginePrivate::get(&engine)->sgContext = QSGCanvasPrivate::context; QDeclarativeInspectorService::instance()->addView(q_func()); @@@ -103,8 -73,8 +72,8 @@@ QSGViewPrivate::QSGViewPrivate( { } --QSGViewPrivate::~QSGViewPrivate() --{ ++QSGViewPrivate::~QSGViewPrivate() ++{ QDeclarativeInspectorService::instance()->removeView(q_func()); delete root; @@@ -126,7 -96,7 +95,7 @@@ void QSGViewPrivate::execute( if (!component->isLoading()) { q->continueExecute(); } else { -- QObject::connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), ++ QObject::connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), q, SLOT(continueExecute())); } } @@@ -397,10 -381,26 +366,10 @@@ QSGItem *QSGView::rootObject() cons void QSGView::resizeEvent(QResizeEvent *e) { Q_D(QSGView); -- if (d->resizeMode == SizeRootObjectToView) ++ if (d->resizeMode == SizeRootObjectToView) d->updateSize(); -- - QSGCanvas::resizeEvent(e); -} + -/*! - \internal -*/ -void QSGView::paintEvent(QPaintEvent *event) -{ - Q_D(QSGView); - int time = 0; - if (frameRateDebug()) - time = d->frameTimer.restart(); - - QSGCanvas::paintEvent(event); - - if (frameRateDebug()) - qDebug() << "paintEvent:" << d->frameTimer.elapsed() << "time since last frame:" << time; + QSGCanvas::resizeEvent(e); } void QSGView::keyPressEvent(QKeyEvent *e) diff --cc src/declarative/items/qsgview_p.h index c08f6fd,8b2ee88..3f8d69e --- a/src/declarative/items/qsgview_p.h +++ b/src/declarative/items/qsgview_p.h @@@ -48,20 -58,45 +58,47 @@@ QT_BEGIN_HEADE QT_BEGIN_NAMESPACE - class QJSEngine; - class QDeclarativeEngine; + QT_MODULE(Declarative) + + class QDeclarativeContext; + class QDeclarativeError; + class QSGItem; + class QDeclarativeComponent; - // Helper methods to access private API through a stable interface - // This is used in the qmljsdebugger library of QtCreator. - class Q_DECLARATIVE_EXPORT QDeclarativeDebugHelper + class QSGViewPrivate : public QSGCanvasPrivate, + public QSGItemChangeListener { + Q_DECLARE_PUBLIC(QSGView) public: - static QJSEngine *getScriptEngine(QDeclarativeEngine *engine); - static void setAnimationSlowDownFactor(qreal factor); + static QSGViewPrivate* get(QSGView *view) { return view->d_func(); } + static const QSGViewPrivate* get(const QSGView *view) { return view->d_func(); } + + QSGViewPrivate(); + ~QSGViewPrivate(); + + void execute(); + void itemGeometryChanged(QSGItem *item, const QRectF &newGeometry, const QRectF &oldGeometry); + void initResize(); + void updateSize(); + void setRootObject(QObject *); + + void init(); + + QSize rootObjectSize() const; + + QPointer root; + + QUrl source; + + QDeclarativeEngine engine; + QDeclarativeComponent *component; + QBasicTimer resizetimer; + + QSGView::ResizeMode resizeMode; + QSize initialSize; + QElapsedTimer frameTimer; + - // Enables remote debugging functionality - // Only use this for debugging in a safe environment! - static void enableDebugging(); ++ bool resized; }; QT_END_NAMESPACE diff --cc src/declarative/particles/qsgcustomparticle.cpp index db544d2,11bc7e3..12d32a2 --- a/src/declarative/particles/qsgcustomparticle.cpp +++ b/src/declarative/particles/qsgcustomparticle.cpp @@@ -438,12 -457,8 +465,14 @@@ QSGShaderEffectNode* QSGCustomParticle: s.fragmentCode = qt_particles_default_fragment_code; if (s.vertexCode.isEmpty()) s.vertexCode = qt_particles_default_vertex_code; + + if (!m_material) { + m_material = new QSGShaderEffectMaterialObject; + } + + s.vertexCode = qt_particles_template_vertex_code + s.vertexCode; - m_material.setProgramSource(s); + m_material->setProgramSource(s); ++ foreach (const QString &str, m_particles){ int gIdx = m_system->m_groupIds[str]; int count = m_system->m_groupData[gIdx]->size(); diff --cc src/imports/gestures/gestures.pro index 3b735ef,45483fc..e709595 --- a/src/imports/gestures/gestures.pro +++ b/src/imports/gestures/gestures.pro @@@ -2,7 -2,7 +2,7 @@@ TARGET = qmlgesturesplugi TARGETPATH = Qt/labs/gestures include(../qimportbase.pri) - QT += core-private gui-private declarative-private qtquick1 qtquick1-private widgets-private -QT += core-private gui-private v8-private declarative-private qtquick1 qtquick1-private ++QT += core-private gui-private declarative-private qtquick1 qtquick1-private widgets-private v8-private SOURCES += qdeclarativegesturearea.cpp plugin.cpp HEADERS += qdeclarativegesturearea_p.h diff --cc src/imports/particles/particles.pro index 7990656,e054796..74dab8d --- a/src/imports/particles/particles.pro +++ b/src/imports/particles/particles.pro @@@ -9,7 -9,7 +9,7 @@@ SOURCES += particles.cpp \ V1/qdeclarativeparticles.cpp - QT += declarative opengl core gui declarative-private core-private gui-private qtquick1 qtquick1-private widgets-private -QT += declarative opengl core gui v8-private declarative-private core-private gui-private qtquick1 qtquick1-private ++QT += declarative opengl core gui declarative-private core-private gui-private qtquick1 qtquick1-private widgets-private v8-private OTHER_FILES += \ qmldir diff --cc src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.cpp index 3cb35e5,03cd794..8dcc076 --- a/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.cpp @@@ -47,10 -47,10 +47,10 @@@ #include #include - #include + #include #include "QtDeclarative/private/qdeclarativeinspectorservice_p.h" -#include +#include #include #include diff --cc src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro index d547422,3af872d..c165832 --- a/src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro +++ b/src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro @@@ -1,7 -1,7 +1,7 @@@ load(qt_module) TARGET = qmldbg_inspector - QT += declarative-private core-private gui-private opengl-private qtquick1 widgets widgets-private -QT += declarative-private core-private gui-private v8-private opengl-private qtquick1 ++QT += declarative-private core-private gui-private opengl-private qtquick1 widgets widgets-private v8-private load(qt_plugin) diff --cc src/qtquick1/qtquick1.pro index 2e3113e,8e44d9c..66f2c84 --- a/src/qtquick1/qtquick1.pro +++ b/src/qtquick1/qtquick1.pro @@@ -7,7 -7,8 +7,8 @@@ CONFIG += modul CONFIG += dll warn_on MODULE_PRI += ../../modules/qt_qtquick1.pri - QT += testlib-private declarative testlib declarative-private core-private gui-private network widgets-private -QT += testlib-private declarative testlib declarative-private core-private gui-private network v8-private ++QT += testlib-private declarative testlib declarative-private core-private gui-private network widgets-private v8-private + DEFINES += QT_NO_URL_CAST_FROM_STRING load(qt_module_config) diff --cc tests/auto/declarative/examples/examples.pro index 297559e,a19700c..75adbb5 --- a/tests/auto/declarative/examples/examples.pro +++ b/tests/auto/declarative/examples/examples.pro @@@ -18,6 -18,6 +18,6 @@@ symbian: CONFIG += parallel_test - QT += core-private gui-private declarative-private qtquick1-private widgets-private -QT += core-private gui-private v8-private declarative-private qtquick1-private ++QT += core-private gui-private declarative-private qtquick1-private widgets-private v8-private qpa:CONFIG+=insignificant_test # QTBUG-20990, aborts diff --cc tests/auto/declarative/qsglistview/qsglistview.pro index 3e18e9b,4f1b0e1..4c78188 --- a/tests/auto/declarative/qsglistview/qsglistview.pro +++ b/tests/auto/declarative/qsglistview/qsglistview.pro @@@ -14,5 -14,5 +14,5 @@@ symbian: } CONFIG += parallel_test - QT += core-private gui-private declarative-private widgets widgets-private -QT += core-private gui-private v8-private declarative-private ++QT += core-private gui-private declarative-private widgets widgets-private v8-private QT += opengl-private diff --cc tests/auto/qtquick1/qdeclarativeviewer/qdeclarativeviewer.pro index ca214b1,20d154a..67be35f --- a/tests/auto/qtquick1/qdeclarativeviewer/qdeclarativeviewer.pro +++ b/tests/auto/qtquick1/qdeclarativeviewer/qdeclarativeviewer.pro @@@ -17,4 -17,4 +17,4 @@@ symbian: } CONFIG += parallel_test - QT += core-private gui-private declarative-private qtquick1-private widgets-private -QT += core-private gui-private v8-private declarative-private qtquick1-private ++QT += core-private gui-private declarative-private qtquick1-private widgets-private v8-private