diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2010-11-12 14:33:33 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-11-12 14:33:33 (GMT) |
commit | 437e83e7707516129f68ee26aca5349845b7cc7b (patch) | |
tree | 0d4c8721f21acc5398e4eabff88a902cb23d0521 /src/declarative | |
parent | 7b3880475d02bd3db630387bccccc7e1ef9d4e9a (diff) | |
parent | e61071a2a170eaeb524778e9e903100323b88bbe (diff) | |
download | Qt-437e83e7707516129f68ee26aca5349845b7cc7b.zip Qt-437e83e7707516129f68ee26aca5349845b7cc7b.tar.gz Qt-437e83e7707516129f68ee26aca5349845b7cc7b.tar.bz2 |
Merge remote branch 'origin/4.7' into qt-master-from-4.7
Conflicts:
configure
doc/src/snippets/code/doc_src_qmake-manual.qdoc
mkspecs/features/symbian/application_icon.prf
mkspecs/features/symbian/default_post.prf
mkspecs/features/symbian/symbian_building.prf
qmake/generators/symbian/initprojectdeploy_symbian.cpp
src/multimedia/audio/audio.pri
src/network/access/qnetworkaccessmanager.cpp
src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
src/opengl/qgl_p.h
src/plugins/bearer/corewlan/qcorewlanengine.mm
src/plugins/phonon/mmf/mmf.pro
tests/auto/qscriptvalue/tst_qscriptvalue.cpp
tests/auto/qscriptvalue/tst_qscriptvalue.h
tools/qdoc3/doc/qdoc-manual.qdocconf
Diffstat (limited to 'src/declarative')
30 files changed, 320 insertions, 142 deletions
diff --git a/src/declarative/debugger/qdeclarativedebughelper.cpp b/src/declarative/debugger/qdeclarativedebughelper.cpp index 207ad2b..b003c12 100644 --- a/src/declarative/debugger/qdeclarativedebughelper.cpp +++ b/src/declarative/debugger/qdeclarativedebughelper.cpp @@ -48,6 +48,7 @@ #include <private/qdeclarativeengine_p.h> #include <private/qabstractanimation_p.h> +#include <private/qdeclarativeengine_p.h> QT_BEGIN_NAMESPACE @@ -63,4 +64,11 @@ void QDeclarativeDebugHelper::setAnimationSlowDownFactor(qreal factor) timer->setSlowdownFactor(factor); } +void QDeclarativeDebugHelper::enableDebugging() { + if (!QDeclarativeEnginePrivate::qml_debugging_enabled) { + qWarning("Qml debugging is enabled. Only use this in a safe environment!"); + } + QDeclarativeEnginePrivate::qml_debugging_enabled = true; +} + QT_END_NAMESPACE diff --git a/src/declarative/debugger/qdeclarativedebughelper_p.h b/src/declarative/debugger/qdeclarativedebughelper_p.h index 5689dff..fcd7115 100644 --- a/src/declarative/debugger/qdeclarativedebughelper_p.h +++ b/src/declarative/debugger/qdeclarativedebughelper_p.h @@ -55,11 +55,15 @@ class QDeclarativeEngine; // Helper methods to access private API through a stable interface // This is used in the qmljsdebugger library of QtCreator. -class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugHelper +class Q_DECLARATIVE_EXPORT QDeclarativeDebugHelper { public: static QScriptEngine *getScriptEngine(QDeclarativeEngine *engine); static void setAnimationSlowDownFactor(qreal factor); + + // Enables remote debugging functionality + // Only use this for debugging in a safe environment! + static void enableDebugging(); }; QT_END_NAMESPACE diff --git a/src/declarative/debugger/qdeclarativedebugservice.cpp b/src/declarative/debugger/qdeclarativedebugservice.cpp index c39da3d..8c86ae8 100644 --- a/src/declarative/debugger/qdeclarativedebugservice.cpp +++ b/src/declarative/debugger/qdeclarativedebugservice.cpp @@ -42,6 +42,7 @@ #include "private/qdeclarativedebugservice_p.h" #include "private/qpacketprotocol_p.h" +#include "private/qdeclarativeengine_p.h" #include <QtCore/qdebug.h> #include <QtNetwork/qtcpserver.h> @@ -205,6 +206,12 @@ QDeclarativeDebugServer *QDeclarativeDebugServer::instance() // format: qmljsdebugger=port:3768[,block] if (!appD->qmljsDebugArgumentsString().isEmpty()) { + if (!QDeclarativeEnginePrivate::qml_debugging_enabled) { + qWarning() << QString::fromLatin1("QDeclarativeDebugServer: Ignoring \"-qmljsdebugger=%1\". " + "Debugging has not been enabled.").arg( + appD->qmljsDebugArgumentsString()).toAscii().constData(); + return 0; + } if (appD->qmljsDebugArgumentsString().indexOf(QLatin1String("port:")) == 0) { int separatorIndex = appD->qmljsDebugArgumentsString().indexOf(QLatin1Char(',')); diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index 6fe1522..0f786e3 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -53,9 +53,6 @@ QT_BEGIN_NAMESPACE // before we perform a flick. static const int FlickThreshold = 20; -// Really slow flicks can be annoying. -static const int MinimumFlickVelocity = 75; - QDeclarativeFlickableVisibleArea::QDeclarativeFlickableVisibleArea(QDeclarativeFlickable *parent) : QObject(parent), flickable(parent), m_xPosition(0.), m_widthRatio(0.) , m_yPosition(0.), m_heightRatio(0.) @@ -990,8 +987,8 @@ void QDeclarativeFlickable::viewportMoved() { Q_D(QDeclarativeFlickable); - qreal prevY = d->lastFlickablePosition.x(); - qreal prevX = d->lastFlickablePosition.y(); + qreal prevX = d->lastFlickablePosition.x(); + qreal prevY = d->lastFlickablePosition.y(); d->velocityTimeline.clear(); if (d->pressed || d->calcVelocity) { int elapsed = QDeclarativeItemPrivate::restart(d->velocityTime); @@ -1012,7 +1009,7 @@ void QDeclarativeFlickable::viewportMoved() } } - d->lastFlickablePosition = QPointF(d->vData.move.value(), d->hData.move.value()); + d->lastFlickablePosition = QPointF(d->hData.move.value(), d->vData.move.value()); d->vTime = d->timeline.time(); d->updateBeginningEnd(); @@ -1032,6 +1029,13 @@ void QDeclarativeFlickable::geometryChanged(const QRectF &newGeometry, d->contentItem->setWidth(width()); emit contentWidthChanged(); } + // Make sure that we're entirely in view. + if (!d->pressed && !d->movingHorizontally && !d->movingVertically) { + int oldDuration = d->fixupDuration; + d->fixupDuration = 0; + d->fixupX(); + d->fixupDuration = oldDuration; + } } if (newGeometry.height() != oldGeometry.height()) { if (yflick()) @@ -1040,6 +1044,13 @@ void QDeclarativeFlickable::geometryChanged(const QRectF &newGeometry, d->contentItem->setHeight(height()); emit contentHeightChanged(); } + // Make sure that we're entirely in view. + if (!d->pressed && !d->movingHorizontally && !d->movingVertically) { + int oldDuration = d->fixupDuration; + d->fixupDuration = 0; + d->fixupY(); + d->fixupDuration = oldDuration; + } } if (changed) @@ -1161,19 +1172,18 @@ void QDeclarativeFlickable::setBoundsBehavior(BoundsBehavior b) \qmlproperty real Flickable::contentWidth \qmlproperty real Flickable::contentHeight - The dimensions of the content (the surface controlled by Flickable). Typically this - should be set to the combined size of the items placed in the Flickable. Note this - can be set automatically using \l {Item::childrenRect.width}{childrenRect.width} - and \l {Item::childrenRect.height}{childrenRect.height}. For example: + The dimensions of the content (the surface controlled by Flickable). + This should typically be set to the combined size of the items placed in the + Flickable. - \code - Flickable { - width: 320; height: 480 - contentWidth: childrenRect.width; contentHeight: childrenRect.height + The following snippet shows how these properties are used to display + an image that is larger than the Flickable item itself: - Image { id: image; source: "bigImage.png" } - } - \endcode + \snippet doc/src/snippets/declarative/flickable.qml document + + In some cases, the the content dimensions can be automatically set + using the \l {Item::childrenRect.width}{childrenRect.width} + and \l {Item::childrenRect.height}{childrenRect.height} properties. */ qreal QDeclarativeFlickable::contentWidth() const { diff --git a/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h index afefde2..92cf748 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h @@ -66,6 +66,9 @@ QT_BEGIN_NAMESPACE +// Really slow flicks can be annoying. +const qreal MinimumFlickVelocity = 75.0; + class QDeclarativeFlickableVisibleArea; class QDeclarativeFlickablePrivate : public QDeclarativeItemPrivate, public QDeclarativeItemChangeListener { diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index 08d237f..3b08a9b 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -259,8 +259,10 @@ void QDeclarativeImage::setFillMode(FillMode mode) \qmlproperty real Image::paintedHeight These properties hold the size of the image that is actually painted. - In most cases it is the same as \c width and \c height, but when using a \c fillMode like - \c PreserveAspectFit \c paintedWidth or \c paintedHeight can be smaller than \c width and \c height. + In most cases it is the same as \c width and \c height, but when using a + \c fillMode \c PreserveAspectFit or \c fillMode \c PreserveAspectCrop + \c paintedWidth or \c paintedHeight can be smaller or larger than + \c width and \c height of the Image element. */ qreal QDeclarativeImage::paintedWidth() const { @@ -288,23 +290,25 @@ qreal QDeclarativeImage::paintedHeight() const Use this status to provide an update or respond to the status change in some way. For example, you could: - \e {Trigger a state change:} - \qml - State { name: 'loaded'; when: image.status = Image.Ready } + \list + \o Trigger a state change: + \qml + State { name: 'loaded'; when: image.status == Image.Ready } \endqml - \e {Implement an \c onStatusChanged signal handler:} - \qml + \o Implement an \c onStatusChanged signal handler: + \qml Image { id: image onStatusChanged: if (image.status == Image.Ready) console.log('Loaded') } \endqml - \e {Bind to the status value:} + \o Bind to the status value: \qml - Text { text: image.status != Image.Ready ? 'Not Loaded' : 'Loaded' } + Text { text: image.status == Image.Ready ? 'Loaded' : 'Not loaded' } \endqml + \endlist \sa progress */ @@ -397,6 +401,19 @@ void QDeclarativeImage::updatePaintedGeometry() if (heightValid() && !widthValid()) { setImplicitWidth(d->paintedWidth); } + } else if (d->fillMode == PreserveAspectCrop) { + if (!d->pix.width() || !d->pix.height()) + return; + qreal widthScale = width() / qreal(d->pix.width()); + qreal heightScale = height() / qreal(d->pix.height()); + if (widthScale < heightScale) { + widthScale = heightScale; + } else if(heightScale < widthScale) { + heightScale = widthScale; + } + + d->paintedHeight = heightScale * qreal(d->pix.height()); + d->paintedWidth = widthScale * qreal(d->pix.width()); } else { d->paintedWidth = width(); d->paintedHeight = height(); @@ -410,6 +427,12 @@ void QDeclarativeImage::geometryChanged(const QRectF &newGeometry, const QRectF updatePaintedGeometry(); } +QRectF QDeclarativeImage::boundingRect() const +{ + Q_D(const QDeclarativeImage); + return QRectF(0, 0, qMax(d->mWidth, d->paintedWidth), qMax(d->mHeight, d->paintedHeight)); +} + /*! \qmlproperty url Image::source @@ -494,7 +517,7 @@ void QDeclarativeImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWi } if (clip()) { p->save(); - p->setClipRect(boundingRect(), Qt::IntersectClip); + p->setClipRect(QRectF(0, 0, d->mWidth, d->mHeight), Qt::IntersectClip); } scale.scale(widthScale, heightScale); QTransform old = p->transform(); diff --git a/src/declarative/graphicsitems/qdeclarativeimage_p.h b/src/declarative/graphicsitems/qdeclarativeimage_p.h index c8bb30b..0e8034e 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage_p.h +++ b/src/declarative/graphicsitems/qdeclarativeimage_p.h @@ -76,6 +76,7 @@ public: qreal paintedHeight() const; void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); + QRectF boundingRect() const; Q_SIGNALS: void fillModeChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 95a4fd6..e0df751 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -1955,12 +1955,8 @@ void QDeclarativeItem::geometryChanged(const QRectF &newGeometry, change.listener->itemGeometryChanged(this, newGeometry, oldGeometry); } - if (newGeometry.x() != oldGeometry.x()) - emit xChanged(); if (newGeometry.width() != oldGeometry.width()) emit widthChanged(); - if (newGeometry.y() != oldGeometry.y()) - emit yChanged(); if (newGeometry.height() != oldGeometry.height()) emit heightChanged(); } diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 38a4839..94b1cb3 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -334,28 +334,9 @@ public: return model && model->count() && model->isValid(); } - int snapIndex() { - int index = currentIndex; - for (int i = 0; i < visibleItems.count(); ++i) { - FxListItem *item = visibleItems[i]; - if (item->index == -1) - continue; - qreal itemTop = item->position(); - if (itemTop >= highlight->position()-item->size()/2 && itemTop < highlight->position()+item->size()/2) - return item->index; - } - return index; - } - qreal snapPosAt(qreal pos) { - for (int i = 0; i < visibleItems.count(); ++i) { - FxListItem *item = visibleItems[i]; - if (item->index == -1) - continue; - qreal itemTop = item->position(); - if (itemTop+item->size()/2 >= pos && itemTop <= pos) - return item->position(); - } + if (FxListItem *snapItem = snapItemAt(pos)) + return snapItem->position(); if (visibleItems.count()) { qreal firstPos = visibleItems.first()->position(); qreal endPos = visibleItems.last()->position(); @@ -368,17 +349,18 @@ public: } FxListItem *snapItemAt(qreal pos) { + FxListItem *snapItem = 0; for (int i = 0; i < visibleItems.count(); ++i) { FxListItem *item = visibleItems[i]; if (item->index == -1) continue; qreal itemTop = item->position(); - if (item->index == model->count()-1 || (itemTop+item->size()/2 >= pos)) + if (highlight && itemTop >= pos && item->endPosition() <= pos + highlight->size() - 1) return item; + if (itemTop+item->size()/2 >= pos && itemTop-item->size()/2 < pos) + snapItem = item; } - if (visibleItems.count() && visibleItems.first()->position() <= pos) - return visibleItems.first(); - return 0; + return snapItem; } int lastVisibleIndex() const { @@ -768,8 +750,10 @@ void QDeclarativeListViewPrivate::layout() minExtentDirty = true; maxExtentDirty = true; updateHighlight(); - fixupPosition(); - q->refill(); + if (!q->isMoving() && !q->isFlicking()) { + fixupPosition(); + q->refill(); + } if (header) updateHeader(); if (footer) @@ -1173,6 +1157,7 @@ void QDeclarativeListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m || (orient == QDeclarativeListView::Vertical && &data == &hData)) return; + correctFlick = false; int oldDuration = fixupDuration; fixupDuration = moveReason == Mouse ? fixupDuration : 0; @@ -1350,12 +1335,15 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m qreal newtarget = data.flickTarget; if (snapMode != QDeclarativeListView::NoSnap || highlightRange == QDeclarativeListView::StrictlyEnforceRange) newtarget = -snapPosAt(-(data.flickTarget - highlightRangeStart)) + highlightRangeStart; - if (velocity < 0 && newtarget < maxExtent) - newtarget = maxExtent; - else if (velocity > 0 && newtarget > minExtent) - newtarget = minExtent; - if (newtarget == data.flickTarget) // boundary unchanged - nothing to do + if (velocity < 0 && newtarget <= maxExtent) + newtarget = maxExtent - overshootDist; + else if (velocity > 0 && newtarget >= minExtent) + newtarget = minExtent + overshootDist; + if (newtarget == data.flickTarget) { // boundary unchanged - nothing to do + if (qAbs(velocity) < MinimumFlickVelocity) + correctFlick = false; return; + } data.flickTarget = newtarget; qreal dist = -newtarget + data.move.value(); if ((v < 0 && dist < 0) || (v > 0 && dist > 0)) { @@ -1365,7 +1353,7 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m return; } timeline.reset(data.move); - timeline.accelDistance(data.move, v, -dist + (v < 0 ? -overshootDist : overshootDist)); + timeline.accelDistance(data.move, v, -dist); timeline.callback(QDeclarativeTimeLineCallback(&data.move, fixupCallback, this)); } } else { @@ -1696,7 +1684,7 @@ void QDeclarativeListView::setCurrentIndex(int index) if (isComponentComplete() && d->isValid()) { d->moveReason = QDeclarativeListViewPrivate::SetIndex; d->updateCurrent(index); - } else { + } else if (d->currentIndex != index) { d->currentIndex = index; emit currentIndexChanged(); } @@ -2323,9 +2311,10 @@ void QDeclarativeListView::viewportMoved() d->highlight->setPosition(qRound(pos)); // update current index - int idx = d->snapIndex(); - if (idx >= 0 && idx != d->currentIndex) - d->updateCurrent(idx); + if (FxListItem *snapItem = d->snapItemAt(d->highlight->position())) { + if (snapItem->index >= 0 && snapItem->index != d->currentIndex) + d->updateCurrent(snapItem->index); + } } } diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp index 7777567..109fbbb 100644 --- a/src/declarative/graphicsitems/qdeclarativeloader.cpp +++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp @@ -395,23 +395,25 @@ void QDeclarativeLoaderPrivate::_q_sourceLoaded() Use this status to provide an update or respond to the status change in some way. For example, you could: - \e {Trigger a state change:} - \qml - State { name: 'loaded'; when: loader.status = Loader.Ready } + \list + \o Trigger a state change: + \qml + State { name: 'loaded'; when: loader.status == Loader.Ready } \endqml - \e {Implement an \c onStatusChanged signal handler:} - \qml + \o Implement an \c onStatusChanged signal handler: + \qml Loader { id: loader onStatusChanged: if (loader.status == Loader.Ready) console.log('Loaded') } \endqml - \e {Bind to the status value:} + \o Bind to the status value: \qml - Text { text: loader.status != Loader.Ready ? 'Not Loaded' : 'Loaded' } + Text { text: loader.status == Loader.Ready ? 'Loaded' : 'Not loaded' } \endqml + \endlist Note that if the source is a local file, the status will initially be Ready (or Error). While there will be no onStatusChanged signal in that case, the onLoaded will still be invoked. diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp index 1ffd3bd..fc3954f 100644 --- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp +++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp @@ -477,7 +477,8 @@ void QDeclarativeRectangle::drawRect(QPainter &p) { Q_D(QDeclarativeRectangle); if ((d->gradient && d->gradient->gradient()) - || d->radius > width()/2 || d->radius > height()/2) { + || d->radius > width()/2 || d->radius > height()/2 + || width() < 3 || height() < 3) { // XXX This path is still slower than the image path // Image path won't work for gradients or invalid radius though bool oldAA = p.testRenderHint(QPainter::Antialiasing); diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 03c9765..82c444e 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -219,6 +219,7 @@ void QDeclarativeTextPrivate::updateSize() QFontMetrics fm(font); if (text.isEmpty()) { + q->setImplicitWidth(0); q->setImplicitHeight(fm.height()); emit q->paintedSizeChanged(); q->update(); @@ -284,37 +285,58 @@ QSize QDeclarativeTextPrivate::setupTextLayout() { // ### text layout handling should be profiled and optimized as needed // what about QStackTextEngine engine(tmp, d->font.font()); QTextLayout textLayout(&engine); - Q_Q(QDeclarativeText); layout.setCacheEnabled(true); qreal height = 0; + qreal widthUsed = 0; qreal lineWidth = 0; //set manual width - if (q->widthValid()) + if ((wrapMode != QDeclarativeText::NoWrap || elideMode != QDeclarativeText::ElideNone) && q->widthValid()) lineWidth = q->width(); QTextOption textOption = layout.textOption(); textOption.setWrapMode(QTextOption::WrapMode(wrapMode)); - textOption.setAlignment(Qt::Alignment(hAlign)); layout.setTextOption(textOption); layout.beginLayout(); - while (1) { + forever { QTextLine line = layout.createLine(); if (!line.isValid()) break; - if (q->widthValid()) { + if (lineWidth) line.setLineWidth(lineWidth); - line.setPosition(QPointF(0, height)); - height += line.height(); - } } layout.endLayout(); - return QSize(qCeil(layout.boundingRect().width()), layout.boundingRect().height()); + for (int i = 0; i < layout.lineCount(); ++i) { + QTextLine line = layout.lineAt(i); + widthUsed = qMax(widthUsed, line.naturalTextWidth()); + } + + qreal layoutWidth = q->widthValid() ? q->width() : widthUsed; + + qreal x = 0; + for (int i = 0; i < layout.lineCount(); ++i) { + QTextLine line = layout.lineAt(i); + line.setPosition(QPointF(0, height)); + height += line.height(); + + if (!cacheAllTextAsImage) { + if (hAlign == QDeclarativeText::AlignLeft) { + x = 0; + } else if (hAlign == QDeclarativeText::AlignRight) { + x = layoutWidth - line.naturalTextWidth(); + } else if (hAlign == QDeclarativeText::AlignHCenter) { + x = (layoutWidth - line.naturalTextWidth()) / 2; + } + line.setPosition(QPointF(x, line.y())); + } + } + + return layout.boundingRect().toAlignedRect().size(); } /*! @@ -326,6 +348,19 @@ QPixmap QDeclarativeTextPrivate::textLayoutImage(bool drawStyle) //do layout QSize size = layedOutTextSize; + qreal x = 0; + for (int i = 0; i < layout.lineCount(); ++i) { + QTextLine line = layout.lineAt(i); + if (hAlign == QDeclarativeText::AlignLeft) { + x = 0; + } else if (hAlign == QDeclarativeText::AlignRight) { + x = size.width() - line.naturalTextWidth(); + } else if (hAlign == QDeclarativeText::AlignHCenter) { + x = (size.width() - line.naturalTextWidth()) / 2; + } + line.setPosition(QPointF(x, line.y())); + } + //paint text QPixmap img(size); if (!size.isEmpty()) { @@ -1028,7 +1063,7 @@ void QDeclarativeText::setTextFormat(TextFormat format) Set this property to elide parts of the text fit to the Text item's width. The text will only elide if an explicit width has been set. - This property cannot be used with wrapping enabled or with rich text. + This property cannot be used with multi-line text or with rich text. Eliding can be: \list diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 2348478..0deacf8 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -460,10 +460,9 @@ QRect QDeclarativeTextInput::cursorRectangle() const text edit. Note that if selectionStart == selectionEnd then there is no current - selection. If you attempt to set selectionStart to a value outside of - the current text, selectionStart will not be changed. + selection. - \sa selectionEnd, cursorPosition, selectedText + \sa selectionEnd, cursorPosition, selectedText, select() */ int QDeclarativeTextInput::selectionStart() const { @@ -479,10 +478,9 @@ int QDeclarativeTextInput::selectionStart() const text edit. Note that if selectionStart == selectionEnd then there is no current - selection. If you attempt to set selectionEnd to a value outside of - the current text, selectionEnd will not be changed. + selection. - \sa selectionStart, cursorPosition, selectedText + \sa selectionStart, cursorPosition, selectedText, select() */ int QDeclarativeTextInput::selectionEnd() const { @@ -490,6 +488,19 @@ int QDeclarativeTextInput::selectionEnd() const return d->lastSelectionEnd; } +/*! + \qmlmethod void TextInput::select(int start, int end) + + Causes the text from \a start to \a end to be selected. + + If either start or end is out of range, the selection is not changed. + + After calling this, selectionStart will become the lesser + and selectionEnd will become the greater (regardless of the order passed + to this method). + + \sa selectionStart, selectionEnd +*/ void QDeclarativeTextInput::select(int start, int end) { Q_D(QDeclarativeTextInput); diff --git a/src/declarative/graphicsitems/qdeclarativetextlayout.cpp b/src/declarative/graphicsitems/qdeclarativetextlayout.cpp index 89a2158..e8da367 100644 --- a/src/declarative/graphicsitems/qdeclarativetextlayout.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextlayout.cpp @@ -94,7 +94,7 @@ class DrawTextItemRecorder: public QPaintEngine if (!m_inertText->items.isEmpty()) { QStaticTextItem &last = m_inertText->items[m_inertText->items.count() - 1]; - if (last.fontEngine == ti.fontEngine && last.font == ti.font() && + if (last.fontEngine() == ti.fontEngine && last.font == ti.font() && (!m_dirtyPen || last.color == state->pen().color())) { needFreshCurrentItem = false; @@ -107,7 +107,7 @@ class DrawTextItemRecorder: public QPaintEngine if (needFreshCurrentItem) { QStaticTextItem currentItem; - currentItem.fontEngine = ti.fontEngine; + currentItem.setFontEngine(ti.fontEngine); currentItem.font = ti.font(); currentItem.charOffset = charOffset; currentItem.numChars = ti.num_chars; @@ -285,6 +285,19 @@ void QDeclarativeTextLayout::beginLayout() QTextLayout::beginLayout(); } +void QDeclarativeTextLayout::clearLayout() +{ + if (d && d->cached) { + d->cached = false; + d->items.clear(); + d->positions.clear(); + d->glyphs.clear(); + d->chars.clear(); + d->position = QPointF(); + } + QTextLayout::clearLayout(); +} + void QDeclarativeTextLayout::prepare() { if (!d || !d->cached) { diff --git a/src/declarative/graphicsitems/qdeclarativetextlayout_p.h b/src/declarative/graphicsitems/qdeclarativetextlayout_p.h index 90bf0e0..8b81db3 100644 --- a/src/declarative/graphicsitems/qdeclarativetextlayout_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextlayout_p.h @@ -59,6 +59,7 @@ public: ~QDeclarativeTextLayout(); void beginLayout(); + void clearLayout(); void prepare(); void draw(QPainter *, const QPointF & = QPointF()); diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index 0a2a6db..2686ce3 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -98,6 +98,43 @@ class QByteArray; int width = item->width(); // width = 200 \endcode + + \section2 Network Components + + If the URL passed to QDeclarativeComponent is a network resource, or if the QML document references a + network resource, the QDeclarativeComponent has to fetch the network data before it is able to create + objects. In this case, the QDeclarativeComponent will have a \l {QDeclarativeComponent::Loading}{Loading} + \l {QDeclarativeComponent::status()}{status}. An application will have to wait until the component + is \l {QDeclarativeComponent::Ready}{Ready} before calling \l {QDeclarativeComponent::create()}. + + The following example shows how to load a QML file from a network resource. After creating + the QDeclarativeComponent, it tests whether the component is loading. If it is, it connects to the + QDeclarativeComponent::statusChanged() signal and otherwise calls the \c {continueLoading()} method + directly. Note that QDeclarativeComponent::isLoading() may be false for a network component if the + component has been cached and is ready immediately. + + \code + MyApplication::MyApplication() + { + // ... + component = new QDeclarativeComponent(engine, QUrl("http://www.example.com/main.qml")); + if (component->isLoading()) + QObject::connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)), + this, SLOT(continueLoading())); + else + continueLoading(); + } + + void MyApplication::continueLoading() + { + if (component->isError()) { + qWarning() << component->errors(); + } else { + QObject *myObject = component->create(); + } + } + \endcode + \sa {Using QML in C++ Applications}, {Integrating QML with existing Qt UI code} */ diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp index 59d5cfa..1e58a71 100644 --- a/src/declarative/qml/qdeclarativecontext.cpp +++ b/src/declarative/qml/qdeclarativecontext.cpp @@ -86,9 +86,14 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() QDeclarativeComponent component(&engine); component.setData("import QtQuick 1.0\nListView { model: myModel }", QUrl()); - component.create(context); + QObject *window = component.create(context); \endcode + Note it is the responsibility of the creator to delete any QDeclarativeContext it + constructs. If the \c context object in the example is no longer needed when the + \c window component instance is destroyed, the \c context must be destroyed explicitly. + The simplest way to ensure this is to set \c window as the parent of \c context. + To simplify binding and maintaining larger data sets, a context object can be set on a QDeclarativeContext. All the properties of the context object are available by name in the context, as though they were all individually added through calls @@ -119,11 +124,13 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() All properties added explicitly by QDeclarativeContext::setContextProperty() take precedence over the context object's properties. - Contexts form a hierarchy. The root of this hierarchy is the QDeclarativeEngine's - \l {QDeclarativeEngine::rootContext()}{root context}. A component instance can - access the data in its own context, as well as all its ancestor contexts. Data - can be made available to all instances by modifying the - \l {QDeclarativeEngine::rootContext()}{root context}. + \section2 The Context Hierarchy + + Contexts form a hierarchy. The root of this hierarchy is the QML engine's + \l {QDeclarativeEngine::rootContext()}{root context}. Child contexts inherit + the context properties of their parents; if a child context sets a context property + that already exists in its parent, the new context property overrides that of the + parent. The following example defines two contexts - \c context1 and \c context2. The second context overrides the "b" context property inherited from the first with a @@ -144,7 +151,7 @@ QDeclarativeContextPrivate::QDeclarativeContextPrivate() context, their bindings are. If a context is destroyed, the property bindings of outstanding QML objects will stop evaluating. - \note Setting the context object or adding new context properties after an object + \warning Setting the context object or adding new context properties after an object has been created in that context is an expensive operation (essentially forcing all bindings to reevaluate). Thus whenever possible you should complete "setup" of the context before using it to create any objects. diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index a11455d..cd11336 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -176,6 +176,7 @@ struct StaticQtMetaObject : public QObject }; static bool qt_QmlQtModule_registered = false; +bool QDeclarativeEnginePrivate::qml_debugging_enabled = false; void QDeclarativeEnginePrivate::defineModule() { diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h index 8539fbf..deb4a77 100644 --- a/src/declarative/qml/qdeclarativeengine_p.h +++ b/src/declarative/qml/qdeclarativeengine_p.h @@ -321,6 +321,8 @@ public: static QString urlToLocalFileOrQrc(const QUrl& url); static void defineModule(); + + static bool qml_debugging_enabled; }; /*! diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp index ed28185..bffe681 100644 --- a/src/declarative/qml/qdeclarativeenginedebug.cpp +++ b/src/declarative/qml/qdeclarativeenginedebug.cpp @@ -502,7 +502,8 @@ void QDeclarativeEngineDebugServer::setBinding(int objectId, property.write(expression); } else if (hasValidSignal(object, propertyName)) { QDeclarativeExpression *declarativeExpression = new QDeclarativeExpression(context, object, expression.toString()); - QDeclarativePropertyPrivate::setSignalExpression(property, declarativeExpression); + QDeclarativeExpression *oldExpression = QDeclarativePropertyPrivate::setSignalExpression(property, declarativeExpression); + declarativeExpression->setSourceLocation(oldExpression->sourceFile(), oldExpression->lineNumber()); } else if (property.isProperty()) { QDeclarativeBinding *binding = new QDeclarativeBinding(expression.toString(), object, context); binding->setTarget(property); diff --git a/src/declarative/qml/qdeclarativeparser_p.h b/src/declarative/qml/qdeclarativeparser_p.h index b4753df..77184c2 100644 --- a/src/declarative/qml/qdeclarativeparser_p.h +++ b/src/declarative/qml/qdeclarativeparser_p.h @@ -356,7 +356,7 @@ namespace QDeclarativeParser // True if the setting of this property will be deferred. Set by the // QDeclarativeCompiler bool isDeferred; - // True if this property is a value-type psuedo-property + // True if this property is a value-type pseudo-property bool isValueTypeSubProperty; LocationSpan location; diff --git a/src/declarative/qml/qdeclarativeprivate.h b/src/declarative/qml/qdeclarativeprivate.h index d45ddbc..388c92e 100644 --- a/src/declarative/qml/qdeclarativeprivate.h +++ b/src/declarative/qml/qdeclarativeprivate.h @@ -55,9 +55,6 @@ #include <QtCore/qglobal.h> #include <QtCore/qvariant.h> -#ifndef Q_OS_WIN -#include <stdint.h> -#endif QT_BEGIN_HEADER @@ -105,7 +102,7 @@ namespace QDeclarativePrivate template<class From, class To> struct StaticCastSelectorClass<From, To, sizeof(int)> { - static inline int cast() { return int(reinterpret_cast<intptr_t>(static_cast<To *>(reinterpret_cast<From *>(0x10000000)))) - 0x10000000; } + static inline int cast() { return int(reinterpret_cast<quintptr>(static_cast<To *>(reinterpret_cast<From *>(0x10000000)))) - 0x10000000; } }; template<class From, class To> diff --git a/src/declarative/qml/qdeclarativeworkerscript.cpp b/src/declarative/qml/qdeclarativeworkerscript.cpp index 509ca6b..ae7a80d 100644 --- a/src/declarative/qml/qdeclarativeworkerscript.cpp +++ b/src/declarative/qml/qdeclarativeworkerscript.cpp @@ -514,7 +514,7 @@ void QDeclarativeWorkerScriptEngine::run() /*! \qmlclass WorkerScript QDeclarativeWorkerScript - \ingroup qml-utility-elements + \ingroup qml-utility-elements \brief The WorkerScript element enables the use of threads in QML. Use WorkerScript to run operations in a new thread. @@ -528,7 +528,7 @@ void QDeclarativeWorkerScriptEngine::run() \snippet doc/src/snippets/declarative/workerscript.qml 0 - The above worker script specifies a javascript file, "script.js", that handles + The above worker script specifies a JavaScript file, "script.js", that handles the operations to be performed in the new thread. Here is \c script.js: \qml @@ -543,6 +543,19 @@ void QDeclarativeWorkerScriptEngine::run() \tt script.js. This in turn sends a reply message that is then received by the \tt onMessage() handler of \tt myWorker. + + \section3 Restrictions + + Since the \c WorkerScript.onMessage() function is run in a separate thread, the + JavaScript file is evaluated in a context separate from the main QML engine. This means + that unlike an ordinary JavaScript file that is imported into QML, the \c script.js + in the above example cannot access the properties, methods or other attributes + of the QML item, nor can it access any context properties set on the QML object + through QDeclarativeContext. + + Additionally, there are restrictions on the types of values that can be passed to and + from the worker script. See the sendMessage() documentation for details. + \sa {declarative/threading/workerscript}{WorkerScript example}, {declarative/threading/threadedlistmodel}{Threaded ListModel example} */ @@ -586,6 +599,19 @@ void QDeclarativeWorkerScript::setSource(const QUrl &source) Sends the given \a message to a worker script handler in another thread. The other worker script handler can receive this message through the onMessage() handler. + + The \c message object may only contain values of the following + types: + + \list + \o boolean, number, string + \o JavaScript objects and arrays + \o ListModel objects (any other type of QObject* is not allowed) + \endlist + + All objects and arrays are copied to the \c message. With the exception + of ListModel objects, any modifications by the other thread to an object + passed in \c message will not be reflected in the original object. */ void QDeclarativeWorkerScript::sendMessage(const QScriptValue &message) { diff --git a/src/declarative/qml/qmetaobjectbuilder.cpp b/src/declarative/qml/qmetaobjectbuilder.cpp index 58f8811..dfe89f8 100644 --- a/src/declarative/qml/qmetaobjectbuilder.cpp +++ b/src/declarative/qml/qmetaobjectbuilder.cpp @@ -41,10 +41,6 @@ #include "private/qmetaobjectbuilder_p.h" -#ifndef Q_OS_WIN -#include <stdint.h> -#endif - QT_BEGIN_NAMESPACE /*! @@ -1264,8 +1260,8 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf, char *str = reinterpret_cast<char *>(buf + size); if (buf) { if (relocatable) { - meta->d.stringdata = reinterpret_cast<const char *>((intptr_t)size); - meta->d.data = reinterpret_cast<uint *>((intptr_t)pmetaSize); + meta->d.stringdata = reinterpret_cast<const char *>((quintptr)size); + meta->d.data = reinterpret_cast<uint *>((quintptr)pmetaSize); } else { meta->d.stringdata = str; meta->d.data = reinterpret_cast<uint *>(data); @@ -1502,8 +1498,8 @@ void QMetaObjectBuilder::fromRelocatableData(QMetaObject *output, const char *buf = data.constData(); const QMetaObject *dataMo = reinterpret_cast<const QMetaObject *>(buf); - intptr_t stringdataOffset = (intptr_t)dataMo->d.stringdata; - intptr_t dataOffset = (intptr_t)dataMo->d.data; + quintptr stringdataOffset = (quintptr)dataMo->d.stringdata; + quintptr dataOffset = (quintptr)dataMo->d.data; output->d.superdata = superclass; output->d.stringdata = buf + stringdataOffset; diff --git a/src/declarative/util/qdeclarativefontloader.cpp b/src/declarative/util/qdeclarativefontloader.cpp index 9fee257..03a0561 100644 --- a/src/declarative/util/qdeclarativefontloader.cpp +++ b/src/declarative/util/qdeclarativefontloader.cpp @@ -297,23 +297,25 @@ void QDeclarativeFontLoader::setName(const QString &name) Use this status to provide an update or respond to the status change in some way. For example, you could: - \e {Trigger a state change:} - \qml - State { name: 'loaded'; when: loader.status = FontLoader.Ready } + \list + \o Trigger a state change: + \qml + State { name: 'loaded'; when: loader.status == FontLoader.Ready } \endqml - \e {Implement an \c onStatusChanged signal handler:} - \qml + \o Implement an \c onStatusChanged signal handler: + \qml FontLoader { id: loader onStatusChanged: if (loader.status == FontLoader.Ready) console.log('Loaded') } \endqml - \e {Bind to the status value:} + \o Bind to the status value: \qml - Text { text: loader.status != FontLoader.Ready ? 'Not Loaded' : 'Loaded' } + Text { text: loader.status == FontLoader.Ready ? 'Loaded' : 'Not loaded' } \endqml + \endlist */ QDeclarativeFontLoader::Status QDeclarativeFontLoader::status() const { diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp index 0f5413e..3915485 100644 --- a/src/declarative/util/qdeclarativestate.cpp +++ b/src/declarative/util/qdeclarativestate.cpp @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE DEFINE_BOOL_CONFIG_OPTION(stateChangeDebug, STATECHANGE_DEBUG); QDeclarativeAction::QDeclarativeAction() -: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), fromBinding(0), toBinding(0), event(0), +: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), fromBinding(0), event(0), specifiedObject(0) { } @@ -67,7 +67,7 @@ QDeclarativeAction::QDeclarativeAction(QObject *target, const QString &propertyN const QVariant &value) : restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), property(target, propertyName), toValue(value), - fromBinding(0), toBinding(0), event(0), + fromBinding(0), event(0), specifiedObject(target), specifiedProperty(propertyName) { if (property.isValid()) @@ -78,7 +78,7 @@ QDeclarativeAction::QDeclarativeAction(QObject *target, const QString &propertyN QDeclarativeContext *context, const QVariant &value) : restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), property(target, propertyName, context), toValue(value), - fromBinding(0), toBinding(0), event(0), + fromBinding(0), event(0), specifiedObject(target), specifiedProperty(propertyName) { if (property.isValid()) @@ -503,11 +503,11 @@ void QDeclarativeState::addEntriesToRevertList(const QList<QDeclarativeAction> & const QDeclarativeAction &action = actionListIterator.next(); QDeclarativeSimpleAction simpleAction(action); action.property.write(action.toValue); - if (action.toBinding) { + if (!action.toBinding.isNull()) { QDeclarativeAbstractBinding *oldBinding = QDeclarativePropertyPrivate::binding(simpleAction.property()); if (oldBinding) QDeclarativePropertyPrivate::setBinding(simpleAction.property(), 0); - QDeclarativePropertyPrivate::setBinding(simpleAction.property(), action.toBinding, QDeclarativePropertyPrivate::DontRemoveBinding); + QDeclarativePropertyPrivate::setBinding(simpleAction.property(), action.toBinding.data(), QDeclarativePropertyPrivate::DontRemoveBinding); } simpleActionList.append(simpleAction); @@ -675,7 +675,7 @@ void QDeclarativeState::apply(QDeclarativeStateGroup *group, QDeclarativeTransit a.property = d->revertList.at(ii).property(); a.fromValue = cur; a.toValue = d->revertList.at(ii).value(); - a.toBinding = d->revertList.at(ii).binding(); + a.toBinding = QDeclarativeAbstractBinding::getPointer(d->revertList.at(ii).binding()); a.specifiedObject = d->revertList.at(ii).specifiedObject(); a.specifiedProperty = d->revertList.at(ii).specifiedProperty(); a.event = d->revertList.at(ii).event(); diff --git a/src/declarative/util/qdeclarativestate_p.h b/src/declarative/util/qdeclarativestate_p.h index fc7c940..7b9c18a 100644 --- a/src/declarative/util/qdeclarativestate_p.h +++ b/src/declarative/util/qdeclarativestate_p.h @@ -45,6 +45,7 @@ #include <qdeclarative.h> #include <qdeclarativeproperty.h> #include <QtCore/qobject.h> +#include <private/qdeclarativebinding_p.h> #include <private/qdeclarativeglobal_p.h> QT_BEGIN_HEADER @@ -75,7 +76,7 @@ public: QVariant toValue; QDeclarativeAbstractBinding *fromBinding; - QDeclarativeAbstractBinding *toBinding; + QDeclarativeAbstractBinding::Pointer toBinding; QDeclarativeActionEvent *event; //strictly for matching diff --git a/src/declarative/util/qdeclarativestate_p_p.h b/src/declarative/util/qdeclarativestate_p_p.h index 4fd8f21..98c3f7b 100644 --- a/src/declarative/util/qdeclarativestate_p_p.h +++ b/src/declarative/util/qdeclarativestate_p_p.h @@ -85,7 +85,7 @@ public: m_reverseEvent = true; } else { m_value = a.toValue; - m_binding = QDeclarativeAbstractBinding::getPointer(a.toBinding); + m_binding = a.toBinding; m_reverseEvent = false; } } diff --git a/src/declarative/util/qdeclarativetransition.cpp b/src/declarative/util/qdeclarativetransition.cpp index 478c7f4..c8bc7b3 100644 --- a/src/declarative/util/qdeclarativetransition.cpp +++ b/src/declarative/util/qdeclarativetransition.cpp @@ -86,12 +86,16 @@ QT_BEGIN_NAMESPACE Item { ... transitions: [ - Transition { ... }, + Transition { to: "state1" ... }, Transition { ... } ] } \endqml + If multiple Transitions are specified, only a single (best-matching) Transition will be applied for any particular + state change. In the example above, when changing to \c state1, the first transition will be used, rather + than the more generic second transition. + If a state change has a Transition that matches the same property as a \l Behavior, the Transition animation overrides the \l Behavior for that state change. diff --git a/src/declarative/util/qdeclarativetransitionmanager.cpp b/src/declarative/util/qdeclarativetransitionmanager.cpp index 89b0044..d19e6f2 100644 --- a/src/declarative/util/qdeclarativetransitionmanager.cpp +++ b/src/declarative/util/qdeclarativetransitionmanager.cpp @@ -99,8 +99,8 @@ void QDeclarativeTransitionManager::complete() void QDeclarativeTransitionManagerPrivate::applyBindings() { foreach(const QDeclarativeAction &action, bindingsList) { - if (action.toBinding) { - QDeclarativePropertyPrivate::setBinding(action.property, action.toBinding); + if (!action.toBinding.isNull()) { + QDeclarativePropertyPrivate::setBinding(action.property, action.toBinding.data()); } else if (action.event) { if (action.reverseEvent) action.event->reverse(); @@ -145,8 +145,8 @@ void QDeclarativeTransitionManager::transition(const QList<QDeclarativeAction> & // Apply all the property and binding changes for (int ii = 0; ii < applyList.size(); ++ii) { const QDeclarativeAction &action = applyList.at(ii); - if (action.toBinding) { - QDeclarativePropertyPrivate::setBinding(action.property, action.toBinding, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); + if (!action.toBinding.isNull()) { + QDeclarativePropertyPrivate::setBinding(action.property, action.toBinding.data(), QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); } else if (!action.event) { QDeclarativePropertyPrivate::write(action.property, action.toValue, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); } else if (action.event->isReversable()) { @@ -165,7 +165,7 @@ void QDeclarativeTransitionManager::transition(const QList<QDeclarativeAction> & continue; } const QDeclarativeProperty &prop = action->property; - if (action->toBinding || !action->toValue.isValid()) { + if (!action->toBinding.isNull() || !action->toValue.isValid()) { action->toValue = prop.read(); } } @@ -259,10 +259,10 @@ void QDeclarativeTransitionManager::cancel() for(int i = 0; i < d->bindingsList.count(); ++i) { QDeclarativeAction action = d->bindingsList[i]; - if (action.toBinding && action.deletableToBinding) { + if (!action.toBinding.isNull() && action.deletableToBinding) { QDeclarativePropertyPrivate::setBinding(action.property, 0); - action.toBinding->destroy(); - action.toBinding = 0; + action.toBinding.data()->destroy(); + action.toBinding.clear(); action.deletableToBinding = false; } else if (action.event) { //### what do we do here? |