diff options
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/QmlChanges.txt | 3 | ||||
-rw-r--r-- | src/declarative/fx/qfxflickable.cpp | 32 | ||||
-rw-r--r-- | src/declarative/fx/qfxflickable.h | 6 | ||||
-rw-r--r-- | src/declarative/fx/qfxflickable_p.h | 2 | ||||
-rw-r--r-- | src/declarative/fx/qfxgridview.cpp | 2 | ||||
-rw-r--r-- | src/declarative/fx/qfxitem.cpp | 2 | ||||
-rw-r--r-- | src/declarative/fx/qfxlistview.cpp | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmldeclarativedata_p.h | 5 | ||||
-rw-r--r-- | src/declarative/qml/qmlengine.cpp | 9 | ||||
-rw-r--r-- | src/declarative/qml/qmlengine_p.h | 4 | ||||
-rw-r--r-- | src/declarative/qml/qmlenginedebug.cpp | 11 | ||||
-rw-r--r-- | src/declarative/qml/qmlinfo.cpp | 16 | ||||
-rw-r--r-- | src/declarative/qml/qmlinstruction_p.h | 1 | ||||
-rw-r--r-- | src/declarative/qml/qmlvme.cpp | 5 |
14 files changed, 64 insertions, 36 deletions
diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index 069bf49..a401a70 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -1,7 +1,7 @@ QML API Review ============== -The QML API is being reviewed from 17 to 28 August 2009. This +The QML API is being reviewed from 17 to 4 September 2009. This file documents the changes. Note that the changes are incremental, so a rename A->B for example may be follow by another subseqent rename B->C, if later reviews override earlier reviews. @@ -47,6 +47,7 @@ Flickable: yPosition -> viewportY Flickable: xVelocity -> horizontalVelocity Flickable: yVelocity -> verticalVelocity Flickable: velocityDecay -> reportedVelocitySmoothing +Flickable: locked -> interactive (note reversal of meaning) WebView: idealWidth -> preferredWidth WebView: idealHeight -> preferredHeight WebView: status -> statusText diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp index 27bfa27..0690df1 100644 --- a/src/declarative/fx/qfxflickable.cpp +++ b/src/declarative/fx/qfxflickable.cpp @@ -95,7 +95,7 @@ void ElasticValue::updateCurrentTime(int) QFxFlickablePrivate::QFxFlickablePrivate() : _flick(new QFxItem), _moveX(_flick, &QFxItem::setX), _moveY(_flick, &QFxItem::setY) , vWidth(-1), vHeight(-1), overShoot(true), flicked(false), moving(false), stealMouse(false) - , pressed(false), maxVelocity(-1), locked(false), dragMode(QFxFlickable::Hard) + , pressed(false), maxVelocity(-1), interactive(true), dragMode(QFxFlickable::Hard) , elasticY(_moveY), elasticX(_moveX), reportedVelocitySmoothing(100), horizontalVelocity(this), verticalVelocity(this) , vTime(0), atXEnd(false), atXBeginning(true), pageXPosition(0.), pageWidth(0.) , atYEnd(false), atYBeginning(true), pageYPosition(0.), pageHeight(0.) @@ -201,12 +201,12 @@ void QFxFlickablePrivate::fixupX() vTime = _tl.time(); if (_moveX.value() > q->minXExtent() || (q->maxXExtent() > q->maxXExtent())) { - _tl.clear(); + _tl.reset(_moveY); if (_moveX.value() != q->minXExtent()) _tl.move(_moveX, q->minXExtent(), QEasingCurve(QEasingCurve::InOutQuad), 200); //emit flickingChanged(); } else if (_moveX.value() < q->maxXExtent()) { - _tl.clear(); + _tl.reset(_moveY); _tl.move(_moveX, q->maxXExtent(), QEasingCurve(QEasingCurve::InOutQuad), 200); //emit flickingChanged(); } else { @@ -223,12 +223,12 @@ void QFxFlickablePrivate::fixupY() vTime = _tl.time(); if (_moveY.value() > q->minYExtent() || (q->maxYExtent() > q->minYExtent())) { - _tl.clear(); + _tl.reset(_moveY); if (_moveY.value() != q->minYExtent()) _tl.move(_moveY, q->minYExtent(), QEasingCurve(QEasingCurve::InOutQuad), 200); //emit flickingChanged(); } else if (_moveY.value() < q->maxYExtent()) { - _tl.clear(); + _tl.reset(_moveY); _tl.move(_moveY, q->maxYExtent(), QEasingCurve(QEasingCurve::InOutQuad), 200); //emit flickingChanged(); } else { @@ -411,24 +411,30 @@ void QFxFlickable::setViewportY(qreal pos) } /*! - \qmlproperty bool Flickable::locked + \qmlproperty bool Flickable::interactive - A user cannot drag or flick a Flickable that is locked. + A user cannot drag or flick a Flickable that is not interactive. This property is useful for temporarily disabling flicking. This allows special interaction with Flickable's children: for example, you might want to freeze a flickable map while viewing detailed information on a location popup that is a child of the Flickable. */ -bool QFxFlickable::isLocked() const +bool QFxFlickable::isInteractive() const { Q_D(const QFxFlickable); - return d->locked; + return d->interactive; } -void QFxFlickable::setLocked(bool lock) +void QFxFlickable::setInteractive(bool interactive) { Q_D(QFxFlickable); - d->locked = lock; + d->interactive = interactive; + if (!interactive && d->flicked) { + d->_tl.clear(); + d->flicked = false; + emit flickingChanged(); + emit flickEnded(); + } } /*! @@ -577,7 +583,7 @@ qreal QFxFlickable::visibleY() const void QFxFlickablePrivate::handleMousePressEvent(QGraphicsSceneMouseEvent *event) { - if (!locked && _tl.isActive() && (qAbs(velocityX) > 10 || qAbs(velocityY) > 10)) + if (interactive && _tl.isActive() && (qAbs(velocityX) > 10 || qAbs(velocityY) > 10)) stealMouse = true; // If we've been flicked then steal the click. else stealMouse = false; @@ -602,7 +608,7 @@ void QFxFlickablePrivate::handleMousePressEvent(QGraphicsSceneMouseEvent *event) void QFxFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event) { Q_Q(QFxFlickable); - if (locked || lastPosTime.isNull()) + if (!interactive || lastPosTime.isNull()) return; bool rejectY = false; bool rejectX = false; diff --git a/src/declarative/fx/qfxflickable.h b/src/declarative/fx/qfxflickable.h index c27b29f..57a01d7 100644 --- a/src/declarative/fx/qfxflickable.h +++ b/src/declarative/fx/qfxflickable.h @@ -69,7 +69,7 @@ class Q_DECLARATIVE_EXPORT QFxFlickable : public QFxItem Q_PROPERTY(bool moving READ isMoving NOTIFY movingChanged) Q_PROPERTY(bool flicking READ isFlicking NOTIFY flickingChanged) - Q_PROPERTY(bool locked READ isLocked WRITE setLocked) //### interactive, ensure flicking is stopped, etc. + Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive) Q_PROPERTY(DragMode dragMode READ dragMode WRITE setDragMode) //### remove. Consider a better way to implement different drag behavior Q_PROPERTY(bool atXEnd READ isAtXEnd NOTIFY isAtBoundaryChanged) @@ -117,8 +117,8 @@ public: qreal maximumFlickVelocity() const; void setMaximumFlickVelocity(qreal); - bool isLocked() const; - void setLocked(bool); + bool isInteractive() const; + void setInteractive(bool); Q_ENUMS(DragMode) enum DragMode { Hard, Elastic }; diff --git a/src/declarative/fx/qfxflickable_p.h b/src/declarative/fx/qfxflickable_p.h index a0ac011..ad9484f 100644 --- a/src/declarative/fx/qfxflickable_p.h +++ b/src/declarative/fx/qfxflickable_p.h @@ -121,7 +121,7 @@ public: QmlTimeLineEvent fixupXEvent; QmlTimeLineEvent fixupYEvent; qreal maxVelocity; - bool locked; + bool interactive; QFxFlickable::DragMode dragMode; ElasticValue elasticY; ElasticValue elasticX; diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp index 138a8ae..6fd080b 100644 --- a/src/declarative/fx/qfxgridview.cpp +++ b/src/declarative/fx/qfxgridview.cpp @@ -1069,7 +1069,7 @@ qreal QFxGridView::maxXExtent() const void QFxGridView::keyPressEvent(QKeyEvent *event) { Q_D(QFxGridView); - if (d->model && d->model->count() && !d->locked) { + if (d->model && d->model->count() && d->interactive) { if ((d->flow == QFxGridView::LeftToRight && event->key() == Qt::Key_Up) || (d->flow == QFxGridView::TopToBottom && event->key() == Qt::Key_Left)) { if (currentIndex() >= d->columns || d->wrap) { diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index c436622..d28f531 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -928,7 +928,7 @@ private: virtual void keyPressed(QKeyEvent *event); virtual void keyReleased(QKeyEvent *event); - const char *keyToSignal(int key) { + const QByteArray keyToSignal(int key) { QByteArray keySignal; if (key >= Qt::Key_0 && key <= Qt::Key_9) { keySignal = "digit0Pressed"; diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index 147c977..34fe827 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -1344,7 +1344,7 @@ qreal QFxListView::maxXExtent() const void QFxListView::keyPressEvent(QKeyEvent *event) { Q_D(QFxListView); - if (d->model && d->model->count() && !d->locked) { + if (d->model && d->model->count() && d->interactive) { if ((d->orient == Qt::Horizontal && event->key() == Qt::Key_Left) || (d->orient == Qt::Vertical && event->key() == Qt::Key_Up)) { if (currentIndex() > 0 || d->wrap) { diff --git a/src/declarative/qml/qmldeclarativedata_p.h b/src/declarative/qml/qmldeclarativedata_p.h index 5a51eb7..a316c0c 100644 --- a/src/declarative/qml/qmldeclarativedata_p.h +++ b/src/declarative/qml/qmldeclarativedata_p.h @@ -59,6 +59,7 @@ QT_BEGIN_NAMESPACE class QmlCompiledData; class QmlAbstractBinding; +class QmlContext; class QmlDeclarativeData : public QDeclarativeData { public: @@ -69,6 +70,10 @@ public: QmlContext *context; QmlAbstractBinding *bindings; + QmlContext *outerContext; // Can't this be found from context? + ushort lineNumber; + ushort columnNumber; + QmlCompiledData *deferredComponent; // Can't this be found from the context? unsigned int deferredIdx; diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index 0bd3931..e342d3f 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -108,7 +108,7 @@ QScriptValue desktopOpenUrl(QScriptContext *ctxt, QScriptEngine *e) } QmlEnginePrivate::QmlEnginePrivate(QmlEngine *e) -: rootContext(0), currentBindContext(0), currentExpression(0), +: rootContext(0), currentExpression(0), isDebugging(false), contextClass(0), objectClass(0), valueTypeClass(0), nodeListClass(0), namedNodeMapClass(0), scriptEngine(this), rootComponent(0), networkAccessManager(0), typeManager(e), uniqueId(1) @@ -206,13 +206,6 @@ void QmlEnginePrivate::init() } } -QmlContext *QmlEnginePrivate::setCurrentBindContext(QmlContext *c) -{ - QmlContext *old = currentBindContext; - currentBindContext = c; - return old; -} - QmlEnginePrivate::CapturedProperty::CapturedProperty(const QmlMetaProperty &p) : object(p.object()), coreIndex(p.coreIndex()), notifyIndex(p.property().notifySignalIndex()) { diff --git a/src/declarative/qml/qmlengine_p.h b/src/declarative/qml/qmlengine_p.h index 1e251cc..a33add3 100644 --- a/src/declarative/qml/qmlengine_p.h +++ b/src/declarative/qml/qmlengine_p.h @@ -114,7 +114,6 @@ public: QPODVector<CapturedProperty> capturedProperties; QmlContext *rootContext; - QmlContext *currentBindContext; // ### Remove me QmlExpression *currentExpression; bool isDebugging; #ifdef QT_SCRIPTTOOLS_LIB @@ -128,9 +127,6 @@ public: QScriptClass *nodeListClass; QScriptClass *namedNodeMapClass; - QmlContext *setCurrentBindContext(QmlContext *); - QStack<QmlContext *> activeContexts; // ### Remove me - struct QmlScriptEngine : public QScriptEngine { QmlScriptEngine(QmlEnginePrivate *priv) diff --git a/src/declarative/qml/qmlenginedebug.cpp b/src/declarative/qml/qmlenginedebug.cpp index 0e78cad..321fe74 100644 --- a/src/declarative/qml/qmlenginedebug.cpp +++ b/src/declarative/qml/qmlenginedebug.cpp @@ -181,9 +181,16 @@ void QmlEngineDebugServer::buildObjectList(QDataStream &message, QmlEngineDebugServer::QmlObjectData QmlEngineDebugServer::objectData(QObject *object) { + QmlDeclarativeData *ddata = QmlDeclarativeData::get(object); QmlObjectData rv; - rv.lineNumber = -1; - rv.columnNumber = -1; + if (ddata) { + rv.url = ddata->outerContext->baseUrl(); + rv.lineNumber = ddata->lineNumber; + rv.columnNumber = ddata->columnNumber; + } else { + rv.lineNumber = -1; + rv.columnNumber = -1; + } rv.objectName = object->objectName(); rv.objectType = object->metaObject()->className(); diff --git a/src/declarative/qml/qmlinfo.cpp b/src/declarative/qml/qmlinfo.cpp index 65a4298..e47b4ab 100644 --- a/src/declarative/qml/qmlinfo.cpp +++ b/src/declarative/qml/qmlinfo.cpp @@ -40,6 +40,8 @@ ****************************************************************************/ #include "qmlinfo.h" +#include <private/qmldeclarativedata_p.h> +#include <QtDeclarative/qmlcontext.h> QT_BEGIN_NAMESPACE @@ -80,7 +82,19 @@ QmlInfo::QmlInfo(QObject *object) *this << "QML"; if (object) *this << object->metaObject()->className(); - *this << "(unknown location):"; + QmlDeclarativeData *ddata = QmlDeclarativeData::get(object); + if (ddata) { + QString location = QLatin1String("("); + location += ddata->outerContext->baseUrl().toString(); + location += QLatin1String(":"); + location += QString::number(ddata->lineNumber); + location += QLatin1String(":"); + location += QString::number(ddata->columnNumber); + location += QLatin1String(")"); + *this << location.toLatin1().constData(); + } else { + *this << "(unknown location):"; + } } /*! diff --git a/src/declarative/qml/qmlinstruction_p.h b/src/declarative/qml/qmlinstruction_p.h index 8861609a..ede06a2 100644 --- a/src/declarative/qml/qmlinstruction_p.h +++ b/src/declarative/qml/qmlinstruction_p.h @@ -170,6 +170,7 @@ public: struct { int type; int data; + ushort column; } create; struct { int data; diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp index 930e6e4..7907195 100644 --- a/src/declarative/qml/qmlvme.cpp +++ b/src/declarative/qml/qmlvme.cpp @@ -174,6 +174,11 @@ QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt, QmlCompiledData VME_EXCEPTION("Unable to create object of type" << types.at(instr.create.type).className); } + QmlDeclarativeData *ddata = QmlDeclarativeData::get(o); + ddata->outerContext = ctxt; + ddata->lineNumber = instr.line; + ddata->columnNumber = instr.create.column; + if (instr.create.data != -1) { QmlCustomParser *customParser = types.at(instr.create.type).type->customParser(); |