From 90ff2cdea3126bdff2746ecf868004711ea628b1 Mon Sep 17 00:00:00 2001 From: axis Date: Wed, 27 Apr 2011 12:34:43 +0200 Subject: Added dependency information to the sync.profile. --- sync.profile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/sync.profile b/sync.profile index 77da8d8003..42ea13d9c3 100644 --- a/sync.profile +++ b/sync.profile @@ -13,3 +13,20 @@ %modulepris = ( "QtDeclarative" => "$basedir/modules/qt_declarative.pri", ); +# Modules and programs, and their dependencies. +# Each of the module version specifiers can take one of the following values: +# - A specific Git revision. +# - "LATEST_REVISION", to always test against the latest revision. +# - "LATEST_RELEASE", to always test against the latest public release. +# - "THIS_REPOSITORY", to indicate that the module is in this repository. +%dependencies = ( + "QtDeclarative" => { + "QtScript" => "4d15ca64fc7ca81bdadba9fbeb84d4e98a6c0edc", + "QtSvg" => "1a71611b6ceaf6cdb24ea485a818fc56c956b5f8", + "QtGui" => "0c637cb07ba3c9b353e7e483a209537485cc4e2a", + "QtXmlPatterns" => "26edd6852a62aeec49712a53dcc8d4093192301c", + "QtNetwork" => "0c637cb07ba3c9b353e7e483a209537485cc4e2a", + "QtSql" => "0c637cb07ba3c9b353e7e483a209537485cc4e2a", + "QtCore" => "0c637cb07ba3c9b353e7e483a209537485cc4e2a", + }, +); -- cgit v1.2.3 From 6f6898e775520efe34094af062ddd62b1baaba36 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 28 Apr 2011 08:37:57 +0200 Subject: Don't round flickable positions while panning --- src/declarative/items/qsgflickable.cpp | 12 ++++++------ src/declarative/items/qsgflickable_p_p.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/declarative/items/qsgflickable.cpp b/src/declarative/items/qsgflickable.cpp index e2f6fff71b..ebbec5e51c 100644 --- a/src/declarative/items/qsgflickable.cpp +++ b/src/declarative/items/qsgflickable.cpp @@ -137,8 +137,8 @@ void QSGFlickableVisibleArea::updateVisible() QSGFlickablePrivate::QSGFlickablePrivate() : contentItem(new QSGItem) - , hData(this, &QSGFlickablePrivate::setRoundedViewportX) - , vData(this, &QSGFlickablePrivate::setRoundedViewportY) + , hData(this, &QSGFlickablePrivate::setViewportX) + , vData(this, &QSGFlickablePrivate::setViewportY) , flickingHorizontally(false), flickingVertically(false) , hMoved(false), vMoved(false) , movingHorizontally(false), movingVertically(false) @@ -823,14 +823,14 @@ void QSGFlickablePrivate::clearDelayedPress() } } -void QSGFlickablePrivate::setRoundedViewportX(qreal x) +void QSGFlickablePrivate::setViewportX(qreal x) { - contentItem->setX(qRound(x)); + contentItem->setX(x); } -void QSGFlickablePrivate::setRoundedViewportY(qreal y) +void QSGFlickablePrivate::setViewportY(qreal y) { - contentItem->setY(qRound(y)); + contentItem->setY(y); } void QSGFlickable::timerEvent(QTimerEvent *event) diff --git a/src/declarative/items/qsgflickable_p_p.h b/src/declarative/items/qsgflickable_p_p.h index 2861bfd5b3..fec78c081b 100644 --- a/src/declarative/items/qsgflickable_p_p.h +++ b/src/declarative/items/qsgflickable_p_p.h @@ -128,8 +128,8 @@ public: void captureDelayedPress(QGraphicsSceneMouseEvent *event); void clearDelayedPress(); - void setRoundedViewportX(qreal x); - void setRoundedViewportY(qreal y); + void setViewportX(qreal x); + void setViewportY(qreal y); qreal overShootDistance(qreal velocity, qreal size); -- cgit v1.2.3 From 4633c2681c5b4ce7c6d57c42c01e7843c7836720 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 28 Apr 2011 09:13:06 +0200 Subject: Added a runtime option to enable consistent timing for animations --- src/declarative/items/qsgcanvas.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/declarative/items/qsgcanvas.cpp b/src/declarative/items/qsgcanvas.cpp index 5fc5c76d1d..5d5c49d981 100644 --- a/src/declarative/items/qsgcanvas.cpp +++ b/src/declarative/items/qsgcanvas.cpp @@ -48,6 +48,8 @@ #include #include +#include + #include #include #include @@ -60,6 +62,7 @@ QT_BEGIN_NAMESPACE DEFINE_BOOL_CONFIG_OPTION(qmlThreadedRenderer, QML_THREADED_RENDERER) +DEFINE_BOOL_CONFIG_OPTION(qmlFixedAnimationStep, QML_FIXED_ANIMATION_STEP) /* Focus behavior @@ -332,8 +335,8 @@ void QSGCanvasPrivate::renderSceneGraph() #ifdef FRAME_TIMING - int pixel; - glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &pixel); +// int pixel; +// glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &pixel); readbackTime = frameTimer.elapsed(); #endif @@ -477,6 +480,8 @@ QSGCanvasPrivate::~QSGCanvasPrivate() void QSGCanvasPrivate::init(QSGCanvas *c) { + QUnifiedTimer::instance(true)->setConsistentTiming(qmlFixedAnimationStep()); + q_ptr = c; Q_Q(QSGCanvas); -- cgit v1.2.3 From 3f872cd6899fe53ed2549f7d2d9b0c902721f667 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Mon, 2 May 2011 07:13:00 +0200 Subject: Timing for renderers --- .../scenegraph/coreapi/qsgdefaultrenderer.cpp | 70 ++++++++++++++++++++++ src/declarative/scenegraph/coreapi/qsgrenderer.cpp | 3 +- 2 files changed, 71 insertions(+), 2 deletions(-) diff --git a/src/declarative/scenegraph/coreapi/qsgdefaultrenderer.cpp b/src/declarative/scenegraph/coreapi/qsgdefaultrenderer.cpp index 05e502535a..8b8eebcce1 100644 --- a/src/declarative/scenegraph/coreapi/qsgdefaultrenderer.cpp +++ b/src/declarative/scenegraph/coreapi/qsgdefaultrenderer.cpp @@ -48,9 +48,18 @@ #include #include #include +#include //#define FORCE_NO_REORDER +// #define RENDERER_DEBUG +#ifdef RENDERER_DEBUG +#define DEBUG_THRESHOLD 0 +QElapsedTimer debugTimer; +int materialChanges; +int geometryNodesDrawn; +#endif + QT_BEGIN_NAMESPACE static bool nodeLessThan(QSGGeometryNode *a, QSGGeometryNode *b) @@ -187,6 +196,13 @@ void QMLRenderer::render() } #endif +#ifdef RENDERER_DEBUG + debugTimer.invalidate(); + debugTimer.start(); + geometryNodesDrawn = 0; + materialChanges = 0; +#endif + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); glDisable(GL_BLEND); @@ -205,8 +221,16 @@ void QMLRenderer::render() glDisable(GL_SCISSOR_TEST); glClearColor(m_clear_color.redF(), m_clear_color.greenF(), m_clear_color.blueF(), m_clear_color.alphaF()); +#ifdef RENDERER_DEBUG + int debugtimeSetup = debugTimer.elapsed(); +#endif + bindable()->clear(clearMode()); +#ifdef RENDERER_DEBUG + int debugtimeClear = debugTimer.elapsed(); +#endif + QRect r = viewportRect(); glViewport(r.x(), deviceRect().bottom() - r.bottom(), r.width(), r.height()); m_projectionMatrix = projectMatrix(); @@ -228,6 +252,11 @@ void QMLRenderer::render() m_rebuild_lists = false; } +#ifdef RENDERER_DEBUG + int debugtimeLists = debugTimer.elapsed(); +#endif + + if (m_needs_sorting) { qSort(m_opaqueNodes.begin(), m_opaqueNodes.end(), m_sort_front_to_back @@ -236,6 +265,10 @@ void QMLRenderer::render() m_needs_sorting = false; } +#ifdef RENDERER_DEBUG + int debugtimeSorting = debugTimer.elapsed(); +#endif + m_renderOrderMatrix.setToIdentity(); m_renderOrderMatrix.scale(1, 1, qreal(1) / m_currentRenderOrder); @@ -252,6 +285,12 @@ void QMLRenderer::render() renderNodes(m_opaqueNodes); } +#ifdef RENDERER_DEBUG + int debugtimeOpaque = debugTimer.elapsed(); + int opaqueNodes = geometryNodesDrawn; + int opaqueMaterialChanges = materialChanges; +#endif + glEnable(GL_BLEND); glDepthMask(false); #ifdef QML_RUNTIME_TESTING @@ -265,10 +304,33 @@ void QMLRenderer::render() renderNodes(m_transparentNodes); } +#ifdef RENDERER_DEBUG + int debugtimeAlpha = debugTimer.elapsed(); +#endif + + if (m_currentProgram) m_currentProgram->deactivate(); m_projectionMatrix.pop(); + +#ifdef RENDERER_DEBUG + if (debugTimer.elapsed() > DEBUG_THRESHOLD) { + printf(" --- Renderer breakdown:\n" + " - setup=%d, clear=%d, building=%d, sorting=%d, opaque=%d, alpha=%d\n" + " - material changes: opaque=%d, alpha=%d, total=%d\n" + " - geometry ndoes: opaque=%d, alpha=%d, total=%d\n", + debugtimeSetup, + debugtimeClear - debugtimeSetup, + debugtimeLists - debugtimeClear, + debugtimeSorting - debugtimeLists, + debugtimeOpaque - debugtimeSorting, + debugtimeAlpha - debugtimeOpaque, + opaqueMaterialChanges, materialChanges - opaqueMaterialChanges, materialChanges, + opaqueNodes, geometryNodesDrawn - opaqueNodes, geometryNodesDrawn); + } +#endif + } class Foo : public QPair @@ -426,6 +488,10 @@ void QMLRenderer::renderNodes(const QVector &list) m_currentProgram->activate(); //++programChangeCount; updates |= (QSGMaterialShader::RenderState::DirtyMatrix | QSGMaterialShader::RenderState::DirtyOpacity); + +#ifdef RENDERER_DEBUG + materialChanges++; +#endif } bool changeRenderOrder = currentRenderOrder != geomNode->renderOrder(); @@ -449,6 +515,10 @@ void QMLRenderer::renderNodes(const QVector &list) const QSGGeometry *g = geomNode->geometry(); bindGeometry(program, g); draw(geomNode); + +#ifdef RENDERER_DEBUG + geometryNodesDrawn++; +#endif } //qDebug("Clip: %i, shader program: %i, material: %i times changed while drawing %s items", // clipChangeCount, programChangeCount, materialChangeCount, diff --git a/src/declarative/scenegraph/coreapi/qsgrenderer.cpp b/src/declarative/scenegraph/coreapi/qsgrenderer.cpp index eb7b830ade..04c0817f8f 100644 --- a/src/declarative/scenegraph/coreapi/qsgrenderer.cpp +++ b/src/declarative/scenegraph/coreapi/qsgrenderer.cpp @@ -243,8 +243,7 @@ void QSGRenderer::renderScene(const Bindable &bindable) m_bindable = 0; #ifdef QSG_RENDERER_TIMING - printf("Frame #%d: Breakdown of frametime: preprocess=%d, updates=%d, binding=%d, render=%d, total=%d\n", - ++frameNumber, + printf(" - Breakdown of frametime: preprocess=%d, updates=%d, binding=%d, render=%d, total=%d\n", preprocessTime, updatePassTime - preprocessTime, bindTime - updatePassTime, -- cgit v1.2.3 From 9c0cf384fac57c4c8470459901022429fad1a8a7 Mon Sep 17 00:00:00 2001 From: Marius Storm-Olsen Date: Fri, 1 Apr 2011 05:47:28 -0500 Subject: Add module.prf, and install MODULE_PRI for each module Output warning if not present --- src/declarative/declarative.pro | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/declarative/declarative.pro b/src/declarative/declarative.pro index fdbb07072a..a54284fe6f 100644 --- a/src/declarative/declarative.pro +++ b/src/declarative/declarative.pro @@ -2,6 +2,10 @@ load(qt_module) TARGET = QtDeclarative QPRO_PWD = $$PWD + +CONFIG += module +MODULE_PRI += ../../modules/qt_declarative.pri + QT = core gui script network contains(QT_CONFIG, svg): QT += svg DEFINES += QT_BUILD_DECLARATIVE_LIB QT_NO_URL_CAST_FROM_STRING -- cgit v1.2.3 From 23131cd3240f71a333e4a6fc58a68b4b830ea2b3 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 6 Apr 2011 15:33:13 +0200 Subject: Define the QT_NO_.... when the module is absant from QT_CONFIG Task-number: QTMODULARIZATION-38 --- src/declarative/util/util.pri | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/declarative/util/util.pri b/src/declarative/util/util.pri index 62fa8f1664..5bc8b117c0 100644 --- a/src/declarative/util/util.pri +++ b/src/declarative/util/util.pri @@ -69,4 +69,6 @@ contains(QT_CONFIG, xmlpatterns) { QT+=xmlpatterns SOURCES += $$PWD/qdeclarativexmllistmodel.cpp HEADERS += $$PWD/qdeclarativexmllistmodel_p.h +} else { + DEFINES += QT_NO_XMLPATTERNS } -- cgit v1.2.3 From 8017c9a69084ec492128b0511bc055fe2702cda7 Mon Sep 17 00:00:00 2001 From: Marius Storm-Olsen Date: Thu, 21 Apr 2011 07:55:54 -0500 Subject: Use private headers --- modules/qt_declarative.pri | 10 +++++----- src/declarative/declarative.pro | 2 +- src/imports/gestures/gestures.pro | 2 +- src/imports/particles/particles.pro | 2 +- tools/qmlviewer/qml.pri | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/qt_declarative.pri b/modules/qt_declarative.pri index d4dfecd365..fe69b5f105 100644 --- a/modules/qt_declarative.pri +++ b/modules/qt_declarative.pri @@ -1,12 +1,12 @@ -QT_DECLARATIVE_VERSION = $$QT_VERSION -QT_DECLARATIVE_MAJOR_VERSION = $$QT_MAJOR_VERSION -QT_DECLARATIVE_MINOR_VERSION = $$QT_MINOR_VERSION -QT_DECLARATIVE_PATCH_VERSION = $$QT_PATCH_VERSION +QT.declarative.VERSION = 4.8.0 +QT.declarative.MAJOR_VERSION = 4 +QT.declarative.MINOR_VERSION = 8 +QT.declarative.PATCH_VERSION = 0 QT.declarative.name = QtDeclarative QT.declarative.bins = $$QT_MODULE_BIN_BASE QT.declarative.includes = $$QT_MODULE_INCLUDE_BASE $$QT_MODULE_INCLUDE_BASE/QtDeclarative -QT.declarative.private_includes = $$QT_MODULE_INCLUDE_BASE/QtDeclarative/private +QT.declarative.private_includes = $$QT_MODULE_INCLUDE_BASE/QtDeclarative/$$QT.declarative.VERSION QT.declarative.sources = $$QT_MODULE_BASE/src/declarative QT.declarative.libs = $$QT_MODULE_LIB_BASE QT.declarative.plugins = $$QT_MODULE_PLUGIN_BASE diff --git a/src/declarative/declarative.pro b/src/declarative/declarative.pro index a54284fe6f..4c2e380540 100644 --- a/src/declarative/declarative.pro +++ b/src/declarative/declarative.pro @@ -6,7 +6,7 @@ QPRO_PWD = $$PWD CONFIG += module MODULE_PRI += ../../modules/qt_declarative.pri -QT = core gui script network +QT = core-private gui-private script-private network 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 --git a/src/imports/gestures/gestures.pro b/src/imports/gestures/gestures.pro index 8ebf9a02f8..7ecd4b8afa 100644 --- a/src/imports/gestures/gestures.pro +++ b/src/imports/gestures/gestures.pro @@ -2,7 +2,7 @@ TARGET = qmlgesturesplugin TARGETPATH = Qt/labs/gestures include(../qimportbase.pri) -QT += declarative +QT += core-private gui-private declarative-private script-private SOURCES += qdeclarativegesturearea.cpp plugin.cpp HEADERS += qdeclarativegesturearea_p.h diff --git a/src/imports/particles/particles.pro b/src/imports/particles/particles.pro index ba570f77a3..5f39b08405 100644 --- a/src/imports/particles/particles.pro +++ b/src/imports/particles/particles.pro @@ -2,7 +2,7 @@ TARGET = qmlparticlesplugin TARGETPATH = Qt/labs/particles include(../qimportbase.pri) -QT += declarative +QT += core-private gui-private declarative-private SOURCES += \ qdeclarativeparticles.cpp \ diff --git a/tools/qmlviewer/qml.pri b/tools/qmlviewer/qml.pri index cfc74af89d..9ac5adc50e 100644 --- a/tools/qmlviewer/qml.pri +++ b/tools/qmlviewer/qml.pri @@ -1,4 +1,4 @@ -QT += declarative script network sql +QT += core-private gui-private declarative-private script network sql contains(QT_CONFIG, opengl) { QT += opengl DEFINES += GL_SUPPORTED -- cgit v1.2.3 From 4cf4c7b9bcd74846ea53319d32b6374c71fea967 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 2 May 2011 16:54:54 +0200 Subject: Fix compilation with private header patch --- src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro b/src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro index 14113fb072..e5e28a4c38 100644 --- a/src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro +++ b/src/plugins/qmltooling/qmldbg_tcp/qmldbg_tcp.pro @@ -1,5 +1,7 @@ +load(qt_module) + TARGET = qmldbg_tcp -QT += declarative network +QT += declarative-private network include($$QT_SOURCE_TREE/src/plugins/qpluginbase.pri) -- cgit v1.2.3 From d3be822c1bc167878ae75943c39dfb3f40bb3800 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Tue, 3 May 2011 15:13:50 +1000 Subject: Start QtQuick2 section of whats new. With the minor MouseArea behaviour change. --- doc/src/declarative/whatsnew.qdoc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/src/declarative/whatsnew.qdoc b/doc/src/declarative/whatsnew.qdoc index 6eb1548ab2..bf4b0df086 100644 --- a/doc/src/declarative/whatsnew.qdoc +++ b/doc/src/declarative/whatsnew.qdoc @@ -29,6 +29,12 @@ \title What's new in Qt Quick \page qtquick-whatsnew.html +\section1 Qt 5.0.0 includes QtQuick 2.0 + +QtQuick 2.0 is a major update. + +MouseArea now propagates clicked, doubleClicked and pressAndHold differently. + \section1 Qt 4.7.4 includes QtQuick 1.1 QtQuick 1.1 is a minor feature update. \e {import QtQuick 1.1} to use the new features. -- cgit v1.2.3 From 9267a7bce715924a96c8636a3110d90879e5927c Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Tue, 3 May 2011 14:41:52 +0200 Subject: Added antialiasing property to QSGPaintedItem. --- examples/declarative/painteditem/main.cpp | 5 +++++ src/declarative/items/qsgpainteditem.cpp | 33 ++++++++++++++++++++++++++++++- src/declarative/items/qsgpainteditem.h | 3 +++ src/declarative/items/qsgpainteditem_p.h | 1 + 4 files changed, 41 insertions(+), 1 deletion(-) diff --git a/examples/declarative/painteditem/main.cpp b/examples/declarative/painteditem/main.cpp index 1308325ca3..10bd4302c9 100644 --- a/examples/declarative/painteditem/main.cpp +++ b/examples/declarative/painteditem/main.cpp @@ -47,6 +47,11 @@ class MyPaintItem : public QSGPaintedItem { Q_OBJECT public: + MyPaintItem() : QSGPaintedItem() + { + setAntialiasing(true); + } + virtual void paint(QPainter *p) { QRectF rect(0, 0, width(), height()); diff --git a/src/declarative/items/qsgpainteditem.cpp b/src/declarative/items/qsgpainteditem.cpp index 8eb8afe8be..e0d63fa436 100644 --- a/src/declarative/items/qsgpainteditem.cpp +++ b/src/declarative/items/qsgpainteditem.cpp @@ -186,6 +186,37 @@ void QSGPaintedItem::setOpaquePainting(bool opaque) QSGItem::update(); } +/*! + Returns true if antialiased painting is enabled; otherwise, false is returned. + + By default, antialiasing is not enabled. + + \sa setAntialiasing() +*/ +bool QSGPaintedItem::antialiasing() const +{ + Q_D(const QSGPaintedItem); + return d->antialiasing; +} + +/*! + If \a enable is true, antialiased painting is enabled. + + By default, antialiasing is not enabled. + + \sa antialiasing() +*/ +void QSGPaintedItem::setAntialiasing(bool enable) +{ + Q_D(QSGPaintedItem); + + if (d->antialiasing == enable) + return; + + d->antialiasing = enable; + update(); +} + QSize QSGPaintedItem::contentsSize() const { // XXX todo @@ -337,7 +368,7 @@ QSGNode *QSGPaintedItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData * node->setPreferredRenderTarget(d->renderTarget); node->setSize(QSize(d->width, d->height)); - node->setSmoothPainting(d->smooth); + node->setSmoothPainting(d->antialiasing); node->setLinearFiltering(d->smooth); node->setOpaquePainting(d->opaquePainting); node->setFillColor(d->fillColor); diff --git a/src/declarative/items/qsgpainteditem.h b/src/declarative/items/qsgpainteditem.h index 23becfefa4..85255243c2 100644 --- a/src/declarative/items/qsgpainteditem.h +++ b/src/declarative/items/qsgpainteditem.h @@ -75,6 +75,9 @@ public: bool opaquePainting() const; void setOpaquePainting(bool opaque); + bool antialiasing() const; + void setAntialiasing(bool enable); + QSize contentsSize() const; void setContentsSize(const QSize &); void resetContentsSize(); diff --git a/src/declarative/items/qsgpainteditem_p.h b/src/declarative/items/qsgpainteditem_p.h index c49da5098f..ee76319a92 100644 --- a/src/declarative/items/qsgpainteditem_p.h +++ b/src/declarative/items/qsgpainteditem_p.h @@ -60,6 +60,7 @@ public: bool geometryDirty : 1; bool contentsDirty : 1; bool opaquePainting: 1; + bool antialiasing: 1; }; QT_END_NAMESPACE -- cgit v1.2.3 From b3bb9c795271e0b6a103e485873a88a395bdf9f8 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Tue, 3 May 2011 14:43:51 +0200 Subject: Removed unused properties in QSGPaintedItem. --- src/declarative/items/qsgpainteditem.cpp | 22 ---------------------- src/declarative/items/qsgpainteditem.h | 8 -------- 2 files changed, 30 deletions(-) diff --git a/src/declarative/items/qsgpainteditem.cpp b/src/declarative/items/qsgpainteditem.cpp index e0d63fa436..e9f4f73448 100644 --- a/src/declarative/items/qsgpainteditem.cpp +++ b/src/declarative/items/qsgpainteditem.cpp @@ -244,28 +244,6 @@ void QSGPaintedItem::setContentsScale(qreal) // XXX todo } -int QSGPaintedItem::pixelCacheSize() const -{ - // XXX todo - return 0; -} - -void QSGPaintedItem::setPixelCacheSize(int) -{ - // XXX todo -} - -bool QSGPaintedItem::smoothCache() const -{ - // XXX todo - return false; -} - -void QSGPaintedItem::setSmoothCache(bool) -{ - // XXX todo -} - /*! \property QSGPaintedItem::fillColor \brief The item's background fill color. diff --git a/src/declarative/items/qsgpainteditem.h b/src/declarative/items/qsgpainteditem.h index 85255243c2..8d4b466922 100644 --- a/src/declarative/items/qsgpainteditem.h +++ b/src/declarative/items/qsgpainteditem.h @@ -57,8 +57,6 @@ class Q_DECLARATIVE_EXPORT QSGPaintedItem : public QSGItem Q_PROPERTY(QSize contentsSize READ contentsSize WRITE setContentsSize NOTIFY contentsSizeChanged) Q_PROPERTY(QColor fillColor READ fillColor WRITE setFillColor NOTIFY fillColorChanged) - Q_PROPERTY(int pixelCacheSize READ pixelCacheSize WRITE setPixelCacheSize) - Q_PROPERTY(bool smoothCache READ smoothCache WRITE setSmoothCache) Q_PROPERTY(qreal contentsScale READ contentsScale WRITE setContentsScale NOTIFY contentsScaleChanged) Q_PROPERTY(RenderTarget renderTarget READ renderTarget WRITE setRenderTarget NOTIFY renderTargetChanged) public: @@ -85,12 +83,6 @@ public: qreal contentsScale() const; void setContentsScale(qreal); - int pixelCacheSize() const; - void setPixelCacheSize(int pixels); - - bool smoothCache() const; - void setSmoothCache(bool on); - QColor fillColor() const; void setFillColor(const QColor&); -- cgit v1.2.3 From dbbcc4dff099d5cf41a3253f922b785889e17545 Mon Sep 17 00:00:00 2001 From: axis Date: Tue, 3 May 2011 16:21:07 +0200 Subject: Added .tag file with Git revision. --- .gitattributes | 1 + .tag | 1 + 2 files changed, 2 insertions(+) create mode 100644 .gitattributes create mode 100644 .tag diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..a3c6108370 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +.tag ident diff --git a/.tag b/.tag new file mode 100644 index 0000000000..055c8729cd --- /dev/null +++ b/.tag @@ -0,0 +1 @@ +$Id$ -- cgit v1.2.3 From 79943c45bf22d28797afcd7a47bc98ad27b171ad Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Tue, 3 May 2011 16:50:51 +0200 Subject: Code cleanup in QSGShaderEffectTexture. --- src/declarative/items/qsgshadereffectsource.cpp | 24 +++++++++++++----------- src/declarative/items/qsgshadereffectsource_p.h | 8 ++------ 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/declarative/items/qsgshadereffectsource.cpp b/src/declarative/items/qsgshadereffectsource.cpp index e5b79a6d78..e7e248299d 100644 --- a/src/declarative/items/qsgshadereffectsource.cpp +++ b/src/declarative/items/qsgshadereffectsource.cpp @@ -65,6 +65,7 @@ QSGShaderEffectTexture::QSGShaderEffectTexture(QSGItem *shaderSource) #ifdef QSG_DEBUG_FBO_OVERLAY , m_debugOverlay(0) #endif + , m_mipmap(false) , m_live(true) , m_dirtyTexture(true) , m_multisamplingSupportChecked(false) @@ -95,7 +96,7 @@ bool QSGShaderEffectTexture::hasAlphaChannel() const bool QSGShaderEffectTexture::hasMipmaps() const { - return m_mipmapFiltering; + return m_mipmap; } @@ -114,12 +115,12 @@ bool QSGShaderEffectTexture::updateTexture() return false; } -void QSGShaderEffectTexture::setHasMipmaps(QSGTexture::Filtering filtering) +void QSGShaderEffectTexture::setHasMipmaps(bool mipmap) { - if (filtering == m_mipmapFiltering) + if (mipmap == m_mipmap) return; - m_mipmapFiltering = filtering; - if (filtering != None && m_fbo && !m_fbo->format().mipmap()) + m_mipmap = mipmap; + if (m_mipmap && m_fbo && !m_fbo->format().mipmap()) markDirtyTexture(); } @@ -196,9 +197,8 @@ void QSGShaderEffectTexture::grab() } m_renderer->setRootNode(static_cast(root)); - bool mipmap = m_mipmapFiltering != None; if (!m_fbo || m_fbo->size() != m_size || m_fbo->format().internalTextureFormat() != m_format - || (!m_fbo->format().mipmap() && mipmap)) + || (!m_fbo->format().mipmap() && m_mipmap)) { if (!m_multisamplingSupportChecked) { QList extensions = QByteArray((const char *)glGetString(GL_EXTENSIONS)).split(' '); @@ -217,7 +217,7 @@ void QSGShaderEffectTexture::grab() m_multisampledFbo = new QGLFramebufferObject(m_size, format); format.setAttachment(QGLFramebufferObject::NoAttachment); - format.setMipmap(m_mipmapFiltering); + format.setMipmap(m_mipmap); format.setSamples(0); m_fbo = new QGLFramebufferObject(m_size, format); @@ -226,7 +226,7 @@ void QSGShaderEffectTexture::grab() QGLFramebufferObjectFormat format; format.setAttachment(QGLFramebufferObject::CombinedDepthStencil); format.setInternalTextureFormat(m_format); - format.setMipmap(m_mipmapFiltering); + format.setMipmap(m_mipmap); m_fbo = new QGLFramebufferObject(m_size, format); } } @@ -267,7 +267,7 @@ void QSGShaderEffectTexture::grab() m_renderer->renderScene(BindableFbo(m_fbo)); } - if (mipmap) { + if (m_mipmap) { glBindTexture(GL_TEXTURE_2D, textureId()); ctx->functions()->glGenerateMipmap(GL_TEXTURE_2D); } @@ -461,6 +461,8 @@ static void get_wrap_mode(QSGShaderEffectSource::WrapMode mode, QSGTexture::Wrap *hWrap = *vWrap = QSGTexture::Repeat; break; default: + // QSGShaderEffectSource::ClampToEdge + *hWrap = *vWrap = QSGTexture::ClampToEdge; break; } } @@ -504,12 +506,12 @@ QSGNode *QSGShaderEffectSource::updatePaintNode(QSGNode *oldNode, UpdatePaintNod tex->setSize(textureSize); tex->setLive(m_live); tex->setFormat(GLenum(m_format)); + tex->setHasMipmaps(m_mipmap); QSGTexture::Filtering filtering = QSGItemPrivate::get(this)->smooth ? QSGTexture::Linear : QSGTexture::Nearest; QSGTexture::Filtering mmFiltering = m_mipmap ? filtering : QSGTexture::None; - tex->setHasMipmaps(mmFiltering); node->setMipmapFiltering(mmFiltering); node->setFiltering(filtering); diff --git a/src/declarative/items/qsgshadereffectsource_p.h b/src/declarative/items/qsgshadereffectsource_p.h index 1b6e1b5fe8..5d571ed42d 100644 --- a/src/declarative/items/qsgshadereffectsource_p.h +++ b/src/declarative/items/qsgshadereffectsource_p.h @@ -82,7 +82,7 @@ public: QSize size() const { return m_size; } void setSize(const QSize &size); - void setHasMipmaps(QSGTexture::Filtering filtering); + void setHasMipmaps(bool mipmap); void bind(); @@ -120,11 +120,7 @@ private: QSGRectangleNode *m_debugOverlay; #endif - uint m_hWrapMode : 1; - uint m_vWrapMode : 1; - uint m_filtering : 2; - uint m_mipmapFiltering : 2; - + uint m_mipmap : 1; uint m_live : 1; uint m_dirtyTexture : 1; uint m_multisamplingSupportChecked : 1; -- cgit v1.2.3 From a6a0dfc44e729f6a9e772beec1b7fd176051da4b Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 4 May 2011 14:43:16 +1000 Subject: Fix crashing QtQuick 1 Image elements. --- src/declarative/util/qdeclarativepixmapcache.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp index dcce7db813..f0e999b46e 100644 --- a/src/declarative/util/qdeclarativepixmapcache.cpp +++ b/src/declarative/util/qdeclarativepixmapcache.cpp @@ -289,7 +289,7 @@ void QDeclarativePixmapReply::postReply(ReadError error, const QString &errorStr } QDeclarativePixmapReply::Event::Event(ReadError e, const QString &s, const QSize &iSize, const QImage &i) - : QEvent(QEvent::User), error(e), errorString(s), implicitSize(iSize), image(i) + : QEvent(QEvent::User), error(e), errorString(s), implicitSize(iSize), image(i), texture(0), context(0) { } @@ -793,7 +793,7 @@ bool QDeclarativePixmapReply::event(QEvent *event) if (data) { Event *de = static_cast(event); data->pixmapStatus = (de->error == NoError) ? QDeclarativePixmap::Ready : QDeclarativePixmap::Error; - + if (data->pixmapStatus == QDeclarativePixmap::Ready) { if (de->texture) { data->texture = de->texture; -- cgit v1.2.3 From ff62dede7b8f4d211ad1de922ccb901ab9ae055c Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Wed, 4 May 2011 17:42:49 +1000 Subject: Fix QSGText autotests --- tests/auto/declarative/qsgtext/tst_qsgtext.cpp | 55 -------------------------- 1 file changed, 55 deletions(-) diff --git a/tests/auto/declarative/qsgtext/tst_qsgtext.cpp b/tests/auto/declarative/qsgtext/tst_qsgtext.cpp index 51184885db..2861dd9a9f 100644 --- a/tests/auto/declarative/qsgtext/tst_qsgtext.cpp +++ b/tests/auto/declarative/qsgtext/tst_qsgtext.cpp @@ -106,8 +106,6 @@ private slots: void QTBUG_12291(); void implicitSize_data(); void implicitSize(); - void testQtQuick11Attributes(); - void testQtQuick11Attributes_data(); void qtbug_14734(); private: @@ -1323,12 +1321,10 @@ void tst_qsgtext::lineHeight() qreal h2 = myText->height(); myText->setLineHeight(2.0); - QEXPECT_FAIL("", "QTBUG-17325", Continue); QVERIFY(myText->height() == h2 * 2.0); myText->setLineHeightMode(QSGText::FixedHeight); myText->setLineHeight(10); - QEXPECT_FAIL("", "QTBUG-17325", Continue); QCOMPARE(myText->height(), myText->lineCount() * 10.0); delete canvas; @@ -1363,57 +1359,6 @@ void tst_qsgtext::implicitSize() delete textObject; } -void tst_qsgtext::testQtQuick11Attributes() -{ - QFETCH(QString, code); - QFETCH(QString, warning); - QFETCH(QString, error); - - QDeclarativeEngine engine; - QObject *obj; - - QDeclarativeComponent valid(&engine); - valid.setData("import QtQuick 2.0; Text { " + code.toUtf8() + " }", QUrl("")); - obj = valid.create(); - QVERIFY(obj); - QVERIFY(valid.errorString().isEmpty()); - delete obj; - - QDeclarativeComponent invalid(&engine); - invalid.setData("import QtQuick 1.0; Text { " + code.toUtf8() + " }", QUrl("")); - QTest::ignoreMessage(QtWarningMsg, warning.toUtf8()); - obj = invalid.create(); - QCOMPARE(invalid.errorString(), error); - delete obj; -} - -void tst_qsgtext::testQtQuick11Attributes_data() -{ - QTest::addColumn("code"); - QTest::addColumn("warning"); - QTest::addColumn("error"); - - QTest::newRow("maximumLineCount") << "maximumLineCount: 4" - << "QDeclarativeComponent: Component is not ready" - << ":1 \"Text.maximumLineCount\" is not available in QtQuick 1.0.\n"; - - QTest::newRow("lineHeight") << "lineHeight: 2" - << "QDeclarativeComponent: Component is not ready" - << ":1 \"Text.lineHeight\" is not available in QtQuick 1.0.\n"; - - QTest::newRow("lineHeightMode") << "lineHeightMode: Text.ProportionalHeight" - << "QDeclarativeComponent: Component is not ready" - << ":1 \"Text.lineHeightMode\" is not available in QtQuick 1.0.\n"; - - QTest::newRow("lineCount") << "property int foo: lineCount" - << ":1: ReferenceError: Can't find variable: lineCount" - << ""; - - QTest::newRow("truncated") << "property bool foo: truncated" - << ":1: ReferenceError: Can't find variable: truncated" - << ""; -} - void tst_qsgtext::qtbug_14734() { QSGView *canvas = createView(SRCDIR "/data/qtbug_14734.qml"); -- cgit v1.2.3 From 1b7c1b6ef86d3d56ff01b2eab118062a229b0d19 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 4 May 2011 17:53:51 +1000 Subject: Update SG items with GV item changes. --- src/declarative/items/qsgflickable.cpp | 248 ++++++++++++++------- src/declarative/items/qsgflickable_p_p.h | 18 +- src/declarative/items/qsggridview.cpp | 34 ++- src/declarative/items/qsgimage.cpp | 22 +- src/declarative/items/qsgimagebase.cpp | 26 ++- src/declarative/items/qsgimagebase_p.h | 5 +- src/declarative/items/qsglistview.cpp | 42 +++- src/declarative/items/qsgmousearea.cpp | 31 ++- src/declarative/items/qsgmousearea_p.h | 5 +- src/declarative/items/qsgmousearea_p_p.h | 5 +- src/declarative/items/qsgpathview.cpp | 4 +- src/declarative/items/qsgpincharea.cpp | 230 ++++++++++--------- src/declarative/items/qsgpincharea_p.h | 9 +- src/declarative/items/qsgpincharea_p_p.h | 7 +- src/declarative/items/qsgtext.cpp | 24 +- src/declarative/items/qsgtext_p_p.h | 3 +- src/declarative/items/qsgtextedit.cpp | 17 +- src/declarative/items/qsgtextinput.cpp | 59 +++-- src/declarative/items/qsgtextinput_p.h | 7 +- src/declarative/items/qsgtextinput_p_p.h | 10 +- .../declarative/qsgflickable/tst_qsgflickable.cpp | 2 +- 21 files changed, 546 insertions(+), 262 deletions(-) diff --git a/src/declarative/items/qsgflickable.cpp b/src/declarative/items/qsgflickable.cpp index e2f6fff71b..ab3559bce9 100644 --- a/src/declarative/items/qsgflickable.cpp +++ b/src/declarative/items/qsgflickable.cpp @@ -1,4 +1,4 @@ -// Commit: ee767e8c16742316068e83323374ea54f2b939cb +// Commit: d4fa1878ff1e7628d3e984d54f8a93810353c71b /**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). @@ -48,9 +48,41 @@ #include #include #include +#include "qplatformdefs.h" QT_BEGIN_NAMESPACE +// The maximum number of pixels a flick can overshoot +#ifndef QML_FLICK_OVERSHOOT +#define QML_FLICK_OVERSHOOT 200 +#endif + +// The number of samples to use in calculating the velocity of a flick +#ifndef QML_FLICK_SAMPLEBUFFER +#define QML_FLICK_SAMPLEBUFFER 3 +#endif + +// The number of samples to discard when calculating the flick velocity. +// Touch panels often produce inaccurate results as the finger is lifted. +#ifndef QML_FLICK_DISCARDSAMPLES +#define QML_FLICK_DISCARDSAMPLES 1 +#endif + +// The default maximum velocity of a flick. +#ifndef QML_FLICK_DEFAULTMAXVELOCITY +#define QML_FLICK_DEFAULTMAXVELOCITY 2500 +#endif + +// The default deceleration of a flick. +#ifndef QML_FLICK_DEFAULTDECELERATION +#define QML_FLICK_DEFAULTDECELERATION 1500 +#endif + +// How much faster to decelerate when overshooting +#ifndef QML_FLICK_OVERSHOOTFRICTION +#define QML_FLICK_OVERSHOOTFRICTION 8 +#endif + // FlickThreshold determines how far the "mouse" must have moved // before we perform a flick. static const int FlickThreshold = 20; @@ -143,8 +175,9 @@ QSGFlickablePrivate::QSGFlickablePrivate() , hMoved(false), vMoved(false) , movingHorizontally(false), movingVertically(false) , stealMouse(false), pressed(false), interactive(true), calcVelocity(false) - , deceleration(500), maxVelocity(2000), reportedVelocitySmoothing(100) - , delayedPressEvent(0), delayedPressTarget(0), pressDelay(0), fixupDuration(600) + , deceleration(QML_FLICK_DEFAULTDECELERATION) + , maxVelocity(QML_FLICK_DEFAULTMAXVELOCITY), reportedVelocitySmoothing(100) + , delayedPressEvent(0), delayedPressTarget(0), pressDelay(0), fixupDuration(400) , fixupMode(Normal), vTime(0), visibleArea(0) , flickableDirection(QSGFlickable::AutoFlickDirection) , boundsBehavior(QSGFlickable::DragAndOvershootBounds) @@ -181,16 +214,36 @@ void QSGFlickablePrivate::init() Returns the amount to overshoot by given a velocity. Will be roughly in range 0 - size/4 */ -qreal QSGFlickablePrivate::overShootDistance(qreal velocity, qreal size) +qreal QSGFlickablePrivate::overShootDistance(qreal size) { if (maxVelocity <= 0) return 0.0; - velocity = qAbs(velocity); - if (velocity > maxVelocity) - velocity = maxVelocity; - qreal dist = size / 4 * velocity / maxVelocity; - return dist; + return qMin(qreal(QML_FLICK_OVERSHOOT), size/3); +} + +void QSGFlickablePrivate::AxisData::addVelocitySample(qreal v, qreal maxVelocity) +{ + if (v > maxVelocity) + v = maxVelocity; + else if (v < -maxVelocity) + v = -maxVelocity; + velocityBuffer.append(v); + if (velocityBuffer.count() > QML_FLICK_SAMPLEBUFFER) + velocityBuffer.remove(0); +} + +void QSGFlickablePrivate::AxisData::updateVelocity() +{ + if (velocityBuffer.count() > QML_FLICK_DISCARDSAMPLES) { + velocity = 0; + int count = velocityBuffer.count()-QML_FLICK_DISCARDSAMPLES; + for (int i = 0; i < count; ++i) { + qreal v = velocityBuffer.at(i); + velocity += v; + } + velocity /= count; + } } void QSGFlickablePrivate::itemGeometryChanged(QSGItem *item, const QRectF &newGeom, const QRectF &oldGeom) @@ -216,21 +269,18 @@ void QSGFlickablePrivate::flickY(qreal velocity) flick(vData, q->minYExtent(), q->maxYExtent(), q->height(), fixupY_callback, velocity); } -void QSGFlickablePrivate::flick(AxisData &data, qreal minExtent, qreal maxExtent, qreal vSize, +void QSGFlickablePrivate::flick(AxisData &data, qreal minExtent, qreal maxExtent, qreal, QDeclarativeTimeLineCallback::Callback fixupCallback, qreal velocity) { Q_Q(QSGFlickable); qreal maxDistance = -1; data.fixingUp = false; - bool overShoot = boundsBehavior == QSGFlickable::DragAndOvershootBounds; // -ve velocity means list is moving up if (velocity > 0) { - if (data.move.value() < minExtent) - maxDistance = qAbs(minExtent - data.move.value() + (overShoot?overShootDistance(velocity,vSize):0)); + maxDistance = qAbs(minExtent - data.move.value()); data.flickTarget = minExtent; } else { - if (data.move.value() > maxExtent) - maxDistance = qAbs(maxExtent - data.move.value()) + (overShoot?overShootDistance(velocity,vSize):0); + maxDistance = qAbs(maxExtent - data.move.value()); data.flickTarget = maxExtent; } if (maxDistance > 0) { @@ -242,7 +292,10 @@ void QSGFlickablePrivate::flick(AxisData &data, qreal minExtent, qreal maxExtent v = maxVelocity; } timeline.reset(data.move); - timeline.accel(data.move, v, deceleration, maxDistance); + if (boundsBehavior == QSGFlickable::DragAndOvershootBounds) + timeline.accel(data.move, v, deceleration); + else + timeline.accel(data.move, v, deceleration, maxDistance); timeline.callback(QDeclarativeTimeLineCallback(&data.move, fixupCallback, this)); if (!flickingHorizontally && q->xflick()) { flickingHorizontally = true; @@ -329,6 +382,7 @@ void QSGFlickablePrivate::fixup(AxisData &data, qreal minExtent, qreal maxExtent } } } + data.inOvershoot = false; fixupMode = Normal; vTime = timeline.time(); } @@ -537,16 +591,13 @@ void QSGFlickablePrivate::handleMousePressEvent(QGraphicsSceneMouseEvent *event) q->setKeepMouseGrab(stealMouse); pressed = true; timeline.clear(); - hData.velocity = 0; - vData.velocity = 0; - hData.dragStartOffset = 0; - vData.dragStartOffset = 0; + hData.reset(); + vData.reset(); hData.dragMinBound = q->minXExtent(); vData.dragMinBound = q->minYExtent(); hData.dragMaxBound = q->maxXExtent(); vData.dragMaxBound = q->maxYExtent(); - hData.fixingUp = false; - vData.fixingUp = false; + fixupMode = Normal; lastPos = QPoint(); QSGItemPrivate::start(lastPosTime); pressPos = event->pos(); @@ -638,33 +689,33 @@ void QSGFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event) if (stealMouse) q->setKeepMouseGrab(true); - if (!lastPos.isNull()) { - qreal elapsed = qreal(QSGItemPrivate::restart(lastPosTime)) / 1000.; - if (elapsed <= 0) - elapsed = 1; - if (q->yflick()) { - qreal diff = event->pos().y() - lastPos.y(); - // average to reduce the effect of spurious moves - vData.velocity += diff / elapsed; - vData.velocity /= 2; - } - - if (q->xflick()) { - qreal diff = event->pos().x() - lastPos.x(); - // average to reduce the effect of spurious moves - hData.velocity += diff / elapsed; - hData.velocity /= 2; - } + if (rejectY) { + vData.velocityBuffer.clear(); + vData.velocity = 0; + } + if (rejectX) { + hData.velocityBuffer.clear(); + hData.velocity = 0; } - - if (rejectY) vData.velocity = 0; - if (rejectX) hData.velocity = 0; if (hMoved || vMoved) { q->movementStarting(); q->viewportMoved(); } + if (!lastPos.isNull()) { + qreal elapsed = qreal(QSGItemPrivate::elapsed(lastPosTime)) / 1000.; + if (elapsed <= 0) + return; + QSGItemPrivate::restart(lastPosTime); + qreal dy = event->pos().y()-lastPos.y(); + if (q->yflick() && !rejectY) + vData.addVelocitySample(dy/elapsed, maxVelocity); + qreal dx = event->pos().x()-lastPos.x(); + if (q->xflick() && !rejectX) + hData.addVelocitySample(dx/elapsed, maxVelocity); + } + lastPos = event->pos(); } @@ -677,25 +728,33 @@ void QSGFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEvent *even if (!lastPosTime.isValid()) return; - if (QSGItemPrivate::elapsed(lastPosTime) > 100) { - // if we drag then pause before release we should not cause a flick. + // if we drag then pause before release we should not cause a flick. + if (QSGItemPrivate::elapsed(lastPosTime) < 100) { + vData.updateVelocity(); + hData.updateVelocity(); + } else { hData.velocity = 0.0; vData.velocity = 0.0; } vTime = timeline.time(); - if (qAbs(vData.velocity) > MinimumFlickVelocity && qAbs(event->pos().y() - pressPos.y()) > FlickThreshold) - flickY(vData.velocity); + + qreal velocity = vData.velocity; + if (vData.atBeginning || vData.atEnd) + velocity /= 2; + if (qAbs(velocity) > MinimumFlickVelocity && qAbs(event->pos().y() - pressPos.y()) > FlickThreshold) + flickY(velocity); else fixupY(); - if (qAbs(hData.velocity) > MinimumFlickVelocity && qAbs(event->pos().x() - pressPos.x()) > FlickThreshold) - flickX(hData.velocity); + velocity = hData.velocity; + if (hData.atBeginning || hData.atEnd) + velocity /= 2; + if (qAbs(velocity) > MinimumFlickVelocity && qAbs(event->pos().x() - pressPos.x()) > FlickThreshold) + flickX(velocity); else fixupX(); - lastPosTime.invalidate(); - if (!timeline.isActive()) q->movementEnding(); } @@ -742,29 +801,41 @@ void QSGFlickable::wheelEvent(QGraphicsSceneWheelEvent *event) if (!d->interactive) { QSGItem::wheelEvent(event); } else if (yflick() && event->orientation() == Qt::Vertical) { - if (event->delta() > 0) - d->vData.velocity = qMax(event->delta() - d->vData.smoothVelocity.value(), qreal(250.0)); - else - d->vData.velocity = qMin(event->delta() - d->vData.smoothVelocity.value(), qreal(-250.0)); - d->flickingVertically = false; - d->flickY(d->vData.velocity); - if (d->flickingVertically) { - d->vMoved = true; - movementStarting(); + bool valid = false; + if (event->delta() > 0 && contentY() > -minYExtent()) { + d->vData.velocity = qMax(event->delta()*2 - d->vData.smoothVelocity.value(), qreal(d->maxVelocity/4)); + valid = true; + } else if (event->delta() < 0 && contentY() < -maxYExtent()) { + d->vData.velocity = qMin(event->delta()*2 - d->vData.smoothVelocity.value(), qreal(-d->maxVelocity/4)); + valid = true; + } + if (valid) { + d->flickingVertically = false; + d->flickY(d->vData.velocity); + if (d->flickingVertically) { + d->vMoved = true; + movementStarting(); + } + event->accept(); } - event->accept(); } else if (xflick() && event->orientation() == Qt::Horizontal) { - if (event->delta() > 0) - d->hData.velocity = qMax(event->delta() - d->hData.smoothVelocity.value(), qreal(250.0)); - else - d->hData.velocity = qMin(event->delta() - d->hData.smoothVelocity.value(), qreal(-250.0)); - d->flickingHorizontally = false; - d->flickX(d->hData.velocity); - if (d->flickingHorizontally) { - d->hMoved = true; - movementStarting(); + bool valid = false; + if (event->delta() > 0 && contentX() > -minXExtent()) { + d->hData.velocity = qMax(event->delta()*2 - d->hData.smoothVelocity.value(), qreal(d->maxVelocity/4)); + valid = true; + } else if (event->delta() < 0 && contentX() < -maxXExtent()) { + d->hData.velocity = qMin(event->delta()*2 - d->hData.smoothVelocity.value(), qreal(-d->maxVelocity/4)); + valid = true; + } + if (valid) { + d->flickingHorizontally = false; + d->flickX(d->hData.velocity); + if (d->flickingHorizontally) { + d->hMoved = true; + movementStarting(); + } + event->accept(); } - event->accept(); } else { QSGItem::wheelEvent(event); } @@ -901,6 +972,27 @@ void QSGFlickable::viewportMoved() } } + if (!d->vData.inOvershoot && !d->vData.fixingUp && d->flickingVertically + && (d->vData.move.value() > minYExtent() || d->vData.move.value() < maxYExtent()) + && qAbs(d->vData.smoothVelocity.value()) > 100) { + // Increase deceleration if we've passed a bound + d->vData.inOvershoot = true; + qreal maxDistance = d->overShootDistance(height()); + d->timeline.reset(d->vData.move); + d->timeline.accel(d->vData.move, -d->vData.smoothVelocity.value(), d->deceleration*QML_FLICK_OVERSHOOTFRICTION, maxDistance); + d->timeline.callback(QDeclarativeTimeLineCallback(&d->vData.move, d->fixupY_callback, d)); + } + if (!d->hData.inOvershoot && !d->hData.fixingUp && d->flickingHorizontally + && (d->hData.move.value() > minXExtent() || d->hData.move.value() < maxXExtent()) + && qAbs(d->hData.smoothVelocity.value()) > 100) { + // Increase deceleration if we've passed a bound + d->hData.inOvershoot = true; + qreal maxDistance = d->overShootDistance(width()); + d->timeline.reset(d->hData.move); + d->timeline.accel(d->hData.move, -d->hData.smoothVelocity.value(), d->deceleration*QML_FLICK_OVERSHOOTFRICTION, maxDistance); + d->timeline.callback(QDeclarativeTimeLineCallback(&d->hData.move, d->fixupX_callback, d)); + } + d->lastFlickablePosition = QPointF(d->hData.move.value(), d->vData.move.value()); d->vTime = d->timeline.time(); @@ -1071,7 +1163,9 @@ void QSGFlickable::resizeContent(qreal w, qreal h, QPointF center) Q_D(QSGFlickable); if (w != d->hData.viewSize) { qreal oldSize = d->hData.viewSize; - setContentWidth(w); + d->hData.viewSize = w; + d->contentItem->setWidth(w); + emit contentWidthChanged(); if (center.x() != 0) { qreal pos = center.x() * w / oldSize; setContentX(contentX() + pos - center.x()); @@ -1079,12 +1173,15 @@ void QSGFlickable::resizeContent(qreal w, qreal h, QPointF center) } if (h != d->vData.viewSize) { qreal oldSize = d->vData.viewSize; - setContentHeight(h); + d->vData.viewSize = h; + d->contentItem->setHeight(h); + emit contentHeightChanged(); if (center.y() != 0) { qreal pos = center.y() * h / oldSize; setContentY(contentY() + pos - center.y()); } } + d->updateBeginningEnd(); } void QSGFlickable::returnToBounds() @@ -1148,8 +1245,9 @@ bool QSGFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event) QSGCanvas *c = canvas(); QSGItem *grabber = c ? c->mouseGrabberItem() : 0; + bool disabledItem = grabber && !grabber->isEnabled(); bool stealThisEvent = d->stealMouse; - if ((stealThisEvent || myRect.contains(event->scenePos().toPoint())) && (!grabber || !grabber->keepMouseGrab())) { + if ((stealThisEvent || myRect.contains(event->scenePos().toPoint())) && (!grabber || !grabber->keepMouseGrab() || disabledItem)) { mouseEvent.setAccepted(false); for (int i = 0x1; i <= 0x10; i <<= 1) { if (event->buttons() & i) { @@ -1196,12 +1294,12 @@ bool QSGFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event) break; } grabber = qobject_cast(c->mouseGrabberItem()); - if (grabber && stealThisEvent && !grabber->keepMouseGrab() && grabber != this) { + if ((grabber && stealThisEvent && !grabber->keepMouseGrab() && grabber != this) || disabledItem) { d->clearDelayedPress(); grabMouse(); } - return stealThisEvent || d->delayedPressEvent; + return stealThisEvent || d->delayedPressEvent || disabledItem; } else if (d->lastPosTime.isValid()) { d->lastPosTime.invalidate(); } diff --git a/src/declarative/items/qsgflickable_p_p.h b/src/declarative/items/qsgflickable_p_p.h index 2861bfd5b3..9f212ee038 100644 --- a/src/declarative/items/qsgflickable_p_p.h +++ b/src/declarative/items/qsgflickable_p_p.h @@ -1,4 +1,4 @@ -// Commit: cb0a6844705802564c81b581f24a76c5d5adf6d1 +// Commit: 160f1867868cdea916923652b00484ed11f90aaa /**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). @@ -96,9 +96,19 @@ public: struct AxisData { AxisData(QSGFlickablePrivate *fp, void (QSGFlickablePrivate::*func)(qreal)) : move(fp, func), viewSize(-1), smoothVelocity(fp), atEnd(false), atBeginning(true) - , fixingUp(false) + , fixingUp(false), inOvershoot(false) {} + void reset() { + velocityBuffer.clear(); + dragStartOffset = 0; + fixingUp = false; + inOvershoot = false; + } + + void addVelocitySample(qreal v, qreal maxVelocity); + void updateVelocity(); + QDeclarativeTimeLineValueProxy move; qreal viewSize; qreal pressPos; @@ -108,9 +118,11 @@ public: qreal velocity; qreal flickTarget; QSGFlickablePrivate::Velocity smoothVelocity; + QPODVector velocityBuffer; bool atEnd : 1; bool atBeginning : 1; bool fixingUp : 1; + bool inOvershoot : 1; }; void flickX(qreal velocity); @@ -131,7 +143,7 @@ public: void setRoundedViewportX(qreal x); void setRoundedViewportY(qreal y); - qreal overShootDistance(qreal velocity, qreal size); + qreal overShootDistance(qreal size); void itemGeometryChanged(QSGItem *, const QRectF &, const QRectF &); diff --git a/src/declarative/items/qsggridview.cpp b/src/declarative/items/qsggridview.cpp index 4f00d3651f..43f7f982a4 100644 --- a/src/declarative/items/qsggridview.cpp +++ b/src/declarative/items/qsggridview.cpp @@ -1,4 +1,4 @@ -// Commit: cc6408ccd5453d1bed9f98b9caa14861cea5742b +// Commit: fda9cc1d8a0e49817d1c6192c52d18dffcecf327 /**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). @@ -581,6 +581,26 @@ void QSGGridViewPrivate::refill(qreal from, qreal to, bool doBuffer) --i; modelIndex = visibleItems.at(i)->index + 1; } + + if (visibleItems.count() && (fillFrom > rowPos + rowSize()*2 + || fillTo < rowPosAt(visibleIndex) - rowSize())) { + // We've jumped more than a page. Estimate which items are now + // visible and fill from there. + int count = (fillFrom - (rowPos + rowSize())) / (rowSize()) * columns; + for (int i = 0; i < visibleItems.count(); ++i) + releaseItem(visibleItems.at(i)); + visibleItems.clear(); + modelIndex += count; + if (modelIndex >= model->count()) + modelIndex = model->count() - 1; + else if (modelIndex < 0) + modelIndex = 0; + modelIndex = modelIndex / columns * columns; + visibleIndex = modelIndex; + colPos = colPosAt(visibleIndex); + rowPos = rowPosAt(visibleIndex); + } + int colNum = colPos / colSize(); FxGridItemSG *item = 0; @@ -1112,6 +1132,7 @@ void QSGGridViewPrivate::fixup(AxisData &data, qreal minExtent, qreal maxExtent) } else { QSGFlickablePrivate::fixup(data, minExtent, maxExtent); } + data.inOvershoot = false; fixupMode = Normal; } @@ -1190,7 +1211,7 @@ void QSGGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal maxExtent, accel = v2 / (2.0f * qAbs(dist)); } else { data.flickTarget = velocity > 0 ? minExtent : maxExtent; - overshootDist = overShoot ? overShootDistance(v, vSize) : 0; + overshootDist = overShoot ? overShootDistance(vSize) : 0; } timeline.reset(data.move); timeline.accel(data.move, v, accel, maxDistance + overshootDist); @@ -1869,7 +1890,7 @@ qreal QSGGridView::maxXExtent() const qreal extent; qreal highlightStart; qreal highlightEnd; - qreal lastItemPosition; + qreal lastItemPosition = 0; if (d->isRightToLeftTopToBottom()){ highlightStart = d->highlightRangeStartValid ? d->highlightRangeEnd : d->size(); highlightEnd = d->highlightRangeEndValid ? d->highlightRangeStart : d->size(); @@ -1877,6 +1898,7 @@ qreal QSGGridView::maxXExtent() const } else { highlightStart = d->highlightRangeStart; highlightEnd = d->highlightRangeEnd; + lastItemPosition = 0; if (d->model && d->model->count()) lastItemPosition = d->rowPosAt(d->model->count()-1); } @@ -2367,11 +2389,9 @@ void QSGGridView::itemsInserted(int modelIndex, int count) if (d->currentItem) { d->currentItem->index = d->currentIndex; d->currentItem->setPosition(d->colPosAt(d->currentIndex), d->rowPosAt(d->currentIndex)); - } else if (!d->currentIndex || (d->currentIndex < 0 && !d->currentIndexCleared)) { - d->updateCurrent(0); } emit currentIndexChanged(); - } else if (d->itemCount == 0 && d->currentIndex == -1) { + } else if (d->itemCount == 0 && (!d->currentIndex || (d->currentIndex < 0 && !d->currentIndexCleared))) { setCurrentIndex(0); } @@ -2439,6 +2459,8 @@ void QSGGridView::itemsRemoved(int modelIndex, int count) d->currentIndex = -1; if (d->itemCount) d->updateCurrent(qMin(modelIndex, d->itemCount-1)); + else + emit currentIndexChanged(); } // update visibleIndex diff --git a/src/declarative/items/qsgimage.cpp b/src/declarative/items/qsgimage.cpp index d24db9f670..10670f4015 100644 --- a/src/declarative/items/qsgimage.cpp +++ b/src/declarative/items/qsgimage.cpp @@ -1,4 +1,4 @@ -// Commit: 695a39410c8ce186a2ce78cef51093c55fc32643 +// Commit: 051a76c1d65d698f71dc75c89f91ae9021357eae /**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). @@ -77,12 +77,10 @@ void QSGImagePrivate::setPixmap(const QPixmap &pixmap) Q_Q(QSGImage); pix.setPixmap(pixmap); - q->setImplicitWidth(pix.width()); - q->setImplicitHeight(pix.height()); + q->pixmapChange(); status = pix.isNull() ? QSGImageBase::Null : QSGImageBase::Ready; q->update(); - q->pixmapChange(); } QSGImage::FillMode QSGImage::fillMode() const @@ -119,8 +117,11 @@ void QSGImage::updatePaintedGeometry() Q_D(QSGImage); if (d->fillMode == PreserveAspectFit) { - if (!d->pix.width() || !d->pix.height()) + if (!d->pix.width() || !d->pix.height()) { + setImplicitWidth(0); + setImplicitHeight(0); return; + } qreal w = widthValid() ? width() : d->pix.width(); qreal widthScale = w / qreal(d->pix.width()); qreal h = heightValid() ? height() : d->pix.height(); @@ -134,9 +135,13 @@ void QSGImage::updatePaintedGeometry() } if (widthValid() && !heightValid()) { setImplicitHeight(d->paintedHeight); + } else { + setImplicitHeight(d->pix.height()); } if (heightValid() && !widthValid()) { setImplicitWidth(d->paintedWidth); + } else { + setImplicitWidth(d->pix.width()); } } else if (d->fillMode == PreserveAspectCrop) { if (!d->pix.width() || !d->pix.height()) @@ -280,7 +285,12 @@ QSGNode *QSGImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) void QSGImage::pixmapChange() { Q_D(QSGImage); - + // PreserveAspectFit calculates the implicit size differently so we + // don't call our superclass pixmapChange(), since that would + // result in the implicit size being set incorrectly, then updated + // in updatePaintedGeometry() + if (d->fillMode != PreserveAspectFit) + QSGImageBase::pixmapChange(); updatePaintedGeometry(); d->pixmapChanged = true; } diff --git a/src/declarative/items/qsgimagebase.cpp b/src/declarative/items/qsgimagebase.cpp index bd8b24f735..9f2de03bbe 100644 --- a/src/declarative/items/qsgimagebase.cpp +++ b/src/declarative/items/qsgimagebase.cpp @@ -1,4 +1,4 @@ -// Commit: 462429f5692f810bdd4e04b916db5f9af428d9e4 +// Commit: 051a76c1d65d698f71dc75c89f91ae9021357eae /**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). @@ -134,6 +134,18 @@ QSize QSGImageBase::sourceSize() const return QSize(width != -1 ? width : d->pix.width(), height != -1 ? height : d->pix.height()); } +void QSGImageBase::resetSourceSize() +{ + Q_D(QSGImageBase); + if (!d->explicitSourceSize) + return; + d->explicitSourceSize = false; + d->sourcesize = QSize(); + emit sourceSizeChanged(); + if (isComponentComplete()) + load(); +} + bool QSGImageBase::cache() const { Q_D(const QSGImageBase); @@ -180,11 +192,9 @@ void QSGImageBase::load() d->pix.clear(this); d->status = Null; d->progress = 0.0; - setImplicitWidth(0); - setImplicitHeight(0); + pixmapChange(); emit progressChanged(d->progress); emit statusChanged(d->status); - pixmapChange(); update(); } else { QDeclarativePixmap::Options options; @@ -235,8 +245,7 @@ void QSGImageBase::requestFinished() d->progress = 1.0; - setImplicitWidth(d->pix.width()); - setImplicitHeight(d->pix.height()); + pixmapChange(); if (d->sourcesize.width() != d->pix.width() || d->sourcesize.height() != d->pix.height()) emit sourceSizeChanged(); @@ -245,7 +254,7 @@ void QSGImageBase::requestFinished() emit statusChanged(d->status); if (d->progress != oldProgress) emit progressChanged(d->progress); - pixmapChange(); + update(); } @@ -268,6 +277,9 @@ void QSGImageBase::componentComplete() void QSGImageBase::pixmapChange() { + Q_D(QSGImageBase); + setImplicitWidth(d->pix.width()); + setImplicitHeight(d->pix.height()); } QT_END_NAMESPACE diff --git a/src/declarative/items/qsgimagebase_p.h b/src/declarative/items/qsgimagebase_p.h index fe42854304..00b14525f2 100644 --- a/src/declarative/items/qsgimagebase_p.h +++ b/src/declarative/items/qsgimagebase_p.h @@ -1,4 +1,4 @@ -// Commit: ab71df83ba4eb9d749efc0f3a2d4a0fe5486023f +// Commit: af05f64d3edc860c3cf79c7f0bdf2377faae5f40 /**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). @@ -60,7 +60,7 @@ class Q_AUTOTEST_EXPORT QSGImageBase : public QSGImplicitSizeItem Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) Q_PROPERTY(bool asynchronous READ asynchronous WRITE setAsynchronous NOTIFY asynchronousChanged) Q_PROPERTY(bool cache READ cache WRITE setCache NOTIFY cacheChanged) - Q_PROPERTY(QSize sourceSize READ sourceSize WRITE setSourceSize NOTIFY sourceSizeChanged) + Q_PROPERTY(QSize sourceSize READ sourceSize WRITE setSourceSize RESET resetSourceSize NOTIFY sourceSizeChanged) Q_PROPERTY(bool mirror READ mirror WRITE setMirror NOTIFY mirrorChanged) public: @@ -81,6 +81,7 @@ public: virtual void setSourceSize(const QSize&); QSize sourceSize() const; + void resetSourceSize(); virtual void setMirror(bool mirror); bool mirror() const; diff --git a/src/declarative/items/qsglistview.cpp b/src/declarative/items/qsglistview.cpp index 80cc8be837..3bc9026f8b 100644 --- a/src/declarative/items/qsglistview.cpp +++ b/src/declarative/items/qsglistview.cpp @@ -1,4 +1,4 @@ -// Commit: ce38c6e3a9b7eb336cbd9cd1e9520a5000c8f8ac +// Commit: cce89db1e2555cbca8fc28072e1c6dd737cec6c4 /**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). @@ -743,6 +743,27 @@ void QSGListViewPrivate::refill(qreal from, qreal to, bool doBuffer) modelIndex = visibleItems.at(i)->index + 1; } + if (visibleItems.count() && (fillFrom > itemEnd+averageSize+spacing + || fillTo < visiblePos - averageSize - spacing)) { + // We've jumped more than a page. Estimate which items are now + // visible and fill from there. + int count = (fillFrom - itemEnd) / (averageSize + spacing); + for (int i = 0; i < visibleItems.count(); ++i) + releaseItem(visibleItems.at(i)); + visibleItems.clear(); + modelIndex += count; + if (modelIndex >= model->count()) { + count -= modelIndex - model->count() + 1; + modelIndex = model->count() - 1; + } else if (modelIndex < 0) { + count -= modelIndex; + modelIndex = 0; + } + visibleIndex = modelIndex; + visiblePos = itemEnd + count * (averageSize + spacing) + 1; + itemEnd = visiblePos-1; + } + bool changed = false; FxListItemSG *item = 0; qreal pos = itemEnd + 1; @@ -1353,6 +1374,7 @@ void QSGListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal maxExtent) } else { QSGFlickablePrivate::fixup(data, minExtent, maxExtent); } + data.inOvershoot = false; fixupMode = Normal; } @@ -1425,10 +1447,10 @@ void QSGListViewPrivate::flick(AxisData &data, qreal minExtent, qreal maxExtent, data.flickTarget = isRightToLeft() ? -data.flickTarget+size() : data.flickTarget; if (overShoot) { if (data.flickTarget >= minExtent) { - overshootDist = overShootDistance(v, vSize); + overshootDist = overShootDistance(vSize); data.flickTarget += overshootDist; } else if (data.flickTarget <= maxExtent) { - overshootDist = overShootDistance(v, vSize); + overshootDist = overShootDistance(vSize); data.flickTarget -= overshootDist; } } @@ -1448,10 +1470,10 @@ void QSGListViewPrivate::flick(AxisData &data, qreal minExtent, qreal maxExtent, } else if (overShoot) { data.flickTarget = data.move.value() - dist; if (data.flickTarget >= minExtent) { - overshootDist = overShootDistance(v, vSize); + overshootDist = overShootDistance(vSize); data.flickTarget += overshootDist; } else if (data.flickTarget <= maxExtent) { - overshootDist = overShootDistance(v, vSize); + overshootDist = overShootDistance(vSize); data.flickTarget -= overshootDist; } } @@ -1831,9 +1853,11 @@ void QSGListView::setOrientation(QSGListView::Orientation orientation) if (d->orient == QSGListView::Vertical) { setContentWidth(-1); setFlickableDirection(VerticalFlick); + setContentX(0); } else { setContentHeight(-1); setFlickableDirection(HorizontalFlick); + setContentY(0); } d->regenerate(); emit orientationChanged(); @@ -2131,7 +2155,7 @@ void QSGListView::viewportMoved() d->inFlickCorrection = true; // Near an end and it seems that the extent has changed? // Recalculate the flick so that we don't end up in an odd position. - if (yflick()) { + if (yflick() && !d->vData.inOvershoot) { if (d->vData.velocity > 0) { const qreal minY = minYExtent(); if ((minY - d->vData.move.value() < height()/2 || d->vData.flickTarget - d->vData.move.value() < height()/2) @@ -2147,7 +2171,7 @@ void QSGListView::viewportMoved() } } - if (xflick()) { + if (xflick() && !d->hData.inOvershoot) { if (d->hData.velocity > 0) { const qreal minX = minXExtent(); if ((minX - d->hData.move.value() < width()/2 || d->hData.flickTarget - d->hData.move.value() < width()/2) @@ -2311,7 +2335,7 @@ void QSGListView::keyPressEvent(QKeyEvent *event) { Q_D(QSGListView); if (d->model && d->model->count() && d->interactive) { - if ((!d->isRightToLeft() && event->key() == Qt::Key_Left) + if ((d->orient == QSGListView::Horizontal && !d->isRightToLeft() && event->key() == Qt::Key_Left) || (d->orient == QSGListView::Horizontal && d->isRightToLeft() && event->key() == Qt::Key_Right) || (d->orient == QSGListView::Vertical && event->key() == Qt::Key_Up)) { if (currentIndex() > 0 || (d->wrap && !event->isAutoRepeat())) { @@ -2322,7 +2346,7 @@ void QSGListView::keyPressEvent(QKeyEvent *event) event->accept(); return; } - } else if ((!d->isRightToLeft() && event->key() == Qt::Key_Right) + } else if ((d->orient == QSGListView::Horizontal && !d->isRightToLeft() && event->key() == Qt::Key_Right) || (d->orient == QSGListView::Horizontal && d->isRightToLeft() && event->key() == Qt::Key_Left) || (d->orient == QSGListView::Vertical && event->key() == Qt::Key_Down)) { if (currentIndex() < d->model->count() - 1 || (d->wrap && !event->isAutoRepeat())) { diff --git a/src/declarative/items/qsgmousearea.cpp b/src/declarative/items/qsgmousearea.cpp index 1157a9a172..887d78a64d 100644 --- a/src/declarative/items/qsgmousearea.cpp +++ b/src/declarative/items/qsgmousearea.cpp @@ -1,4 +1,4 @@ -// Commit: f0f6deb9a5e8bd078047dd090a3857290c8b4ea4 +// Commit: e1ffbc04131dc6f76fa76821c297d08162e4b1ee /**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). @@ -179,6 +179,8 @@ QSGMouseAreaPrivate::QSGMouseAreaPrivate() : absorb(true), hovered(false), pressed(false), longPress(false), moved(false), stealMouse(false), doubleClick(false), preventStealing(false), drag(0) { + Q_Q(QSGMouseArea); + forwardTo = QDeclarativeListProperty(q, forwardToList); } QSGMouseAreaPrivate::~QSGMouseAreaPrivate() @@ -202,6 +204,18 @@ void QSGMouseAreaPrivate::saveEvent(QGraphicsSceneMouseEvent *event) lastModifiers = event->modifiers(); } +void QSGMouseAreaPrivate::forwardEvent(QGraphicsSceneMouseEvent* event) +{ + Q_Q(QSGMouseArea); + for(int i=0; i < forwardToList.count(); i++){ + event->setPos(forwardToList[i]->mapFromScene(event->scenePos())); + forwardToList[i]->canvas()->sendEvent(forwardToList[i], event); + if(event->isAccepted()) + break; + } + event->setPos(q->mapFromScene(event->scenePos())); +} + bool QSGMouseAreaPrivate::isPressAndHoldConnected() { Q_Q(QSGMouseArea); @@ -382,6 +396,9 @@ void QSGMouseArea::mousePressEvent(QGraphicsSceneMouseEvent *event) d->pressAndHoldTimer.start(PressAndHoldDelay, this); setKeepMouseGrab(d->stealMouse); event->setAccepted(setPressed(true)); + + if(!event->isAccepted() && d->forwardToList.count()) + d->forwardEvent(event); } } @@ -459,6 +476,9 @@ void QSGMouseArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event) me.setX(d->lastPos.x()); me.setY(d->lastPos.y()); emit positionChanged(&me); + + if(!event->isAccepted() && d->forwardToList.count()) + d->forwardEvent(event); } void QSGMouseArea::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) @@ -479,6 +499,9 @@ void QSGMouseArea::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) if (c && c->mouseGrabberItem() == this) ungrabMouse(); setKeepMouseGrab(false); + + if(!event->isAccepted() && d->forwardToList.count()) + d->forwardEvent(event); } d->doubleClick = false; } @@ -768,4 +791,10 @@ QSGDrag *QSGMouseArea::drag() return d->drag; } +QDeclarativeListProperty QSGMouseArea::forwardTo() +{ + Q_D(QSGMouseArea); + return d->forwardTo; +} + QT_END_NAMESPACE diff --git a/src/declarative/items/qsgmousearea_p.h b/src/declarative/items/qsgmousearea_p.h index 24fb8389a6..469b9f7168 100644 --- a/src/declarative/items/qsgmousearea_p.h +++ b/src/declarative/items/qsgmousearea_p.h @@ -1,4 +1,4 @@ -// Commit: 57676c237992e0aa5a93a4e8fa66b3e7b90c2c90 +// Commit: c6e6a35aeb8794d68a3ca0c4e27a3a1181c066b5 /**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). @@ -131,6 +131,7 @@ class Q_AUTOTEST_EXPORT QSGMouseArea : public QSGItem Q_PROPERTY(bool hoverEnabled READ hoverEnabled WRITE setHoverEnabled NOTIFY hoverEnabledChanged) Q_PROPERTY(QSGDrag *drag READ drag CONSTANT) //### add flicking to QSGDrag or add a QDeclarativeFlick ??? Q_PROPERTY(bool preventStealing READ preventStealing WRITE setPreventStealing NOTIFY preventStealingChanged) + Q_PROPERTY(QDeclarativeListProperty forwardTo READ forwardTo); public: QSGMouseArea(QSGItem *parent=0); @@ -158,6 +159,8 @@ public: bool preventStealing() const; void setPreventStealing(bool prevent); + QDeclarativeListProperty forwardTo(); + Q_SIGNALS: void hoveredChanged(); void pressedChanged(); diff --git a/src/declarative/items/qsgmousearea_p_p.h b/src/declarative/items/qsgmousearea_p_p.h index b4b64c67e9..e736c059a2 100644 --- a/src/declarative/items/qsgmousearea_p_p.h +++ b/src/declarative/items/qsgmousearea_p_p.h @@ -1,4 +1,4 @@ -// Commit: 57676c237992e0aa5a93a4e8fa66b3e7b90c2c90 +// Commit: c6e6a35aeb8794d68a3ca0c4e27a3a1181c066b5 /**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). @@ -80,6 +80,7 @@ public: }; void propagate(QSGMouseEvent* event, PropagateType); bool propagateHelper(QSGMouseEvent*, QSGItem*,const QPointF &, PropagateType); + void forwardEvent(QGraphicsSceneMouseEvent* event); bool isPressAndHoldConnected(); bool isDoubleClickConnected(); @@ -105,6 +106,8 @@ public: Qt::MouseButtons lastButtons; Qt::KeyboardModifiers lastModifiers; QBasicTimer pressAndHoldTimer; + QDeclarativeListProperty forwardTo; + QList forwardToList; }; QT_END_NAMESPACE diff --git a/src/declarative/items/qsgpathview.cpp b/src/declarative/items/qsgpathview.cpp index f7dda6cb27..87e550b630 100644 --- a/src/declarative/items/qsgpathview.cpp +++ b/src/declarative/items/qsgpathview.cpp @@ -1,4 +1,4 @@ -// Commit: ac704e9f682378a5ec56e3f5c195dcf2f2dfa1ac +// Commit: 8878e2c53a0c9408d4b468e2dad485743c32f58b /**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). @@ -1213,6 +1213,8 @@ void QSGPathView::itemsRemoved(int modelIndex, int count) } else { d->regenerate(); d->updateCurrent(); + if (!d->flicking && !d->moving && d->haveHighlightRange && d->highlightRangeMode == QSGPathView::StrictlyEnforceRange) + d->snapToCurrent(); } if (changedOffset) emit offsetChanged(); diff --git a/src/declarative/items/qsgpincharea.cpp b/src/declarative/items/qsgpincharea.cpp index e32f6bfe71..f21d873e5e 100644 --- a/src/declarative/items/qsgpincharea.cpp +++ b/src/declarative/items/qsgpincharea.cpp @@ -1,4 +1,4 @@ -// Commit: 2ec2dc55ddf424f5a7acd0a4729ddd9af2d7c398 +// Commit: f707672eb4c51ea82fbd98e1da16ece61a74c690 /**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). @@ -121,7 +121,7 @@ void QSGPinchArea::touchEvent(QTouchEvent *event) void QSGPinchArea::updatePinch() { Q_D(QSGPinchArea); - if (d->touchPoints.count() != 2) { + if (d->touchPoints.count() == 0) { if (d->inPinch) { d->stealMouse = false; setKeepMouseGrab(false); @@ -134,127 +134,141 @@ void QSGPinchArea::updatePinch() pe.setPreviousScale(d->pinchLastScale); pe.setStartPoint1(mapFromScene(d->sceneStartPoint1)); pe.setStartPoint2(mapFromScene(d->sceneStartPoint2)); - pe.setPoint1(d->lastPoint1); - pe.setPoint2(d->lastPoint2); + pe.setPoint1(mapFromScene(d->lastPoint1)); + pe.setPoint2(mapFromScene(d->lastPoint2)); emit pinchFinished(&pe); d->pinchStartDist = 0; + d->pinchActivated = false; if (d->pinch && d->pinch->target()) d->pinch->setActive(false); } return; } - if (d->touchPoints.at(0).state() & Qt::TouchPointPressed - || d->touchPoints.at(1).state() & Qt::TouchPointPressed) { - d->sceneStartPoint1 = d->touchPoints.at(0).scenePos(); - d->sceneStartPoint2 = d->touchPoints.at(1).scenePos(); + QTouchEvent::TouchPoint touchPoint1 = d->touchPoints.at(0); + QTouchEvent::TouchPoint touchPoint2 = d->touchPoints.at(d->touchPoints. count() >= 2 ? 1 : 0); + if (d->touchPoints.count() == 2 + && (touchPoint1.state() & Qt::TouchPointPressed || touchPoint2.state() & Qt::TouchPointPressed)) { + d->id1 = touchPoint1.id(); + d->sceneStartPoint1 = touchPoint1.scenePos(); + d->sceneStartPoint2 = touchPoint2.scenePos(); d->inPinch = false; d->pinchRejected = false; - } else if (!d->pinchRejected){ - QSGItem *grabber = canvas() ? canvas()->mouseGrabberItem() : 0; - if (grabber == this || !grabber || !grabber->keepMouseGrab()) { - const int dragThreshold = QApplication::startDragDistance(); - QPointF p1 = d->touchPoints.at(0).scenePos(); - QPointF p2 = d->touchPoints.at(1).scenePos(); - qreal dx = p1.x() - p2.x(); - qreal dy = p1.y() - p2.y(); - qreal dist = sqrt(dx*dx + dy*dy); - QPointF sceneCenter = (p1 + p2)/2; - qreal angle = QLineF(p1, p2).angle(); - if (angle > 180) - angle -= 360; - if (!d->inPinch) { - if (qAbs(p1.x()-d->sceneStartPoint1.x()) > dragThreshold - || qAbs(p1.y()-d->sceneStartPoint1.y()) > dragThreshold - || qAbs(p2.x()-d->sceneStartPoint2.x()) > dragThreshold - || qAbs(p2.y()-d->sceneStartPoint2.y()) > dragThreshold) { - d->sceneStartCenter = sceneCenter; - d->sceneLastCenter = sceneCenter; - d->pinchStartCenter = mapFromScene(sceneCenter); - d->pinchStartDist = dist; - d->pinchStartAngle = angle; - d->pinchLastScale = 1.0; - d->pinchLastAngle = angle; - d->pinchRotation = 0.0; - d->lastPoint1 = d->touchPoints.at(0).pos(); - d->lastPoint2 = d->touchPoints.at(1).pos(); - QSGPinchEvent pe(d->pinchStartCenter, 1.0, angle, 0.0); - pe.setStartCenter(d->pinchStartCenter); - pe.setPreviousCenter(d->pinchStartCenter); - pe.setPreviousAngle(d->pinchLastAngle); - pe.setPreviousScale(d->pinchLastScale); - pe.setStartPoint1(mapFromScene(d->sceneStartPoint1)); - pe.setStartPoint2(mapFromScene(d->sceneStartPoint2)); - pe.setPoint1(d->lastPoint1); - pe.setPoint2(d->lastPoint2); - emit pinchStarted(&pe); - if (pe.accepted()) { - d->inPinch = true; - d->stealMouse = true; - QSGCanvas *c = canvas(); - if (c && c->mouseGrabberItem() != this) - grabMouse(); - setKeepMouseGrab(true); - if (d->pinch && d->pinch->target()) { - d->pinchStartPos = pinch()->target()->pos(); - d->pinchStartScale = d->pinch->target()->scale(); - d->pinchStartRotation = d->pinch->target()->rotation(); - d->pinch->setActive(true); - } - } else { - d->pinchRejected = true; - } - } - } else if (d->pinchStartDist > 0) { - qreal scale = dist / d->pinchStartDist; - qreal da = d->pinchLastAngle - angle; - if (da > 180) - da -= 360; - else if (da < -180) - da += 360; - d->pinchRotation += da; - QPointF pinchCenter = mapFromScene(sceneCenter); - QSGPinchEvent pe(pinchCenter, scale, angle, d->pinchRotation); + d->pinchActivated = true; + } else if (d->pinchActivated && !d->pinchRejected){ + const int dragThreshold = QApplication::startDragDistance(); + QPointF p1 = touchPoint1.scenePos(); + QPointF p2 = touchPoint2.scenePos(); + qreal dx = p1.x() - p2.x(); + qreal dy = p1.y() - p2.y(); + qreal dist = sqrt(dx*dx + dy*dy); + QPointF sceneCenter = (p1 + p2)/2; + qreal angle = QLineF(p1, p2).angle(); + if (d->touchPoints.count() == 1) { + // If we only have one point then just move the center + if (d->id1 == touchPoint1.id()) + sceneCenter = d->sceneLastCenter + touchPoint1.scenePos() - d->lastPoint1; + else + sceneCenter = d->sceneLastCenter + touchPoint2.scenePos() - d->lastPoint2; + angle = d->pinchLastAngle; + } + d->id1 = touchPoint1.id(); + if (angle > 180) + angle -= 360; + if (!d->inPinch) { + if (d->touchPoints.count() >= 2 + && (qAbs(p1.x()-d->sceneStartPoint1.x()) > dragThreshold + || qAbs(p1.y()-d->sceneStartPoint1.y()) > dragThreshold + || qAbs(p2.x()-d->sceneStartPoint2.x()) > dragThreshold + || qAbs(p2.y()-d->sceneStartPoint2.y()) > dragThreshold)) { + d->sceneStartCenter = sceneCenter; + d->sceneLastCenter = sceneCenter; + d->pinchStartCenter = mapFromScene(sceneCenter); + d->pinchStartDist = dist; + d->pinchStartAngle = angle; + d->pinchLastScale = 1.0; + d->pinchLastAngle = angle; + d->pinchRotation = 0.0; + d->lastPoint1 = p1; + d->lastPoint2 = p2; + QSGPinchEvent pe(d->pinchStartCenter, 1.0, angle, 0.0); pe.setStartCenter(d->pinchStartCenter); - pe.setPreviousCenter(mapFromScene(d->sceneLastCenter)); + pe.setPreviousCenter(d->pinchStartCenter); pe.setPreviousAngle(d->pinchLastAngle); pe.setPreviousScale(d->pinchLastScale); pe.setStartPoint1(mapFromScene(d->sceneStartPoint1)); pe.setStartPoint2(mapFromScene(d->sceneStartPoint2)); - pe.setPoint1(d->touchPoints.at(0).pos()); - pe.setPoint2(d->touchPoints.at(1).pos()); - d->pinchLastScale = scale; - d->sceneLastCenter = sceneCenter; - d->pinchLastAngle = angle; - d->lastPoint1 = d->touchPoints.at(0).pos(); - d->lastPoint2 = d->touchPoints.at(1).pos(); - emit pinchUpdated(&pe); - if (d->pinch && d->pinch->target()) { - qreal s = d->pinchStartScale * scale; - s = qMin(qMax(pinch()->minimumScale(),s), pinch()->maximumScale()); - pinch()->target()->setScale(s); - QPointF pos = sceneCenter - d->sceneStartCenter + d->pinchStartPos; - if (pinch()->axis() & QSGPinch::XAxis) { - qreal x = pos.x(); - if (x < pinch()->xmin()) - x = pinch()->xmin(); - else if (x > pinch()->xmax()) - x = pinch()->xmax(); - pinch()->target()->setX(x); - } - if (pinch()->axis() & QSGPinch::YAxis) { - qreal y = pos.y(); - if (y < pinch()->ymin()) - y = pinch()->ymin(); - else if (y > pinch()->ymax()) - y = pinch()->ymax(); - pinch()->target()->setY(y); - } - if (d->pinchStartRotation >= pinch()->minimumRotation() - && d->pinchStartRotation <= pinch()->maximumRotation()) { - qreal r = d->pinchRotation + d->pinchStartRotation; - r = qMin(qMax(pinch()->minimumRotation(),r), pinch()->maximumRotation()); - pinch()->target()->setRotation(r); + pe.setPoint1(mapFromScene(d->lastPoint1)); + pe.setPoint2(mapFromScene(d->lastPoint2)); + pe.setPointCount(d->touchPoints.count()); + emit pinchStarted(&pe); + if (pe.accepted()) { + d->inPinch = true; + d->stealMouse = true; + QSGCanvas *c = canvas(); + if (c && c->mouseGrabberItem() != this) + grabMouse(); + setKeepMouseGrab(true); + if (d->pinch && d->pinch->target()) { + d->pinchStartPos = pinch()->target()->pos(); + d->pinchStartScale = d->pinch->target()->scale(); + d->pinchStartRotation = d->pinch->target()->rotation(); + d->pinch->setActive(true); } + } else { + d->pinchRejected = true; + } + } + } else if (d->pinchStartDist > 0) { + qreal scale = dist ? dist / d->pinchStartDist : d->pinchLastScale; + qreal da = d->pinchLastAngle - angle; + if (da > 180) + da -= 360; + else if (da < -180) + da += 360; + d->pinchRotation += da; + QPointF pinchCenter = mapFromScene(sceneCenter); + QSGPinchEvent pe(pinchCenter, scale, angle, d->pinchRotation); + pe.setStartCenter(d->pinchStartCenter); + pe.setPreviousCenter(mapFromScene(d->sceneLastCenter)); + pe.setPreviousAngle(d->pinchLastAngle); + pe.setPreviousScale(d->pinchLastScale); + pe.setStartPoint1(mapFromScene(d->sceneStartPoint1)); + pe.setStartPoint2(mapFromScene(d->sceneStartPoint2)); + pe.setPoint1(touchPoint1.pos()); + pe.setPoint2(touchPoint2.pos()); + pe.setPointCount(d->touchPoints.count()); + d->pinchLastScale = scale; + d->sceneLastCenter = sceneCenter; + d->pinchLastAngle = angle; + d->lastPoint1 = touchPoint1.scenePos(); + d->lastPoint2 = touchPoint2.scenePos(); + emit pinchUpdated(&pe); + if (d->pinch && d->pinch->target()) { + qreal s = d->pinchStartScale * scale; + s = qMin(qMax(pinch()->minimumScale(),s), pinch()->maximumScale()); + pinch()->target()->setScale(s); + QPointF pos = sceneCenter - d->sceneStartCenter + d->pinchStartPos; + if (pinch()->axis() & QSGPinch::XAxis) { + qreal x = pos.x(); + if (x < pinch()->xmin()) + x = pinch()->xmin(); + else if (x > pinch()->xmax()) + x = pinch()->xmax(); + pinch()->target()->setX(x); + } + if (pinch()->axis() & QSGPinch::YAxis) { + qreal y = pos.y(); + if (y < pinch()->ymin()) + y = pinch()->ymin(); + else if (y > pinch()->ymax()) + y = pinch()->ymax(); + pinch()->target()->setY(y); + } + if (d->pinchStartRotation >= pinch()->minimumRotation() + && d->pinchStartRotation <= pinch()->maximumRotation()) { + qreal r = d->pinchRotation + d->pinchStartRotation; + r = qMin(qMax(pinch()->minimumRotation(),r), pinch()->maximumRotation()); + pinch()->target()->setRotation(r); } } } diff --git a/src/declarative/items/qsgpincharea_p.h b/src/declarative/items/qsgpincharea_p.h index 04fd815df3..4cba6367e1 100644 --- a/src/declarative/items/qsgpincharea_p.h +++ b/src/declarative/items/qsgpincharea_p.h @@ -1,4 +1,4 @@ -// Commit: ce59628ba366800fe2f3afdadc37be02f98480a7 +// Commit: f707672eb4c51ea82fbd98e1da16ece61a74c690 /**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). @@ -204,11 +204,13 @@ class Q_AUTOTEST_EXPORT QSGPinchEvent : public QObject Q_PROPERTY(QPointF startPoint1 READ startPoint1) Q_PROPERTY(QPointF point2 READ point2) Q_PROPERTY(QPointF startPoint2 READ startPoint2) + Q_PROPERTY(int pointCount READ pointCount) Q_PROPERTY(bool accepted READ accepted WRITE setAccepted) public: QSGPinchEvent(QPointF c, qreal s, qreal a, qreal r) - : QObject(), m_center(c), m_scale(s), m_angle(a), m_rotation(r), m_accepted(true) {} + : QObject(), m_center(c), m_scale(s), m_angle(a), m_rotation(r) + , m_pointCount(0), m_accepted(true) {} QPointF center() const { return m_center; } QPointF startCenter() const { return m_startCenter; } @@ -230,6 +232,8 @@ public: void setPoint2(QPointF p) { m_point2 = p; } QPointF startPoint2() const { return m_startPoint2; } void setStartPoint2(QPointF p) { m_startPoint2 = p; } + int pointCount() const { return m_pointCount; } + void setPointCount(int count) { m_pointCount = count; } bool accepted() const { return m_accepted; } void setAccepted(bool a) { m_accepted = a; } @@ -247,6 +251,7 @@ private: QPointF m_point2; QPointF m_startPoint1; QPointF m_startPoint2; + int m_pointCount; bool m_accepted; }; diff --git a/src/declarative/items/qsgpincharea_p_p.h b/src/declarative/items/qsgpincharea_p_p.h index bdb3a51ef2..b93d095e0e 100644 --- a/src/declarative/items/qsgpincharea_p_p.h +++ b/src/declarative/items/qsgpincharea_p_p.h @@ -1,4 +1,4 @@ -// Commit: 2ec2dc55ddf424f5a7acd0a4729ddd9af2d7c398 +// Commit: f707672eb4c51ea82fbd98e1da16ece61a74c690 /**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). @@ -68,7 +68,8 @@ class QSGPinchAreaPrivate : public QSGItemPrivate public: QSGPinchAreaPrivate() : absorb(true), stealMouse(false), inPinch(false) - , pinchRejected(false), pinch(0), pinchStartDist(0), pinchStartScale(1.0) + , pinchRejected(false), pinchActivated(false) + , pinch(0), pinchStartDist(0), pinchStartScale(1.0) , pinchLastScale(1.0), pinchStartRotation(0.0), pinchStartAngle(0.0) , pinchLastAngle(0.0), pinchRotation(0.0) { @@ -87,6 +88,7 @@ public: bool stealMouse : 1; bool inPinch : 1; bool pinchRejected : 1; + bool pinchActivated : 1; QSGPinch *pinch; QPointF sceneStartPoint1; QPointF sceneStartPoint2; @@ -104,6 +106,7 @@ public: QPointF sceneLastCenter; QPointF pinchStartPos; QList touchPoints; + int id1; }; QT_END_NAMESPACE diff --git a/src/declarative/items/qsgtext.cpp b/src/declarative/items/qsgtext.cpp index f796006c18..f2ec7b21fa 100644 --- a/src/declarative/items/qsgtext.cpp +++ b/src/declarative/items/qsgtext.cpp @@ -1,4 +1,4 @@ -// Commit: a5c3c11e3e2204da6c8be9af98b38929366fafb8 +// Commit: cce89db1e2555cbca8fc28072e1c6dd737cec6c4 /**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). @@ -106,7 +106,7 @@ QSGTextPrivate::QSGTextPrivate() imageCacheDirty(true), updateOnComponentComplete(true), richText(false), singleline(false), cacheAllTextAsImage(true), internalWidthUpdate(false), requireImplicitWidth(false), truncated(false), hAlignImplicit(true), rightToLeftText(false), - naturalWidth(0), doc(0), nodeType(NodeIsNull) + layoutTextElided(false), naturalWidth(0), doc(0), nodeType(NodeIsNull) { cacheAllTextAsImage = enableImageCache(); } @@ -219,6 +219,7 @@ void QSGTextPrivate::updateLayout() return; } + layoutTextElided = false; // Setup instance of QTextLayout for all cases other than richtext if (!richText) { layout.clearLayout(); @@ -229,10 +230,13 @@ void QSGTextPrivate::updateLayout() singleline = !tmp.contains(QChar::LineSeparator); if (singleline && !maximumLineCountValid && elideMode != QSGText::ElideNone && q->widthValid()) { QFontMetrics fm(font); - tmp = fm.elidedText(tmp,(Qt::TextElideMode)elideMode,q->width()); // XXX still worth layout...? - if (tmp != text && !truncated) { - truncated = true; - emit q->truncatedChanged(); + tmp = fm.elidedText(tmp,(Qt::TextElideMode)elideMode,q->width()); + if (tmp != text) { + layoutTextElided = true; + if (!truncated) { + truncated = true; + emit q->truncatedChanged(); + } } } layout.setText(tmp); @@ -379,6 +383,12 @@ QRect QSGTextPrivate::setupTextLayout() if (requireImplicitWidth && q->widthValid()) { // requires an extra layout + QString elidedText; + if (layoutTextElided) { + // We have provided elided text to the layout, but we must calculate unelided width. + elidedText = layout.text(); + layout.setText(text); + } layout.beginLayout(); forever { QTextLine line = layout.createLine(); @@ -392,6 +402,8 @@ QRect QSGTextPrivate::setupTextLayout() br = br.united(line.naturalTextRect()); } naturalWidth = br.width(); + if (layoutTextElided) + layout.setText(elidedText); } if (maximumLineCountValid) { diff --git a/src/declarative/items/qsgtext_p_p.h b/src/declarative/items/qsgtext_p_p.h index 7df91f80d9..8d26394c3f 100644 --- a/src/declarative/items/qsgtext_p_p.h +++ b/src/declarative/items/qsgtext_p_p.h @@ -1,4 +1,4 @@ -// Commit: aeb330e3999ef3d7ae8d94b9330471f2a2a13554 +// Commit: 6e5a642c9484536fc173714f560f739944368cf5 /**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). @@ -119,6 +119,7 @@ public: bool truncated:1; bool hAlignImplicit:1; bool rightToLeftText:1; + bool layoutTextElided:1; QRect layedOutTextRect; QSize paintedSize; diff --git a/src/declarative/items/qsgtextedit.cpp b/src/declarative/items/qsgtextedit.cpp index 57f9135917..1c199ecc28 100644 --- a/src/declarative/items/qsgtextedit.cpp +++ b/src/declarative/items/qsgtextedit.cpp @@ -1,4 +1,4 @@ -// Commit: 6980bca15b411f86b9fadb7484a6dd782b9d1403 +// Commit: ec40dd2bb51868bca10dbd0c9116f3224ff2b29b /**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). @@ -318,6 +318,7 @@ void QSGTextEdit::setVAlign(QSGTextEdit::VAlignment alignment) d->vAlign = alignment; d->updateDefaultTextOption(); updateSize(); + moveCursorDelegate(); emit verticalAlignmentChanged(d->vAlign); } @@ -496,8 +497,6 @@ void QSGTextEdit::setCursorDelegate(QDeclarativeComponent* c) Q_D(QSGTextEdit); if(d->cursorComponent){ if(d->cursor){ - disconnect(d->control, SIGNAL(cursorPositionChanged()), - this, SLOT(moveCursorDelegate())); d->control->setCursorWidth(-1); update(cursorRectangle()); delete d->cursor; @@ -523,8 +522,6 @@ void QSGTextEdit::loadCursorDelegate() return; d->cursor = qobject_cast(d->cursorComponent->create(qmlContext(this))); if(d->cursor){ - connect(d->control, SIGNAL(cursorPositionChanged()), - this, SLOT(moveCursorDelegate())); d->control->setCursorWidth(0); update(cursorRectangle()); QDeclarative_setParent_noEvent(d->cursor, this); @@ -696,7 +693,7 @@ Qt::TextInteractionFlags QSGTextEdit::textInteractionFlags() const QRect QSGTextEdit::cursorRectangle() const { Q_D(const QSGTextEdit); - return d->control->cursorRect().toRect().translated(0,-d->yoff); + return d->control->cursorRect().toRect().translated(0,d->yoff); } bool QSGTextEdit::event(QEvent *event) @@ -985,7 +982,7 @@ void QSGTextEditPrivate::init() QObject::connect(control, SIGNAL(selectionChanged()), q, SLOT(updateSelectionMarkers())); QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SLOT(updateSelectionMarkers())); QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorPositionChanged())); - QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorRectangleChanged())); + QObject::connect(control, SIGNAL(microFocusChanged()), q, SLOT(moveCursorDelegate())); QObject::connect(control, SIGNAL(linkActivated(QString)), q, SIGNAL(linkActivated(QString))); #ifndef QT_NO_CLIPBOARD QObject::connect(q, SIGNAL(readOnlyChanged(bool)), q, SLOT(q_canPasteChanged())); @@ -1010,16 +1007,17 @@ void QSGTextEdit::q_textChanged() d->updateDefaultTextOption(); updateSize(); updateTotalLines(); - updateMicroFocus(); emit textChanged(d->text); } void QSGTextEdit::moveCursorDelegate() { Q_D(QSGTextEdit); + updateMicroFocus(); + emit cursorRectangleChanged(); if(!d->cursor) return; - QRectF cursorRect = d->control->cursorRect(); + QRectF cursorRect = cursorRectangle(); d->cursor->setX(cursorRect.x()); d->cursor->setY(cursorRect.y()); } @@ -1052,7 +1050,6 @@ void QSGTextEdit::updateSelectionMarkers() d->lastSelectionEnd = d->control->textCursor().selectionEnd(); emit selectionEndChanged(); } - updateMicroFocus(); } QRectF QSGTextEdit::boundingRect() const diff --git a/src/declarative/items/qsgtextinput.cpp b/src/declarative/items/qsgtextinput.cpp index 9631b3bafb..4eab28bbcf 100644 --- a/src/declarative/items/qsgtextinput.cpp +++ b/src/declarative/items/qsgtextinput.cpp @@ -1,4 +1,4 @@ -// Commit: b94176e69efc3948696c6774d5a228fc753b5b29 +// Commit: 47712d1f330e4b22ce6dd30e7557288ef7f7fca0 /**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). @@ -442,6 +442,20 @@ bool QSGTextInput::hasAcceptableInput() const return d->control->hasAcceptableInput(); } +void QSGTextInputPrivate::updateInputMethodHints() +{ + Q_Q(QSGTextInput); + Qt::InputMethodHints hints = inputMethodHints; + uint echo = control->echoMode(); + if (echo == QSGTextInput::Password || echo == QSGTextInput::NoEcho) + hints |= Qt::ImhHiddenText; + else if (echo == QSGTextInput::PasswordEchoOnEdit) + hints &= ~Qt::ImhHiddenText; + if (echo != QSGTextInput::Normal) + hints |= (Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText); + q->setInputMethodHints(hints); +} + QSGTextInput::EchoMode QSGTextInput::echoMode() const { Q_D(const QSGTextInput); @@ -453,21 +467,27 @@ void QSGTextInput::setEchoMode(QSGTextInput::EchoMode echo) Q_D(QSGTextInput); if (echoMode() == echo) return; - Qt::InputMethodHints imHints = inputMethodHints(); - if (echo == Password || echo == NoEcho) - imHints |= Qt::ImhHiddenText; - else - imHints &= ~Qt::ImhHiddenText; - if (echo != Normal) - imHints |= (Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText); - else - imHints &= ~(Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText); - setInputMethodHints(imHints); d->control->setEchoMode((uint)echo); + d->updateInputMethodHints(); q_textChanged(); emit echoModeChanged(echoMode()); } +Qt::InputMethodHints QSGTextInput::imHints() const +{ + Q_D(const QSGTextInput); + return d->inputMethodHints; +} + +void QSGTextInput::setIMHints(Qt::InputMethodHints hints) +{ + Q_D(QSGTextInput); + if (d->inputMethodHints == hints) + return; + d->inputMethodHints = hints; + d->updateInputMethodHints(); +} + QDeclarativeComponent* QSGTextInput::cursorDelegate() const { Q_D(const QSGTextInput); @@ -485,6 +505,8 @@ void QSGTextInput::setCursorDelegate(QDeclarativeComponent* c) //note that the components are owned by something else disconnect(d->control, SIGNAL(cursorPositionChanged(int,int)), this, SLOT(moveCursor())); + disconnect(d->control, SIGNAL(updateMicroFocus()), + this, SLOT(moveCursor())); delete d->cursorItem; }else{ d->startCreatingCursor(); @@ -497,7 +519,9 @@ void QSGTextInputPrivate::startCreatingCursor() { Q_Q(QSGTextInput); q->connect(control, SIGNAL(cursorPositionChanged(int,int)), - q, SLOT(moveCursor())); + q, SLOT(moveCursor()), Qt::UniqueConnection); + q->connect(control, SIGNAL(updateMicroFocus()), + q, SLOT(moveCursor()), Qt::UniqueConnection); if(cursorComponent->isReady()){ q->createCursor(); }else if(cursorComponent->isLoading()){ @@ -648,9 +672,10 @@ void QSGTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event) } if (d->selectByMouse) { setKeepMouseGrab(false); + d->selectPressed = true; d->pressPos = event->pos(); } - bool mark = event->modifiers() & Qt::ShiftModifier; + bool mark = (event->modifiers() & Qt::ShiftModifier) && d->selectByMouse; int cursor = d->xToPos(event->pos().x()); d->control->moveCursor(cursor, mark); event->setAccepted(true); @@ -661,7 +686,7 @@ void QSGTextInput::mouseMoveEvent(QGraphicsSceneMouseEvent *event) Q_D(QSGTextInput); if (d->sendMouseEventToInputContext(event, QEvent::MouseMove)) return; - if (d->selectByMouse) { + if (d->selectPressed) { if (qAbs(int(event->pos().x() - d->pressPos.x())) > QApplication::startDragDistance()) setKeepMouseGrab(true); moveCursorSelection(d->xToPos(event->pos().x()), d->mouseSelectionMode); @@ -676,8 +701,10 @@ void QSGTextInput::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_D(QSGTextInput); if (d->sendMouseEventToInputContext(event, QEvent::MouseButtonRelease)) return; - if (d->selectByMouse) + if (d->selectPressed) { + d->selectPressed = false; setKeepMouseGrab(false); + } if (!d->showInputPanelOnFocus) { // input panel on click if (d->focusOnPress && !isReadOnly() && boundingRect().contains(event->pos())) { if (canvas() && canvas() == qApp->focusWidget()) { @@ -731,6 +758,8 @@ bool QSGTextInputPrivate::sendMouseEventToInputContext( void QSGTextInput::mouseUngrabEvent() { + Q_D(QSGTextInput); + d->selectPressed = false; setKeepMouseGrab(false); } diff --git a/src/declarative/items/qsgtextinput_p.h b/src/declarative/items/qsgtextinput_p.h index ee04579a54..ccea485e99 100644 --- a/src/declarative/items/qsgtextinput_p.h +++ b/src/declarative/items/qsgtextinput_p.h @@ -1,4 +1,4 @@ -// Commit: 27e4302b7f45f22180693d26747f419177c81e27 +// Commit: 2f173e4945dd8414636c1061acfaf9c2d8b718d8 /**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). @@ -83,7 +83,7 @@ class Q_AUTOTEST_EXPORT QSGTextInput : public QSGImplicitSizePaintedItem Q_PROPERTY(QValidator* validator READ validator WRITE setValidator NOTIFY validatorChanged) #endif Q_PROPERTY(QString inputMask READ inputMask WRITE setInputMask NOTIFY inputMaskChanged) - Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints) + Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ imHints WRITE setIMHints) Q_PROPERTY(bool acceptableInput READ hasAcceptableInput NOTIFY acceptableInputChanged) Q_PROPERTY(EchoMode echoMode READ echoMode WRITE setEchoMode NOTIFY echoModeChanged) @@ -212,6 +212,9 @@ public: bool isInputMethodComposing() const; + Qt::InputMethodHints imHints() const; + void setIMHints(Qt::InputMethodHints hints); + Q_SIGNALS: void textChanged(); void cursorPositionChanged(); diff --git a/src/declarative/items/qsgtextinput_p_p.h b/src/declarative/items/qsgtextinput_p_p.h index 00db1e995c..22c95a7b1d 100644 --- a/src/declarative/items/qsgtextinput_p_p.h +++ b/src/declarative/items/qsgtextinput_p_p.h @@ -1,4 +1,4 @@ -// Commit: 27e4302b7f45f22180693d26747f419177c81e27 +// Commit: 47712d1f330e4b22ce6dd30e7557288ef7f7fca0 /**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). @@ -72,10 +72,11 @@ public: QSGTextInputPrivate() : control(new QLineControl(QString())), color((QRgb)0), style(QSGText::Normal), styleColor((QRgb)0), hAlign(QSGTextInput::AlignLeft), - mouseSelectionMode(QSGTextInput::SelectCharacters), + mouseSelectionMode(QSGTextInput::SelectCharacters), inputMethodHints(Qt::ImhNone), hscroll(0), oldScroll(0), oldValidity(false), focused(false), focusOnPress(true), showInputPanelOnFocus(true), clickCausedFocus(false), cursorVisible(false), - autoScroll(true), selectByMouse(false), canPaste(false), hAlignImplicit(true) + autoScroll(true), selectByMouse(false), canPaste(false), hAlignImplicit(true), + selectPressed(false) { #ifdef Q_OS_SYMBIAN if (QSysInfo::symbianVersion() == QSysInfo::SV_SF_1 || QSysInfo::symbianVersion() == QSysInfo::SV_SF_3) { @@ -106,6 +107,7 @@ public: void mirrorChange(); int calculateTextWidth(); bool sendMouseEventToInputContext(QGraphicsSceneMouseEvent *event, QEvent::Type eventType); + void updateInputMethodHints(); QLineControl* control; @@ -118,6 +120,7 @@ public: QColor styleColor; QSGTextInput::HAlignment hAlign; QSGTextInput::SelectionMode mouseSelectionMode; + Qt::InputMethodHints inputMethodHints; QPointer cursorComponent; QPointer cursorItem; QPointF pressPos; @@ -139,6 +142,7 @@ public: bool selectByMouse:1; bool canPaste:1; bool hAlignImplicit:1; + bool selectPressed:1; static inline QSGTextInputPrivate *get(QSGTextInput *t) { return t->d_func(); diff --git a/tests/auto/declarative/qsgflickable/tst_qsgflickable.cpp b/tests/auto/declarative/qsgflickable/tst_qsgflickable.cpp index 1532281338..2cc6b3eac2 100644 --- a/tests/auto/declarative/qsgflickable/tst_qsgflickable.cpp +++ b/tests/auto/declarative/qsgflickable/tst_qsgflickable.cpp @@ -106,7 +106,7 @@ void tst_qsgflickable::create() QCOMPARE(obj->isInteractive(), true); QCOMPARE(obj->boundsBehavior(), QSGFlickable::DragAndOvershootBounds); QCOMPARE(obj->pressDelay(), 0); - QCOMPARE(obj->maximumFlickVelocity(), 2000.); + QCOMPARE(obj->maximumFlickVelocity(), 2500.); delete obj; } -- cgit v1.2.3 From 6a1a69e9e299a5cd7b7f262508d11de5e610c5b9 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 4 May 2011 11:52:52 +0200 Subject: added private headers to qmlplugindump.pro --- tools/qmlplugindump/qmlplugindump.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qmlplugindump/qmlplugindump.pro b/tools/qmlplugindump/qmlplugindump.pro index 53827e2f40..b9fc0fc0ad 100644 --- a/tools/qmlplugindump/qmlplugindump.pro +++ b/tools/qmlplugindump/qmlplugindump.pro @@ -2,7 +2,7 @@ TEMPLATE = app CONFIG += qt uic console DESTDIR = ../../bin -QT += declarative +QT += declarative declarative-private core-private TARGET = qmlplugindump -- cgit v1.2.3 From 09e769903362cc933aca478a5779e30d0cec4544 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Wed, 4 May 2011 12:57:28 +0200 Subject: added private headers to qmlscene --- tools/qmlscene/qmlscene.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qmlscene/qmlscene.pro b/tools/qmlscene/qmlscene.pro index 3849336fc8..a2da6ad982 100644 --- a/tools/qmlscene/qmlscene.pro +++ b/tools/qmlscene/qmlscene.pro @@ -2,7 +2,7 @@ TEMPLATE = app TARGET = qmlscene DESTDIR= ../../bin -QT += declarative +QT += declarative declarative-private target.path = $$[QT_INSTALL_BINS] INSTALLS += target -- cgit v1.2.3 From cff3c25ee616a7aee7bf1c0f983a190415668f5f Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 5 May 2011 11:07:59 +1000 Subject: Only include line numbers when necessary The mandatory line number bloats QML instructions for no reason. Moving it inline actually increases the instruction size further, but that will come down again once variable sized instruction support is added. Change-Id: I0ace03a50371ef57946edbb7c8e0e8c2fa4fdd76 --- src/declarative/qml/qdeclarativecompileddata.cpp | 2 +- src/declarative/qml/qdeclarativecompiler.cpp | 48 ++----- src/declarative/qml/qdeclarativeinstruction.cpp | 118 +++++++--------- src/declarative/qml/qdeclarativeinstruction_p.h | 22 ++- src/declarative/qml/qdeclarativevme.cpp | 34 ++--- .../tst_qdeclarativeinstruction.cpp | 155 +++++++-------------- 6 files changed, 155 insertions(+), 224 deletions(-) diff --git a/src/declarative/qml/qdeclarativecompileddata.cpp b/src/declarative/qml/qdeclarativecompileddata.cpp index 3d1e9255ad..ce57ccb33b 100644 --- a/src/declarative/qml/qdeclarativecompileddata.cpp +++ b/src/declarative/qml/qdeclarativecompileddata.cpp @@ -246,7 +246,7 @@ void QDeclarativeCompiledData::dumpInstructions() { if (!name.isEmpty()) qWarning() << name; - qWarning().nospace() << "Index\tLine\tOperation\t\tData1\tData2\tData3\tComments"; + qWarning().nospace() << "Index\tOperation\t\tData1\tData2\tData3\tComments"; qWarning().nospace() << "-------------------------------------------------------------------------------"; for (int ii = 0; ii < bytecode.count(); ++ii) { dump(&bytecode[ii], ii); diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index d325ac48dd..13a5d8769b 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -323,7 +323,6 @@ void QDeclarativeCompiler::genLiteralAssignment(const QMetaProperty &prop, QDeclarativeParser::Value *v) { QDeclarativeInstruction instr; - instr.line = v->location.start.line; if (prop.isEnumType()) { int value; if (v->value.isNumber()) { @@ -539,6 +538,7 @@ void QDeclarativeCompiler::genLiteralAssignment(const QMetaProperty &prop, instr.type = QDeclarativeInstruction::AssignCustomType; instr.assignCustomType.propertyIndex = prop.propertyIndex(); instr.assignCustomType.valueIndex = index; + instr.assignCustomType.line = v->location.start.line; QDeclarativeCompiledData::CustomTypeData data; data.index = output->indexForString(string); @@ -665,7 +665,6 @@ void QDeclarativeCompiler::compileTree(QDeclarativeParser::Object *tree) QDeclarativeInstruction import; import.type = QDeclarativeInstruction::StoreImportedScript; - import.line = 0; import.storeScript.value = output->scripts.count(); QDeclarativeScriptData *scriptData = script.script->scriptData(); @@ -687,7 +686,6 @@ void QDeclarativeCompiler::compileTree(QDeclarativeParser::Object *tree) QDeclarativeInstruction init; init.type = QDeclarativeInstruction::Init; - init.line = 0; init.init.bindingsSize = compileState.bindings.count(); init.init.parserStatusSize = compileState.parserStatusCount; init.init.contextCache = genContextCache(); @@ -700,7 +698,6 @@ void QDeclarativeCompiler::compileTree(QDeclarativeParser::Object *tree) genObject(tree); QDeclarativeInstruction def; - init.line = 0; def.type = QDeclarativeInstruction::SetDefault; output->bytecode << def; @@ -911,10 +908,10 @@ void QDeclarativeCompiler::genObject(QDeclarativeParser::Object *obj) QDeclarativeInstruction create; create.type = QDeclarativeInstruction::CreateSimpleObject; - create.line = obj->location.start.line; create.createSimple.create = output->types.at(obj->type).type->createFunction(); create.createSimple.typeSize = output->types.at(obj->type).type->createSize(); create.createSimple.type = obj->type; + create.createSimple.line = obj->location.start.line; create.createSimple.column = obj->location.start.column; output->bytecode << create; @@ -922,7 +919,7 @@ void QDeclarativeCompiler::genObject(QDeclarativeParser::Object *obj) QDeclarativeInstruction create; create.type = QDeclarativeInstruction::CreateObject; - create.line = obj->location.start.line; + create.create.line = obj->location.start.line; create.create.column = obj->location.start.column; create.create.data = -1; if (!obj->custom.isEmpty()) @@ -944,7 +941,6 @@ void QDeclarativeCompiler::genObject(QDeclarativeParser::Object *obj) if (!obj->metadata.isEmpty()) { QDeclarativeInstruction meta; meta.type = QDeclarativeInstruction::StoreMetaObject; - meta.line = 0; meta.storeMeta.data = output->indexForByteArray(obj->metadata); meta.storeMeta.aliasData = output->indexForByteArray(obj->synthdata); meta.storeMeta.propertyCache = output->propertyCaches.count(); @@ -979,7 +975,6 @@ void QDeclarativeCompiler::genObject(QDeclarativeParser::Object *obj) if (!obj->id.isEmpty()) { QDeclarativeInstruction id; id.type = QDeclarativeInstruction::SetId; - id.line = 0; id.setId.value = output->indexForString(obj->id); id.setId.index = obj->idIndex; output->bytecode << id; @@ -990,7 +985,6 @@ void QDeclarativeCompiler::genObject(QDeclarativeParser::Object *obj) QDeclarativeInstruction begin; begin.type = QDeclarativeInstruction::BeginObject; begin.begin.castValue = obj->parserStatusCast; - begin.line = obj->location.start.line; output->bytecode << begin; } @@ -1022,7 +1016,6 @@ void QDeclarativeCompiler::genObjectBody(QDeclarativeParser::Object *obj) if (seenDefer) { QDeclarativeInstruction defer; defer.type = QDeclarativeInstruction::Defer; - defer.line = 0; defer.defer.deferCount = 0; int deferIdx = output->bytecode.count(); output->bytecode << defer; @@ -1055,7 +1048,7 @@ void QDeclarativeCompiler::genObjectBody(QDeclarativeParser::Object *obj) QDeclarativeInstruction assign; assign.type = QDeclarativeInstruction::AssignSignalObject; - assign.line = v->location.start.line; + assign.assignSignalObject.line = v->location.start.line; assign.assignSignalObject.signal = output->indexForByteArray(prop->name); output->bytecode << assign; @@ -1066,12 +1059,12 @@ void QDeclarativeCompiler::genObjectBody(QDeclarativeParser::Object *obj) QDeclarativeInstruction store; store.type = QDeclarativeInstruction::StoreSignal; - store.line = v->location.start.line; store.storeSignal.signalIndex = prop->index; store.storeSignal.value = output->indexForString(v->value.asScript().trimmed()); store.storeSignal.context = ctxt.stack; store.storeSignal.name = output->indexForByteArray(prop->name); + store.storeSignal.line = v->location.start.line; output->bytecode << store; } @@ -1081,15 +1074,14 @@ void QDeclarativeCompiler::genObjectBody(QDeclarativeParser::Object *obj) foreach(Property *prop, obj->attachedProperties) { QDeclarativeInstruction fetch; fetch.type = QDeclarativeInstruction::FetchAttached; - fetch.line = prop->location.start.line; fetch.fetchAttached.id = prop->index; + fetch.fetchAttached.line = prop->location.start.line; output->bytecode << fetch; genObjectBody(prop->value); QDeclarativeInstruction pop; pop.type = QDeclarativeInstruction::PopFetchedObject; - pop.line = prop->location.start.line; output->bytecode << pop; } @@ -1097,13 +1089,12 @@ void QDeclarativeCompiler::genObjectBody(QDeclarativeParser::Object *obj) QDeclarativeInstruction fetch; fetch.type = QDeclarativeInstruction::FetchObject; fetch.fetch.property = prop->index; - fetch.line = prop->location.start.line; + fetch.fetch.line = prop->location.start.line; output->bytecode << fetch; if (!prop->value->metadata.isEmpty()) { QDeclarativeInstruction meta; meta.type = QDeclarativeInstruction::StoreMetaObject; - meta.line = 0; meta.storeMeta.data = output->indexForByteArray(prop->value->metadata); meta.storeMeta.aliasData = output->indexForByteArray(prop->value->synthdata); meta.storeMeta.propertyCache = -1; @@ -1114,7 +1105,6 @@ void QDeclarativeCompiler::genObjectBody(QDeclarativeParser::Object *obj) QDeclarativeInstruction pop; pop.type = QDeclarativeInstruction::PopFetchedObject; - pop.line = prop->location.start.line; output->bytecode << pop; } @@ -1143,7 +1133,6 @@ void QDeclarativeCompiler::genValueTypeProperty(QDeclarativeParser::Object *obj, fetch.fetchValue.property = prop->index; fetch.fetchValue.type = prop->type; fetch.fetchValue.bindingSkipList = 0; - fetch.line = prop->location.start.line; if (obj->type == -1 || output->types.at(obj->type).component) { // We only have to do this if this is a composite type. If it is a builtin @@ -1167,7 +1156,6 @@ void QDeclarativeCompiler::genValueTypeProperty(QDeclarativeParser::Object *obj, pop.fetchValue.property = prop->index; pop.fetchValue.type = prop->type; pop.fetchValue.bindingSkipList = 0; - pop.line = prop->location.start.line; output->bytecode << pop; } @@ -1178,7 +1166,7 @@ void QDeclarativeCompiler::genComponent(QDeclarativeParser::Object *obj) QDeclarativeInstruction create; create.type = QDeclarativeInstruction::CreateComponent; - create.line = root->location.start.line; + create.createComponent.line = root->location.start.line; create.createComponent.column = root->location.start.column; create.createComponent.endLine = root->location.end.line; output->bytecode << create; @@ -1196,13 +1184,11 @@ void QDeclarativeCompiler::genComponent(QDeclarativeParser::Object *obj) init.init.compiledBinding = -1; else init.init.compiledBinding = output->indexForByteArray(compileState.compiledBindingData); - init.line = obj->location.start.line; output->bytecode << init; genObject(root); QDeclarativeInstruction def; - init.line = 0; def.type = QDeclarativeInstruction::SetDefault; output->bytecode << def; @@ -1214,7 +1200,6 @@ void QDeclarativeCompiler::genComponent(QDeclarativeParser::Object *obj) if (!obj->id.isEmpty()) { QDeclarativeInstruction id; id.type = QDeclarativeInstruction::SetId; - id.line = 0; id.setId.value = output->indexForString(obj->id); id.setId.index = obj->idIndex; output->bytecode << id; @@ -1608,7 +1593,6 @@ void QDeclarativeCompiler::genListProperty(QDeclarativeParser::Property *prop, QDeclarativeInstruction fetch; fetch.type = QDeclarativeInstruction::FetchQList; - fetch.line = prop->location.start.line; fetch.fetchQmlList.property = prop->index; bool listTypeIsInterface = QDeclarativeMetaType::isInterface(listType); fetch.fetchQmlList.type = listType; @@ -1623,12 +1607,11 @@ void QDeclarativeCompiler::genListProperty(QDeclarativeParser::Property *prop, if (listTypeIsInterface) { QDeclarativeInstruction assign; assign.type = QDeclarativeInstruction::AssignObjectList; - assign.line = prop->location.start.line; + assign.assignObjectList.line = prop->location.start.line; output->bytecode << assign; } else { QDeclarativeInstruction store; store.type = QDeclarativeInstruction::StoreObjectQList; - store.line = prop->location.start.line; output->bytecode << store; } @@ -1642,7 +1625,6 @@ void QDeclarativeCompiler::genListProperty(QDeclarativeParser::Property *prop, QDeclarativeInstruction pop; pop.type = QDeclarativeInstruction::PopQList; - pop.line = prop->location.start.line; output->bytecode << pop; } @@ -1665,7 +1647,7 @@ void QDeclarativeCompiler::genPropertyAssignment(QDeclarativeParser::Property *p QDeclarativeInstruction store; store.type = QDeclarativeInstruction::StoreInterface; - store.line = v->object->location.start.line; + store.storeObject.line = v->object->location.start.line; store.storeObject.propertyIndex = prop->index; output->bytecode << store; @@ -1673,7 +1655,7 @@ void QDeclarativeCompiler::genPropertyAssignment(QDeclarativeParser::Property *p QDeclarativeInstruction store; store.type = QDeclarativeInstruction::StoreVariantObject; - store.line = v->object->location.start.line; + store.storeObject.line = v->object->location.start.line; store.storeObject.propertyIndex = prop->index; output->bytecode << store; @@ -1681,7 +1663,7 @@ void QDeclarativeCompiler::genPropertyAssignment(QDeclarativeParser::Property *p QDeclarativeInstruction store; store.type = QDeclarativeInstruction::StoreObject; - store.line = v->object->location.start.line; + store.storeObject.line = v->object->location.start.line; store.storeObject.propertyIndex = prop->index; output->bytecode << store; @@ -1711,7 +1693,6 @@ void QDeclarativeCompiler::genPropertyAssignment(QDeclarativeParser::Property *p QDeclarativeInstruction store; store.type = QDeclarativeInstruction::StoreValueSource; - store.line = v->object->location.start.line; if (valueTypeProperty) { store.assignValueSource.property = genValueTypeData(prop, valueTypeProperty); store.assignValueSource.owner = 1; @@ -1728,7 +1709,6 @@ void QDeclarativeCompiler::genPropertyAssignment(QDeclarativeParser::Property *p QDeclarativeInstruction store; store.type = QDeclarativeInstruction::StoreValueInterceptor; - store.line = v->object->location.start.line; if (valueTypeProperty) { store.assignValueInterceptor.property = genValueTypeData(prop, valueTypeProperty); store.assignValueInterceptor.owner = 1; @@ -2835,7 +2815,7 @@ void QDeclarativeCompiler::genBindingAssignment(QDeclarativeParser::Value *bindi ((prop->index & 0xFF) << 24); else store.assignBinding.property = prop->index; - store.line = binding->location.start.line; + store.assignBinding.line = binding->location.start.line; output->bytecode << store; return; } @@ -2848,7 +2828,7 @@ void QDeclarativeCompiler::genBindingAssignment(QDeclarativeParser::Value *bindi store.assignBinding.value = output->indexForByteArray(ref.compiledData); store.assignBinding.context = ref.bindingContext.stack; store.assignBinding.owner = ref.bindingContext.owner; - store.line = binding->location.start.line; + store.assignBinding.line = binding->location.start.line; Q_ASSERT(ref.bindingContext.owner == 0 || (ref.bindingContext.owner != 0 && valueTypeProperty)); diff --git a/src/declarative/qml/qdeclarativeinstruction.cpp b/src/declarative/qml/qdeclarativeinstruction.cpp index 556b7bc343..237cfa2a16 100644 --- a/src/declarative/qml/qdeclarativeinstruction.cpp +++ b/src/declarative/qml/qdeclarativeinstruction.cpp @@ -53,178 +53,168 @@ void QDeclarativeCompiledData::dump(QDeclarativeInstruction *instr, int idx) Q_UNUSED(instr) Q_UNUSED(idx) #else - QByteArray lineNumber = QByteArray::number(instr->line); - if (instr->line == (unsigned short)-1) - lineNumber = "NA"; - const char *line = lineNumber.constData(); - switch(instr->type) { case QDeclarativeInstruction::Init: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "INIT\t\t\t" << instr->init.bindingsSize << "\t" << instr->init.parserStatusSize << "\t" << instr->init.contextCache << "\t" << instr->init.compiledBinding; + qWarning().nospace() << idx << "\t\t" << "INIT\t\t\t" << instr->init.bindingsSize << "\t" << instr->init.parserStatusSize << "\t" << instr->init.contextCache << "\t" << instr->init.compiledBinding; break; case QDeclarativeInstruction::CreateObject: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "CREATE\t\t\t" << instr->create.type << "\t" << instr->create.bindingBits << "\t\t" << types.at(instr->create.type).className; + qWarning().nospace() << idx << "\t\t" << "CREATE\t\t\t" << instr->create.type << "\t" << instr->create.bindingBits << "\t\t" << types.at(instr->create.type).className; break; case QDeclarativeInstruction::CreateSimpleObject: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "CREATE_SIMPLE\t\t" << instr->createSimple.typeSize; + qWarning().nospace() << idx << "\t\t" << "CREATE_SIMPLE\t\t" << instr->createSimple.typeSize; break; case QDeclarativeInstruction::SetId: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "SETID\t\t\t" << instr->setId.value << "\t\t\t" << primitives.at(instr->setId.value); + qWarning().nospace() << idx << "\t\t" << "SETID\t\t\t" << instr->setId.value << "\t\t\t" << primitives.at(instr->setId.value); break; case QDeclarativeInstruction::SetDefault: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "SET_DEFAULT"; + qWarning().nospace() << idx << "\t\t" << "SET_DEFAULT"; break; case QDeclarativeInstruction::CreateComponent: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "CREATE_COMPONENT\t" << instr->createComponent.count; + qWarning().nospace() << idx << "\t\t" << "CREATE_COMPONENT\t" << instr->createComponent.count; break; case QDeclarativeInstruction::StoreMetaObject: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_META\t\t" << instr->storeMeta.data; + qWarning().nospace() << idx << "\t\t" << "STORE_META\t\t" << instr->storeMeta.data; break; - case QDeclarativeInstruction::StoreFloat: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_FLOAT\t\t" << instr->storeFloat.propertyIndex << "\t" << instr->storeFloat.value; + qWarning().nospace() << idx << "\t\t" << "STORE_FLOAT\t\t" << instr->storeFloat.propertyIndex << "\t" << instr->storeFloat.value; break; case QDeclarativeInstruction::StoreDouble: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_DOUBLE\t\t" << instr->storeDouble.propertyIndex << "\t" << instr->storeDouble.value; + qWarning().nospace() << idx << "\t\t" << "STORE_DOUBLE\t\t" << instr->storeDouble.propertyIndex << "\t" << instr->storeDouble.value; break; case QDeclarativeInstruction::StoreInteger: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_INTEGER\t\t" << instr->storeInteger.propertyIndex << "\t" << instr->storeInteger.value; + qWarning().nospace() << idx << "\t\t" << "STORE_INTEGER\t\t" << instr->storeInteger.propertyIndex << "\t" << instr->storeInteger.value; break; case QDeclarativeInstruction::StoreBool: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_BOOL\t\t" << instr->storeBool.propertyIndex << "\t" << instr->storeBool.value; + qWarning().nospace() << idx << "\t\t" << "STORE_BOOL\t\t" << instr->storeBool.propertyIndex << "\t" << instr->storeBool.value; break; case QDeclarativeInstruction::StoreString: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_STRING\t\t" << instr->storeString.propertyIndex << "\t" << instr->storeString.value << "\t\t" << primitives.at(instr->storeString.value); + qWarning().nospace() << idx << "\t\t" << "STORE_STRING\t\t" << instr->storeString.propertyIndex << "\t" << instr->storeString.value << "\t\t" << primitives.at(instr->storeString.value); break; case QDeclarativeInstruction::StoreByteArray: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_BYTEARRAY" << instr->storeByteArray.propertyIndex << "\t" << instr->storeByteArray.value << "\t\t" << datas.at(instr->storeByteArray.value); + qWarning().nospace() << idx << "\t\t" << "STORE_BYTEARRAY" << instr->storeByteArray.propertyIndex << "\t" << instr->storeByteArray.value << "\t\t" << datas.at(instr->storeByteArray.value); break; case QDeclarativeInstruction::StoreUrl: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_URL\t\t" << instr->storeUrl.propertyIndex << "\t" << instr->storeUrl.value << "\t\t" << urls.at(instr->storeUrl.value); + qWarning().nospace() << idx << "\t\t" << "STORE_URL\t\t" << instr->storeUrl.propertyIndex << "\t" << instr->storeUrl.value << "\t\t" << urls.at(instr->storeUrl.value); break; case QDeclarativeInstruction::StoreColor: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_COLOR\t\t" << instr->storeColor.propertyIndex << "\t\t\t" << QString::number(instr->storeColor.value, 16); + qWarning().nospace() << idx << "\t\t" << "STORE_COLOR\t\t" << instr->storeColor.propertyIndex << "\t\t\t" << QString::number(instr->storeColor.value, 16); break; case QDeclarativeInstruction::StoreDate: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_DATE\t\t" << instr->storeDate.propertyIndex << "\t" << instr->storeDate.value; + qWarning().nospace() << idx << "\t\t" << "STORE_DATE\t\t" << instr->storeDate.propertyIndex << "\t" << instr->storeDate.value; break; case QDeclarativeInstruction::StoreTime: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_TIME\t\t" << instr->storeTime.propertyIndex << "\t" << instr->storeTime.valueIndex; + qWarning().nospace() << idx << "\t\t" << "STORE_TIME\t\t" << instr->storeTime.propertyIndex << "\t" << instr->storeTime.valueIndex; break; case QDeclarativeInstruction::StoreDateTime: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_DATETIME\t\t" << instr->storeDateTime.propertyIndex << "\t" << instr->storeDateTime.valueIndex; + qWarning().nospace() << idx << "\t\t" << "STORE_DATETIME\t\t" << instr->storeDateTime.propertyIndex << "\t" << instr->storeDateTime.valueIndex; break; case QDeclarativeInstruction::StorePoint: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_POINT\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex; + qWarning().nospace() << idx << "\t\t" << "STORE_POINT\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex; break; case QDeclarativeInstruction::StorePointF: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_POINTF\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex; + qWarning().nospace() << idx << "\t\t" << "STORE_POINTF\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex; break; case QDeclarativeInstruction::StoreSize: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_SIZE\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex; + qWarning().nospace() << idx << "\t\t" << "STORE_SIZE\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex; break; case QDeclarativeInstruction::StoreSizeF: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_SIZEF\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex; + qWarning().nospace() << idx << "\t\t" << "STORE_SIZEF\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex; break; case QDeclarativeInstruction::StoreRect: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_RECT\t\t" << instr->storeRect.propertyIndex << "\t" << instr->storeRect.valueIndex; + qWarning().nospace() << idx << "\t\t" << "STORE_RECT\t\t" << instr->storeRect.propertyIndex << "\t" << instr->storeRect.valueIndex; break; case QDeclarativeInstruction::StoreRectF: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_RECTF\t\t" << instr->storeRect.propertyIndex << "\t" << instr->storeRect.valueIndex; + qWarning().nospace() << idx << "\t\t" << "STORE_RECTF\t\t" << instr->storeRect.propertyIndex << "\t" << instr->storeRect.valueIndex; break; case QDeclarativeInstruction::StoreVector3D: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VECTOR3D\t\t" << instr->storeVector3D.propertyIndex << "\t" << instr->storeVector3D.valueIndex; + qWarning().nospace() << idx << "\t\t" << "STORE_VECTOR3D\t\t" << instr->storeVector3D.propertyIndex << "\t" << instr->storeVector3D.valueIndex; break; case QDeclarativeInstruction::StoreVariant: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VARIANT\t\t" << instr->storeString.propertyIndex << "\t" << instr->storeString.value << "\t\t" << primitives.at(instr->storeString.value); + qWarning().nospace() << idx << "\t\t" << "STORE_VARIANT\t\t" << instr->storeString.propertyIndex << "\t" << instr->storeString.value << "\t\t" << primitives.at(instr->storeString.value); break; case QDeclarativeInstruction::StoreVariantInteger: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VARIANT_INTEGER\t\t" << instr->storeInteger.propertyIndex << "\t" << instr->storeInteger.value; + qWarning().nospace() << idx << "\t\t" << "STORE_VARIANT_INTEGER\t\t" << instr->storeInteger.propertyIndex << "\t" << instr->storeInteger.value; break; case QDeclarativeInstruction::StoreVariantDouble: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VARIANT_DOUBLE\t\t" << instr->storeDouble.propertyIndex << "\t" << instr->storeDouble.value; + qWarning().nospace() << idx << "\t\t" << "STORE_VARIANT_DOUBLE\t\t" << instr->storeDouble.propertyIndex << "\t" << instr->storeDouble.value; break; case QDeclarativeInstruction::StoreVariantBool: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VARIANT_BOOL\t\t" << instr->storeBool.propertyIndex << "\t" << instr->storeBool.value; + qWarning().nospace() << idx << "\t\t" << "STORE_VARIANT_BOOL\t\t" << instr->storeBool.propertyIndex << "\t" << instr->storeBool.value; break; case QDeclarativeInstruction::StoreObject: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_OBJECT\t\t" << instr->storeObject.propertyIndex; + qWarning().nospace() << idx << "\t\t" << "STORE_OBJECT\t\t" << instr->storeObject.propertyIndex; break; case QDeclarativeInstruction::StoreVariantObject: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VARIANT_OBJECT\t" << instr->storeObject.propertyIndex; + qWarning().nospace() << idx << "\t\t" << "STORE_VARIANT_OBJECT\t" << instr->storeObject.propertyIndex; break; case QDeclarativeInstruction::StoreInterface: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_INTERFACE\t\t" << instr->storeObject.propertyIndex; + qWarning().nospace() << idx << "\t\t" << "STORE_INTERFACE\t\t" << instr->storeObject.propertyIndex; break; - case QDeclarativeInstruction::StoreSignal: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_SIGNAL\t\t" << instr->storeSignal.signalIndex << "\t" << instr->storeSignal.value << "\t\t" << primitives.at(instr->storeSignal.value); + qWarning().nospace() << idx << "\t\t" << "STORE_SIGNAL\t\t" << instr->storeSignal.signalIndex << "\t" << instr->storeSignal.value << "\t\t" << primitives.at(instr->storeSignal.value); break; case QDeclarativeInstruction::StoreImportedScript: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_IMPORTED_SCRIPT\t" << instr->storeScript.value; + qWarning().nospace() << idx << "\t\t" << "STORE_IMPORTED_SCRIPT\t" << instr->storeScript.value; break; case QDeclarativeInstruction::StoreScriptString: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_SCRIPT_STRING\t" << instr->storeScriptString.propertyIndex << "\t" << instr->storeScriptString.value << "\t" << instr->storeScriptString.scope; + qWarning().nospace() << idx << "\t\t" << "STORE_SCRIPT_STRING\t" << instr->storeScriptString.propertyIndex << "\t" << instr->storeScriptString.value << "\t" << instr->storeScriptString.scope; break; - case QDeclarativeInstruction::AssignSignalObject: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "ASSIGN_SIGNAL_OBJECT\t" << instr->assignSignalObject.signal << "\t\t\t" << datas.at(instr->assignSignalObject.signal); + qWarning().nospace() << idx << "\t\t" << "ASSIGN_SIGNAL_OBJECT\t" << instr->assignSignalObject.signal << "\t\t\t" << datas.at(instr->assignSignalObject.signal); break; case QDeclarativeInstruction::AssignCustomType: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "ASSIGN_CUSTOMTYPE\t" << instr->assignCustomType.propertyIndex << "\t" << instr->assignCustomType.valueIndex; + qWarning().nospace() << idx << "\t\t" << "ASSIGN_CUSTOMTYPE\t" << instr->assignCustomType.propertyIndex << "\t" << instr->assignCustomType.valueIndex; break; - case QDeclarativeInstruction::StoreBinding: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_BINDING\t" << instr->assignBinding.property << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context; + qWarning().nospace() << idx << "\t\t" << "STORE_BINDING\t" << instr->assignBinding.property << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context; break; case QDeclarativeInstruction::StoreBindingOnAlias: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_BINDING_ALIAS\t" << instr->assignBinding.property << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context; + qWarning().nospace() << idx << "\t\t" << "STORE_BINDING_ALIAS\t" << instr->assignBinding.property << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context; break; case QDeclarativeInstruction::StoreCompiledBinding: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_COMPILED_BINDING\t" << instr->assignBinding.property << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context; + qWarning().nospace() << idx << "\t\t" << "STORE_COMPILED_BINDING\t" << instr->assignBinding.property << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context; break; case QDeclarativeInstruction::StoreValueSource: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VALUE_SOURCE\t" << instr->assignValueSource.property << "\t" << instr->assignValueSource.castValue; + qWarning().nospace() << idx << "\t\t" << "STORE_VALUE_SOURCE\t" << instr->assignValueSource.property << "\t" << instr->assignValueSource.castValue; break; case QDeclarativeInstruction::StoreValueInterceptor: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VALUE_INTERCEPTOR\t" << instr->assignValueInterceptor.property << "\t" << instr->assignValueInterceptor.castValue; + qWarning().nospace() << idx << "\t\t" << "STORE_VALUE_INTERCEPTOR\t" << instr->assignValueInterceptor.property << "\t" << instr->assignValueInterceptor.castValue; break; - case QDeclarativeInstruction::BeginObject: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "BEGIN\t\t\t" << instr->begin.castValue; + qWarning().nospace() << idx << "\t\t" << "BEGIN\t\t\t" << instr->begin.castValue; break; case QDeclarativeInstruction::StoreObjectQList: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_OBJECT_QLIST"; + qWarning().nospace() << idx << "\t\t" << "STORE_OBJECT_QLIST"; break; case QDeclarativeInstruction::AssignObjectList: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "ASSIGN_OBJECT_LIST"; + qWarning().nospace() << idx << "\t\t" << "ASSIGN_OBJECT_LIST"; break; case QDeclarativeInstruction::FetchAttached: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "FETCH_ATTACHED\t\t" << instr->fetchAttached.id; + qWarning().nospace() << idx << "\t\t" << "FETCH_ATTACHED\t\t" << instr->fetchAttached.id; break; case QDeclarativeInstruction::FetchQList: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "FETCH_QLIST\t\t" << instr->fetch.property; + qWarning().nospace() << idx << "\t\t" << "FETCH_QLIST\t\t" << instr->fetch.property; break; case QDeclarativeInstruction::FetchObject: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "FETCH\t\t\t" << instr->fetch.property; + qWarning().nospace() << idx << "\t\t" << "FETCH\t\t\t" << instr->fetch.property; break; case QDeclarativeInstruction::FetchValueType: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "FETCH_VALUE\t\t" << instr->fetchValue.property << "\t" << instr->fetchValue.type << "\t" << instr->fetchValue.bindingSkipList; + qWarning().nospace() << idx << "\t\t" << "FETCH_VALUE\t\t" << instr->fetchValue.property << "\t" << instr->fetchValue.type << "\t" << instr->fetchValue.bindingSkipList; break; case QDeclarativeInstruction::PopFetchedObject: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "POP"; + qWarning().nospace() << idx << "\t\t" << "POP"; break; case QDeclarativeInstruction::PopQList: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "POP_QLIST"; + qWarning().nospace() << idx << "\t\t" << "POP_QLIST"; break; case QDeclarativeInstruction::PopValueType: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "POP_VALUE\t\t" << instr->fetchValue.property << "\t" << instr->fetchValue.type; + qWarning().nospace() << idx << "\t\t" << "POP_VALUE\t\t" << instr->fetchValue.property << "\t" << instr->fetchValue.type; break; case QDeclarativeInstruction::Defer: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "DEFER" << "\t\t\t" << instr->defer.deferCount; + qWarning().nospace() << idx << "\t\t" << "DEFER" << "\t\t\t" << instr->defer.deferCount; break; default: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "XXX UNKNOWN INSTRUCTION" << "\t" << instr->type; + qWarning().nospace() << idx << "\t\t" << "XXX UNKNOWN INSTRUCTION" << "\t" << instr->type; break; } #endif // QT_NO_DEBUG_STREAM diff --git a/src/declarative/qml/qdeclarativeinstruction_p.h b/src/declarative/qml/qdeclarativeinstruction_p.h index a5521b6425..3032964a33 100644 --- a/src/declarative/qml/qdeclarativeinstruction_p.h +++ b/src/declarative/qml/qdeclarativeinstruction_p.h @@ -142,7 +142,7 @@ public: BeginObject, /* begin */ StoreObjectQList, /* NA */ - AssignObjectList, /* NA */ + AssignObjectList, /* assignObjectList */ FetchAttached, /* fetchAttached */ FetchQList, /* fetch */ @@ -163,11 +163,9 @@ public: // Defer /* defer */ }; - QDeclarativeInstruction() - : line(0) {} + QDeclarativeInstruction() {} Type type; - unsigned short line; struct InitInstruction { int bindingsSize; @@ -180,12 +178,14 @@ public: int data; int bindingBits; ushort column; + ushort line; }; struct CreateSimpleInstruction { void (*create)(void *); int typeSize; int type; ushort column; + ushort line; }; struct StoreMetaInstruction { int data; @@ -211,9 +211,11 @@ public: int value; short context; short owner; + ushort line; }; struct FetchInstruction { int property; + ushort line; }; struct FetchValueInstruction { int property; @@ -293,32 +295,41 @@ public: }; struct StoreObjectInstruction { int propertyIndex; + ushort line; }; struct AssignCustomTypeInstruction { int propertyIndex; int valueIndex; + ushort line; }; struct StoreSignalInstruction { int signalIndex; int value; short context; int name; + ushort line; }; struct AssignSignalObjectInstruction { int signal; + ushort line; }; struct CreateComponentInstruction { int count; - ushort column; int endLine; int metaObject; + ushort column; + ushort line; }; struct FetchAttachedInstruction { int id; + ushort line; }; struct DeferInstruction { int deferCount; }; + struct AssignObjectListInstruction { + ushort line; + }; union { InitInstruction init; @@ -356,6 +367,7 @@ public: CreateComponentInstruction createComponent; FetchAttachedInstruction fetchAttached; DeferInstruction defer; + AssignObjectListInstruction assignObjectList; }; void dump(QDeclarativeCompiledData *); diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp index 6bbc47bcaf..af29991858 100644 --- a/src/declarative/qml/qdeclarativevme.cpp +++ b/src/declarative/qml/qdeclarativevme.cpp @@ -80,11 +80,11 @@ QDeclarativeVME::QDeclarativeVME() { } -#define VME_EXCEPTION(desc) \ +#define VME_EXCEPTION(desc, line) \ { \ QDeclarativeError error; \ error.setDescription(desc.trimmed()); \ - error.setLine(instr.line); \ + error.setLine(line); \ error.setUrl(comp->url); \ vmeErrors << error; \ break; \ @@ -207,7 +207,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack, types.at(instr.create.type).createInstance(ctxt, bindings, &vmeErrors); if (!o) { - VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Unable to create object of type %1").arg(QString::fromLatin1(types.at(instr.create.type).className))); + VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Unable to create object of type %1").arg(QString::fromLatin1(types.at(instr.create.type).className)), instr.create.line); } QDeclarativeData *ddata = QDeclarativeData::get(o); @@ -232,7 +232,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack, ddata->setImplicitDestructible(); ddata->outerContext = ctxt; - ddata->lineNumber = instr.line; + ddata->lineNumber = instr.create.line; ddata->columnNumber = instr.create.column; if (instr.create.data != -1) { @@ -271,7 +271,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack, ddata->propertyCache = ref.typePropertyCache; ddata->propertyCache->addref(); } - ddata->lineNumber = instr.line; + ddata->lineNumber = instr.createSimple.line; ddata->columnNumber = instr.createSimple.column; QObjectPrivate::get(o)->declarativeData = ddata; @@ -319,8 +319,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack, ddata->setImplicitDestructible(); ddata->outerContext = ctxt; - ddata->lineNumber = instr.line; - ddata->columnNumber = instr.create.column; + ddata->lineNumber = instr.createComponent.line; + ddata->columnNumber = instr.createComponent.column; QDeclarativeComponentPrivate::get(qcomp)->creationContext = ctxt; @@ -657,7 +657,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack, QMetaProperty prop = target->metaObject()->property(instr.assignCustomType.propertyIndex); if (v.isNull() || ((int)prop.type() != data.type && prop.userType() != data.type)) - VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign value %1 to property %2").arg(primitive).arg(QString::fromUtf8(prop.name()))); + VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign value %1 to property %2").arg(primitive).arg(QString::fromUtf8(prop.name())), instr.assignCustomType.line); void *a[] = { (void *)v.data(), 0, &status, &flags }; QMetaObject::metacall(target, QMetaObject::WriteProperty, @@ -679,15 +679,15 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack, QMetaMethod method = QDeclarativeMetaType::defaultMethod(assign); if (method.signature() == 0) - VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign object type %1 with no default method").arg(QString::fromLatin1(assign->metaObject()->className()))); + VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign object type %1 with no default method").arg(QString::fromLatin1(assign->metaObject()->className())), instr.assignSignalObject.line); if (!QMetaObject::checkConnectArgs(prop.method().signature(), method.signature())) - VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot connect mismatched signal/slot %1 %vs. %2").arg(QString::fromLatin1(method.signature())).arg(QString::fromLatin1(prop.method().signature()))); + VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot connect mismatched signal/slot %1 %vs. %2").arg(QString::fromLatin1(method.signature())).arg(QString::fromLatin1(prop.method().signature())), instr.assignSignalObject.line); QDeclarativePropertyPrivate::connect(target, prop.index(), assign, method.methodIndex()); } else { - VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign an object to signal property %1").arg(QString::fromUtf8(pr))); + VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign an object to signal property %1").arg(QString::fromUtf8(pr)), instr.assignSignalObject.line); } @@ -704,7 +704,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack, QDeclarativeBoundSignal *bs = new QDeclarativeBoundSignal(target, signal, target); QDeclarativeExpression *expr = new QDeclarativeExpression(ctxt, context, primitives.at(instr.storeSignal.value)); - expr->setSourceLocation(comp->name, instr.line); + expr->setSourceLocation(comp->name, instr.storeSignal.line); static_cast(QObjectPrivate::get(expr))->name = datas.at(instr.storeSignal.name); bs->setExpression(expr); } @@ -758,7 +758,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack, if ((stack.count() - instr.assignBinding.owner) == 1 && bindingSkipList.testBit(coreIndex)) break; - QDeclarativeBinding *bind = new QDeclarativeBinding((void *)datas.at(instr.assignBinding.value).constData(), comp, context, ctxt, comp->name, instr.line, 0); + QDeclarativeBinding *bind = new QDeclarativeBinding((void *)datas.at(instr.assignBinding.value).constData(), comp, context, ctxt, comp->name, instr.assignBinding.line, 0); bindValues.append(bind); bind->m_mePtr = &bindValues.values[bindValues.count - 1]; bind->setTarget(mp); @@ -841,7 +841,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack, if (iid) ptr = assign->qt_metacast(iid); if (!ptr) - VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign object to list")); + VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign object to list"), instr.assignObjectList.line); list.qListProperty.append((QDeclarativeListProperty*)&list.qListProperty, ptr); @@ -884,7 +884,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack, } if (!ok) - VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign object to interface property")); + VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign object to interface property"), instr.storeObject.line); } break; @@ -895,7 +895,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack, QObject *qmlObject = qmlAttachedPropertiesObjectById(instr.fetchAttached.id, target); if (!qmlObject) - VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Unable to create attached object")); + VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Unable to create attached object"), instr.fetchAttached.line); stack.push(qmlObject); } @@ -927,7 +927,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack &stack, instr.fetch.property, a); if (!obj) - VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot set properties on %1 as it is null").arg(QString::fromUtf8(target->metaObject()->property(instr.fetch.property).name()))); + VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot set properties on %1 as it is null").arg(QString::fromUtf8(target->metaObject()->property(instr.fetch.property).name())), instr.fetch.line); stack.push(obj); } diff --git a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp index b5edec8029..2dba7408ae 100644 --- a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp +++ b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp @@ -68,7 +68,6 @@ void tst_qdeclarativeinstruction::dump() QDeclarativeCompiledData *data = new QDeclarativeCompiledData(0); { QDeclarativeInstruction i; - i.line = 0; i.type = QDeclarativeInstruction::Init; i.init.bindingsSize = 0; i.init.parserStatusSize = 3; @@ -83,7 +82,6 @@ void tst_qdeclarativeinstruction::dump() data->types << ref; QDeclarativeInstruction i; - i.line = 1; i.type = QDeclarativeInstruction::CreateObject; i.create.type = 0; i.create.data = -1; @@ -96,7 +94,6 @@ void tst_qdeclarativeinstruction::dump() data->primitives << "testId"; QDeclarativeInstruction i; - i.line = 2; i.type = QDeclarativeInstruction::SetId; i.setId.value = data->primitives.count() - 1; i.setId.index = 0; @@ -105,14 +102,12 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 3; i.type = QDeclarativeInstruction::SetDefault; data->bytecode << i; } { QDeclarativeInstruction i; - i.line = 4; i.type = QDeclarativeInstruction::CreateComponent; i.createComponent.count = 3; i.createComponent.column = 4; @@ -124,7 +119,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 5; i.type = QDeclarativeInstruction::StoreMetaObject; i.storeMeta.data = 3; i.storeMeta.aliasData = 6; @@ -135,7 +129,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 6; i.type = QDeclarativeInstruction::StoreFloat; i.storeFloat.propertyIndex = 3; i.storeFloat.value = 11.3; @@ -144,7 +137,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 7; i.type = QDeclarativeInstruction::StoreDouble; i.storeDouble.propertyIndex = 4; i.storeDouble.value = 14.8; @@ -153,7 +145,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 8; i.type = QDeclarativeInstruction::StoreInteger; i.storeInteger.propertyIndex = 5; i.storeInteger.value = 9; @@ -162,7 +153,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 9; i.type = QDeclarativeInstruction::StoreBool; i.storeBool.propertyIndex = 6; i.storeBool.value = true; @@ -173,7 +163,6 @@ void tst_qdeclarativeinstruction::dump() { data->primitives << "Test String"; QDeclarativeInstruction i; - i.line = 10; i.type = QDeclarativeInstruction::StoreString; i.storeString.propertyIndex = 7; i.storeString.value = data->primitives.count() - 1; @@ -183,7 +172,6 @@ void tst_qdeclarativeinstruction::dump() { data->urls << QUrl("http://www.nokia.com"); QDeclarativeInstruction i; - i.line = 11; i.type = QDeclarativeInstruction::StoreUrl; i.storeUrl.propertyIndex = 8; i.storeUrl.value = data->urls.count() - 1; @@ -192,7 +180,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 12; i.type = QDeclarativeInstruction::StoreColor; i.storeColor.propertyIndex = 9; i.storeColor.value = 0xFF00FF00; @@ -201,7 +188,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 13; i.type = QDeclarativeInstruction::StoreDate; i.storeDate.propertyIndex = 10; i.storeDate.value = 9; @@ -210,7 +196,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 14; i.type = QDeclarativeInstruction::StoreTime; i.storeTime.propertyIndex = 11; i.storeTime.valueIndex = 33; @@ -219,7 +204,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 15; i.type = QDeclarativeInstruction::StoreDateTime; i.storeDateTime.propertyIndex = 12; i.storeDateTime.valueIndex = 44; @@ -228,7 +212,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 16; i.type = QDeclarativeInstruction::StorePoint; i.storeRealPair.propertyIndex = 13; i.storeRealPair.valueIndex = 3; @@ -237,7 +220,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 17; i.type = QDeclarativeInstruction::StorePointF; i.storeRealPair.propertyIndex = 14; i.storeRealPair.valueIndex = 9; @@ -246,7 +228,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 18; i.type = QDeclarativeInstruction::StoreSize; i.storeRealPair.propertyIndex = 15; i.storeRealPair.valueIndex = 8; @@ -255,7 +236,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 19; i.type = QDeclarativeInstruction::StoreSizeF; i.storeRealPair.propertyIndex = 16; i.storeRealPair.valueIndex = 99; @@ -264,7 +244,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 20; i.type = QDeclarativeInstruction::StoreRect; i.storeRect.propertyIndex = 17; i.storeRect.valueIndex = 2; @@ -273,7 +252,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 21; i.type = QDeclarativeInstruction::StoreRectF; i.storeRect.propertyIndex = 18; i.storeRect.valueIndex = 19; @@ -282,7 +260,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 22; i.type = QDeclarativeInstruction::StoreVector3D; i.storeVector3D.propertyIndex = 19; i.storeVector3D.valueIndex = 9; @@ -292,7 +269,6 @@ void tst_qdeclarativeinstruction::dump() { data->primitives << "color(1, 1, 1, 1)"; QDeclarativeInstruction i; - i.line = 23; i.type = QDeclarativeInstruction::StoreVariant; i.storeString.propertyIndex = 20; i.storeString.value = data->primitives.count() - 1; @@ -302,7 +278,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 24; i.type = QDeclarativeInstruction::StoreObject; i.storeObject.propertyIndex = 21; data->bytecode << i; @@ -310,7 +285,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 25; i.type = QDeclarativeInstruction::StoreVariantObject; i.storeObject.propertyIndex = 22; data->bytecode << i; @@ -318,7 +292,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 26; i.type = QDeclarativeInstruction::StoreInterface; i.storeObject.propertyIndex = 23; data->bytecode << i; @@ -328,7 +301,6 @@ void tst_qdeclarativeinstruction::dump() data->primitives << "console.log(1921)"; QDeclarativeInstruction i; - i.line = 27; i.type = QDeclarativeInstruction::StoreSignal; i.storeSignal.signalIndex = 2; i.storeSignal.value = data->primitives.count() - 1; @@ -337,7 +309,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 29; i.type = QDeclarativeInstruction::StoreScriptString; i.storeScriptString.propertyIndex = 24; i.storeScriptString.value = 3; @@ -349,7 +320,6 @@ void tst_qdeclarativeinstruction::dump() data->datas << "mySignal"; QDeclarativeInstruction i; - i.line = 30; i.type = QDeclarativeInstruction::AssignSignalObject; i.assignSignalObject.signal = 0; data->bytecode << i; @@ -357,7 +327,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 31; i.type = QDeclarativeInstruction::AssignCustomType; i.assignCustomType.propertyIndex = 25; i.assignCustomType.valueIndex = 4; @@ -366,7 +335,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 32; i.type = QDeclarativeInstruction::StoreBinding; i.assignBinding.property = 26; i.assignBinding.value = 3; @@ -377,7 +345,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 33; i.type = QDeclarativeInstruction::StoreCompiledBinding; i.assignBinding.property = 27; i.assignBinding.value = 2; @@ -388,7 +355,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 34; i.type = QDeclarativeInstruction::StoreValueSource; i.assignValueSource.property = 29; i.assignValueSource.owner = 1; @@ -398,7 +364,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 35; i.type = QDeclarativeInstruction::StoreValueInterceptor; i.assignValueInterceptor.property = 30; i.assignValueInterceptor.owner = 2; @@ -408,7 +373,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 36; i.type = QDeclarativeInstruction::BeginObject; i.begin.castValue = 4; data->bytecode << i; @@ -416,21 +380,18 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 38; i.type = QDeclarativeInstruction::StoreObjectQList; data->bytecode << i; } { QDeclarativeInstruction i; - i.line = 39; i.type = QDeclarativeInstruction::AssignObjectList; data->bytecode << i; } { QDeclarativeInstruction i; - i.line = 40; i.type = QDeclarativeInstruction::FetchAttached; i.fetchAttached.id = 23; data->bytecode << i; @@ -438,7 +399,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 42; i.type = QDeclarativeInstruction::FetchQList; i.fetch.property = 32; data->bytecode << i; @@ -446,7 +406,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 43; i.type = QDeclarativeInstruction::FetchObject; i.fetch.property = 33; data->bytecode << i; @@ -454,7 +413,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 44; i.type = QDeclarativeInstruction::FetchValueType; i.fetchValue.property = 34; i.fetchValue.type = 6; @@ -464,21 +422,18 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 45; i.type = QDeclarativeInstruction::PopFetchedObject; data->bytecode << i; } { QDeclarativeInstruction i; - i.line = 46; i.type = QDeclarativeInstruction::PopQList; data->bytecode << i; } { QDeclarativeInstruction i; - i.line = 47; i.type = QDeclarativeInstruction::PopValueType; i.fetchValue.property = 35; i.fetchValue.type = 8; @@ -487,7 +442,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 48; i.type = QDeclarativeInstruction::Defer; i.defer.deferCount = 7; data->bytecode << i; @@ -495,7 +449,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = -1; i.type = QDeclarativeInstruction::Defer; i.defer.deferCount = 7; data->bytecode << i; @@ -503,7 +456,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 48; i.type = QDeclarativeInstruction::StoreImportedScript; i.storeScript.value = 2; data->bytecode << i; @@ -511,14 +463,12 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 50; i.type = (QDeclarativeInstruction::Type)(1234); // Non-existent data->bytecode << i; } { QDeclarativeInstruction i; - i.line = 51; i.type = QDeclarativeInstruction::StoreVariantInteger; i.storeInteger.value = 11; i.storeInteger.propertyIndex = 32; @@ -527,7 +477,6 @@ void tst_qdeclarativeinstruction::dump() { QDeclarativeInstruction i; - i.line = 52; i.type = QDeclarativeInstruction::StoreVariantDouble; i.storeDouble.value = 33.7; i.storeDouble.propertyIndex = 19; @@ -536,59 +485,59 @@ void tst_qdeclarativeinstruction::dump() QStringList expect; expect - << "Index\tLine\tOperation\t\tData1\tData2\tData3\tComments" + << "Index\tOperation\t\tData1\tData2\tData3\tComments" << "-------------------------------------------------------------------------------" - << "0\t\t0\tINIT\t\t\t0\t3\t-1\t-1" - << "1\t\t1\tCREATE\t\t\t0\t-1\t\t\"Test\"" - << "2\t\t2\tSETID\t\t\t0\t\t\t\"testId\"" - << "3\t\t3\tSET_DEFAULT" - << "4\t\t4\tCREATE_COMPONENT\t3" - << "5\t\t5\tSTORE_META\t\t3" - << "6\t\t6\tSTORE_FLOAT\t\t3\t11.3" - << "7\t\t7\tSTORE_DOUBLE\t\t4\t14.8" - << "8\t\t8\tSTORE_INTEGER\t\t5\t9" - << "9\t\t9\tSTORE_BOOL\t\t6\ttrue" - << "10\t\t10\tSTORE_STRING\t\t7\t1\t\t\"Test String\"" - << "11\t\t11\tSTORE_URL\t\t8\t0\t\tQUrl(\"http://www.nokia.com\") " - << "12\t\t12\tSTORE_COLOR\t\t9\t\t\t\"ff00ff00\"" - << "13\t\t13\tSTORE_DATE\t\t10\t9" - << "14\t\t14\tSTORE_TIME\t\t11\t33" - << "15\t\t15\tSTORE_DATETIME\t\t12\t44" - << "16\t\t16\tSTORE_POINT\t\t13\t3" - << "17\t\t17\tSTORE_POINTF\t\t14\t9" - << "18\t\t18\tSTORE_SIZE\t\t15\t8" - << "19\t\t19\tSTORE_SIZEF\t\t16\t99" - << "20\t\t20\tSTORE_RECT\t\t17\t2" - << "21\t\t21\tSTORE_RECTF\t\t18\t19" - << "22\t\t22\tSTORE_VECTOR3D\t\t19\t9" - << "23\t\t23\tSTORE_VARIANT\t\t20\t2\t\t\"color(1, 1, 1, 1)\"" - << "24\t\t24\tSTORE_OBJECT\t\t21" - << "25\t\t25\tSTORE_VARIANT_OBJECT\t22" - << "26\t\t26\tSTORE_INTERFACE\t\t23" - << "27\t\t27\tSTORE_SIGNAL\t\t2\t3\t\t\"console.log(1921)\"" - << "28\t\t29\tSTORE_SCRIPT_STRING\t24\t3\t1" - << "29\t\t30\tASSIGN_SIGNAL_OBJECT\t0\t\t\t\"mySignal\"" - << "30\t\t31\tASSIGN_CUSTOMTYPE\t25\t4" - << "31\t\t32\tSTORE_BINDING\t26\t3\t2" - << "32\t\t33\tSTORE_COMPILED_BINDING\t27\t2\t4" - << "33\t\t34\tSTORE_VALUE_SOURCE\t29\t4" - << "34\t\t35\tSTORE_VALUE_INTERCEPTOR\t30\t-4" - << "35\t\t36\tBEGIN\t\t\t4" - << "36\t\t38\tSTORE_OBJECT_QLIST" - << "37\t\t39\tASSIGN_OBJECT_LIST" - << "38\t\t40\tFETCH_ATTACHED\t\t23" - << "39\t\t42\tFETCH_QLIST\t\t32" - << "40\t\t43\tFETCH\t\t\t33" - << "41\t\t44\tFETCH_VALUE\t\t34\t6\t7" - << "42\t\t45\tPOP" - << "43\t\t46\tPOP_QLIST" - << "44\t\t47\tPOP_VALUE\t\t35\t8" - << "45\t\t48\tDEFER\t\t\t7" - << "46\t\tNA\tDEFER\t\t\t7" - << "47\t\t48\tSTORE_IMPORTED_SCRIPT\t2" - << "48\t\t50\tXXX UNKNOWN INSTRUCTION\t1234" - << "49\t\t51\tSTORE_VARIANT_INTEGER\t\t32\t11" - << "50\t\t52\tSTORE_VARIANT_DOUBLE\t\t19\t33.7" + << "0\t\tINIT\t\t\t0\t3\t-1\t-1" + << "1\t\tCREATE\t\t\t0\t-1\t\t\"Test\"" + << "2\t\tSETID\t\t\t0\t\t\t\"testId\"" + << "3\t\tSET_DEFAULT" + << "4\t\tCREATE_COMPONENT\t3" + << "5\t\tSTORE_META\t\t3" + << "6\t\tSTORE_FLOAT\t\t3\t11.3" + << "7\t\tSTORE_DOUBLE\t\t4\t14.8" + << "8\t\tSTORE_INTEGER\t\t5\t9" + << "9\t\tSTORE_BOOL\t\t6\ttrue" + << "10\t\tSTORE_STRING\t\t7\t1\t\t\"Test String\"" + << "11\t\tSTORE_URL\t\t8\t0\t\tQUrl(\"http://www.nokia.com\") " + << "12\t\tSTORE_COLOR\t\t9\t\t\t\"ff00ff00\"" + << "13\t\tSTORE_DATE\t\t10\t9" + << "14\t\tSTORE_TIME\t\t11\t33" + << "15\t\tSTORE_DATETIME\t\t12\t44" + << "16\t\tSTORE_POINT\t\t13\t3" + << "17\t\tSTORE_POINTF\t\t14\t9" + << "18\t\tSTORE_SIZE\t\t15\t8" + << "19\t\tSTORE_SIZEF\t\t16\t99" + << "20\t\tSTORE_RECT\t\t17\t2" + << "21\t\tSTORE_RECTF\t\t18\t19" + << "22\t\tSTORE_VECTOR3D\t\t19\t9" + << "23\t\tSTORE_VARIANT\t\t20\t2\t\t\"color(1, 1, 1, 1)\"" + << "24\t\tSTORE_OBJECT\t\t21" + << "25\t\tSTORE_VARIANT_OBJECT\t22" + << "26\t\tSTORE_INTERFACE\t\t23" + << "27\t\tSTORE_SIGNAL\t\t2\t3\t\t\"console.log(1921)\"" + << "28\t\tSTORE_SCRIPT_STRING\t24\t3\t1" + << "29\t\tASSIGN_SIGNAL_OBJECT\t0\t\t\t\"mySignal\"" + << "30\t\tASSIGN_CUSTOMTYPE\t25\t4" + << "31\t\tSTORE_BINDING\t26\t3\t2" + << "32\t\tSTORE_COMPILED_BINDING\t27\t2\t4" + << "33\t\tSTORE_VALUE_SOURCE\t29\t4" + << "34\t\tSTORE_VALUE_INTERCEPTOR\t30\t-4" + << "35\t\tBEGIN\t\t\t4" + << "36\t\tSTORE_OBJECT_QLIST" + << "37\t\tASSIGN_OBJECT_LIST" + << "38\t\tFETCH_ATTACHED\t\t23" + << "39\t\tFETCH_QLIST\t\t32" + << "40\t\tFETCH\t\t\t33" + << "41\t\tFETCH_VALUE\t\t34\t6\t7" + << "42\t\tPOP" + << "43\t\tPOP_QLIST" + << "44\t\tPOP_VALUE\t\t35\t8" + << "45\t\tDEFER\t\t\t7" + << "46\t\tDEFER\t\t\t7" + << "47\t\tSTORE_IMPORTED_SCRIPT\t2" + << "48\t\tXXX UNKNOWN INSTRUCTION\t1234" + << "49\t\tSTORE_VARIANT_INTEGER\t\t32\t11" + << "50\t\tSTORE_VARIANT_DOUBLE\t\t19\t33.7" << "-------------------------------------------------------------------------------"; messages = QStringList(); -- cgit v1.2.3