diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-07-01 13:00:57 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-07-01 13:00:57 (GMT) |
commit | 405ae4ef5382cd8ee0adfbe45c59c8d92e3ffdf6 (patch) | |
tree | 0122507f3c5ca236db3139fba231685297138f4a /src/declarative | |
parent | 8968c79c575755cdb52d5e615ed19e4529047464 (diff) | |
parent | 9fc5c260858559662e156865e4666e5a91452cc2 (diff) | |
download | Qt-405ae4ef5382cd8ee0adfbe45c59c8d92e3ffdf6.zip Qt-405ae4ef5382cd8ee0adfbe45c59c8d92e3ffdf6.tar.gz Qt-405ae4ef5382cd8ee0adfbe45c59c8d92e3ffdf6.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: (76 commits)
Reseted QtDeclarative module def files
Get WebView tests passing again
Remove arbitrary width checks
Removed compilation warning for systems with no OpenGL support
Fix bug in SameGame's dialog component
doc fix
Add abstractitemmodel example, and fix some model docs
docs - quote code with snippets, other improvements
Fix webkit import for webkit tests.
Remove qmlviewer dependency on QDeclarativeTimer
Remove a few more unnecessary exports.
Don't export declarative private classes
Add additional text layout benchmarks.
Don't access uninitialized value.
Minor Twitter demo enhancements
Added SET_BINDING message to QDeclarative debugger protocol
Add ListView.nextSection attached property
Remove the old font.outline documentation
Docs - add more links to relevant examples
Rewrite runtime & qmlviewer docs and emphasise that qmlviewer shouldn't
...
Diffstat (limited to 'src/declarative')
84 files changed, 738 insertions, 291 deletions
diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index 432b5d6..336fbbf 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -14,6 +14,8 @@ Component: - isReady, isLoading, isError and isNull properties removed, use status property instead - errorsString() renamed to errorString() +ListView: + - ListView.prevSection property changed to ListView.previousSection TextInput xToPosition -> positionAt (to match TextEdit.positionAt) diff --git a/src/declarative/debugger/qdeclarativedebug.cpp b/src/declarative/debugger/qdeclarativedebug.cpp index cd5340b..e4a991b 100644 --- a/src/declarative/debugger/qdeclarativedebug.cpp +++ b/src/declarative/debugger/qdeclarativedebug.cpp @@ -562,6 +562,33 @@ QDeclarativeDebugExpressionQuery *QDeclarativeEngineDebug::queryExpressionResult return query; } +QDeclarativeDebugExpressionQuery *QDeclarativeEngineDebug::setBindingForObject(int objectDebugId, + const QString &propertyName, + const QVariant &bindingExpression, + bool isLiteralValue, + QObject *parent) +{ + Q_D(QDeclarativeEngineDebug); + + QDeclarativeDebugExpressionQuery *query = new QDeclarativeDebugExpressionQuery(parent); + if (d->client->isConnected() && objectDebugId != -1) { + query->m_client = this; + query->m_expr = bindingExpression; + int queryId = d->getId(); + query->m_queryId = queryId; + d->expressionQuery.insert(queryId, query); + + QByteArray message; + QDataStream ds(&message, QIODevice::WriteOnly); + ds << QByteArray("SET_BINDING") << queryId << objectDebugId << propertyName << bindingExpression << isLiteralValue; + d->client->sendMessage(message); + } else { + query->m_state = QDeclarativeDebugQuery::Error; + } + + return query; +} + QDeclarativeDebugWatch::QDeclarativeDebugWatch(QObject *parent) : QObject(parent), m_state(Waiting), m_queryId(-1), m_client(0), m_objectDebugId(-1) { @@ -698,7 +725,7 @@ QDeclarativeDebugExpressionQuery::~QDeclarativeDebugExpressionQuery() QDeclarativeEngineDebugPrivate::remove(m_client, this); } -QString QDeclarativeDebugExpressionQuery::expression() const +QVariant QDeclarativeDebugExpressionQuery::expression() const { return m_expr; } diff --git a/src/declarative/debugger/qdeclarativedebug_p.h b/src/declarative/debugger/qdeclarativedebug_p.h index 4ead232..007cbd7 100644 --- a/src/declarative/debugger/qdeclarativedebug_p.h +++ b/src/declarative/debugger/qdeclarativedebug_p.h @@ -94,7 +94,11 @@ public: QDeclarativeDebugExpressionQuery *queryExpressionResult(int objectDebugId, const QString &expr, QObject *parent = 0); - + QDeclarativeDebugExpressionQuery *setBindingForObject(int objectDebugId, + const QString &propertyName, + const QVariant &bindingExpression, + bool isLiteralValue, + QObject *parent = 0); private: Q_DECLARE_PRIVATE(QDeclarativeEngineDebug) }; @@ -198,6 +202,11 @@ public: private: friend class QDeclarativeEngineDebugPrivate; + QDeclarativeDebugExpressionQuery *setBindingForObject(int objectDebugId, + const QString &propertyName, + const QVariant &bindingExpression, + bool isLiteralValue, + QObject *parent); QUrl m_url; int m_lineNumber; int m_columnNumber; @@ -215,6 +224,11 @@ public: QString name() const; private: + QDeclarativeDebugExpressionQuery *setBindingForObject(int objectDebugId, + const QString &propertyName, + const QVariant &bindingExpression, + bool isLiteralValue, + QObject *parent); friend class QDeclarativeEngineDebugPrivate; int m_debugId; QString m_name; @@ -348,7 +362,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeDebugExpressionQuery : public QDeclarativ Q_OBJECT public: virtual ~QDeclarativeDebugExpressionQuery(); - QString expression() const; + QVariant expression() const; QVariant result() const; private: friend class QDeclarativeEngineDebug; @@ -356,7 +370,7 @@ private: QDeclarativeDebugExpressionQuery(QObject *); QDeclarativeEngineDebug *m_client; int m_queryId; - QString m_expr; + QVariant m_expr; QVariant m_result; }; diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h b/src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h index 5981cd3..ec361ea 100644 --- a/src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h +++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h @@ -55,7 +55,7 @@ QT_MODULE(Declarative) class QMovie; class QDeclarativeAnimatedImagePrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeAnimatedImage : public QDeclarativeImage +class Q_AUTOTEST_EXPORT QDeclarativeAnimatedImage : public QDeclarativeImage { Q_OBJECT diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage_p.h b/src/declarative/graphicsitems/qdeclarativeborderimage_p.h index 07f049e..9944cbe 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage_p.h +++ b/src/declarative/graphicsitems/qdeclarativeborderimage_p.h @@ -54,7 +54,7 @@ QT_MODULE(Declarative) class QDeclarativeScaleGrid; class QDeclarativeGridScaledImage; class QDeclarativeBorderImagePrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeBorderImage : public QDeclarativeImageBase +class Q_AUTOTEST_EXPORT QDeclarativeBorderImage : public QDeclarativeImageBase { Q_OBJECT Q_ENUMS(TileMode) diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index 3f681b7..a40546f 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -122,7 +122,7 @@ void QDeclarativeFlickableVisibleArea::updateVisible() QDeclarativeFlickablePrivate::QDeclarativeFlickablePrivate() - : viewport(new QDeclarativeItem) + : contentItem(new QDeclarativeItem) , hData(this, &QDeclarativeFlickablePrivate::setRoundedViewportX) , vData(this, &QDeclarativeFlickablePrivate::setRoundedViewportY) , flickingHorizontally(false), flickingVertically(false) @@ -140,8 +140,8 @@ QDeclarativeFlickablePrivate::QDeclarativeFlickablePrivate() void QDeclarativeFlickablePrivate::init() { Q_Q(QDeclarativeFlickable); - QDeclarative_setParent_noEvent(viewport, q); - viewport->setParentItem(q); + QDeclarative_setParent_noEvent(contentItem, q); + contentItem->setParentItem(q); static int timelineUpdatedIdx = -1; static int timelineCompletedIdx = -1; static int flickableTickedIdx = -1; @@ -158,7 +158,7 @@ void QDeclarativeFlickablePrivate::init() q, flickableMovementEndingIdx, Qt::DirectConnection); q->setAcceptedMouseButtons(Qt::LeftButton); q->setFiltersChildEvents(true); - QDeclarativeItemPrivate *viewportPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(viewport)); + QDeclarativeItemPrivate *viewportPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(contentItem)); viewportPrivate->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry); lastPosTime.invalidate(); } @@ -182,7 +182,7 @@ qreal QDeclarativeFlickablePrivate::overShootDistance(qreal velocity, qreal size void QDeclarativeFlickablePrivate::itemGeometryChanged(QDeclarativeItem *item, const QRectF &newGeom, const QRectF &oldGeom) { Q_Q(QDeclarativeFlickable); - if (item == viewport) { + if (item == contentItem) { if (newGeom.x() != oldGeom.x()) emit q->contentXChanged(); if (newGeom.y() != oldGeom.y()) @@ -579,10 +579,28 @@ void QDeclarativeFlickable::ticked() viewportMoved(); } -QDeclarativeItem *QDeclarativeFlickable::viewport() +/*! + \qmlproperty Item Flickable::contentItem + + The internal item that contains the Items to be moved in the Flickable. + + Items declared as children of a Flickable are automatically parented to the Flickable's contentItem. + + Items created dynamically need to be explicitly parented to the \e contentItem: + \code + Flickable { + id: myFlickable + function addItem(file) { + var component = Qt.createComponent(file) + component.createObject(myFlickable.contentItem); + } + } + \endcode +*/ +QDeclarativeItem *QDeclarativeFlickable::contentItem() { Q_D(QDeclarativeFlickable); - return d->viewport; + return d->contentItem; } QDeclarativeFlickableVisibleArea *QDeclarativeFlickable::visibleArea() @@ -899,12 +917,12 @@ void QDeclarativeFlickablePrivate::clearDelayedPress() void QDeclarativeFlickablePrivate::setRoundedViewportX(qreal x) { - viewport->setX(qRound(x)); + contentItem->setX(qRound(x)); } void QDeclarativeFlickablePrivate::setRoundedViewportY(qreal y) { - viewport->setY(qRound(y)); + contentItem->setY(qRound(y)); } void QDeclarativeFlickable::timerEvent(QTimerEvent *event) @@ -953,20 +971,19 @@ void QDeclarativeFlickable::viewportMoved() { Q_D(QDeclarativeFlickable); - int elapsed = QDeclarativeItemPrivate::restart(d->velocityTime); - if (!elapsed) - return; - qreal prevY = d->lastFlickablePosition.x(); qreal prevX = d->lastFlickablePosition.y(); d->velocityTimeline.clear(); if (d->pressed) { - qreal horizontalVelocity = (prevX - d->hData.move.value()) * 1000 / elapsed; - qreal verticalVelocity = (prevY - d->vData.move.value()) * 1000 / elapsed; - d->velocityTimeline.move(d->hData.smoothVelocity, horizontalVelocity, d->reportedVelocitySmoothing); - d->velocityTimeline.move(d->hData.smoothVelocity, 0, d->reportedVelocitySmoothing); - d->velocityTimeline.move(d->vData.smoothVelocity, verticalVelocity, d->reportedVelocitySmoothing); - d->velocityTimeline.move(d->vData.smoothVelocity, 0, d->reportedVelocitySmoothing); + int elapsed = QDeclarativeItemPrivate::restart(d->velocityTime); + if (elapsed > 0) { + qreal horizontalVelocity = (prevX - d->hData.move.value()) * 1000 / elapsed; + qreal verticalVelocity = (prevY - d->vData.move.value()) * 1000 / elapsed; + d->velocityTimeline.move(d->hData.smoothVelocity, horizontalVelocity, d->reportedVelocitySmoothing); + d->velocityTimeline.move(d->hData.smoothVelocity, 0, d->reportedVelocitySmoothing); + d->velocityTimeline.move(d->vData.smoothVelocity, verticalVelocity, d->reportedVelocitySmoothing); + d->velocityTimeline.move(d->vData.smoothVelocity, 0, d->reportedVelocitySmoothing); + } } else { if (d->timeline.time() > d->vTime) { qreal horizontalVelocity = (prevX - d->hData.move.value()) * 1000 / (d->timeline.time() - d->vTime); @@ -991,13 +1008,13 @@ void QDeclarativeFlickable::geometryChanged(const QRectF &newGeometry, bool changed = false; if (newGeometry.width() != oldGeometry.width()) { if (d->hData.viewSize < 0) { - d->viewport->setWidth(width()); + d->contentItem->setWidth(width()); emit contentWidthChanged(); } } if (newGeometry.height() != oldGeometry.height()) { if (d->vData.viewSize < 0) { - d->viewport->setHeight(height()); + d->contentItem->setHeight(height()); emit contentHeightChanged(); } } @@ -1018,7 +1035,7 @@ void QDeclarativeFlickablePrivate::data_append(QDeclarativeListProperty<QObject> { QDeclarativeItem *i = qobject_cast<QDeclarativeItem *>(o); if (i) - i->setParentItem(static_cast<QDeclarativeFlickablePrivate*>(prop->data)->viewport); + i->setParentItem(static_cast<QDeclarativeFlickablePrivate*>(prop->data)->contentItem); else o->setParent(prop->object); } @@ -1032,7 +1049,7 @@ QDeclarativeListProperty<QObject> QDeclarativeFlickable::flickableData() QDeclarativeListProperty<QGraphicsObject> QDeclarativeFlickable::flickableChildren() { Q_D(QDeclarativeFlickable); - return QGraphicsItemPrivate::get(d->viewport)->childrenList(); + return QGraphicsItemPrivate::get(d->contentItem)->childrenList(); } /*! @@ -1102,9 +1119,9 @@ void QDeclarativeFlickable::setContentWidth(qreal w) return; d->hData.viewSize = w; if (w < 0) - d->viewport->setWidth(width()); + d->contentItem->setWidth(width()); else - d->viewport->setWidth(w); + d->contentItem->setWidth(w); // Make sure that we're entirely in view. if (!d->pressed && !d->movingHorizontally && !d->movingVertically) { int oldDuration = d->fixupDuration; @@ -1129,9 +1146,9 @@ void QDeclarativeFlickable::setContentHeight(qreal h) return; d->vData.viewSize = h; if (h < 0) - d->viewport->setHeight(height()); + d->contentItem->setHeight(height()); else - d->viewport->setHeight(h); + d->contentItem->setHeight(h); // Make sure that we're entirely in view. if (!d->pressed && !d->movingHorizontally && !d->movingVertically) { int oldDuration = d->fixupDuration; diff --git a/src/declarative/graphicsitems/qdeclarativeflickable_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p.h index d40a0dc..47746c6 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable_p.h +++ b/src/declarative/graphicsitems/qdeclarativeflickable_p.h @@ -52,7 +52,7 @@ QT_MODULE(Declarative) class QDeclarativeFlickablePrivate; class QDeclarativeFlickableVisibleArea; -class Q_DECLARATIVE_EXPORT QDeclarativeFlickable : public QDeclarativeItem +class Q_AUTOTEST_EXPORT QDeclarativeFlickable : public QDeclarativeItem { Q_OBJECT @@ -60,6 +60,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeFlickable : public QDeclarativeItem Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight NOTIFY contentHeightChanged) Q_PROPERTY(qreal contentX READ contentX WRITE setContentX NOTIFY contentXChanged) Q_PROPERTY(qreal contentY READ contentY WRITE setContentY NOTIFY contentYChanged) + Q_PROPERTY(QDeclarativeItem *contentItem READ contentItem CONSTANT) Q_PROPERTY(qreal horizontalVelocity READ horizontalVelocity NOTIFY horizontalVelocityChanged) Q_PROPERTY(qreal verticalVelocity READ verticalVelocity NOTIFY verticalVelocityChanged) @@ -111,10 +112,10 @@ public: void setContentHeight(qreal); qreal contentX() const; - void setContentX(qreal pos); + virtual void setContentX(qreal pos); qreal contentY() const; - void setContentY(qreal pos); + virtual void setContentY(qreal pos); bool isMoving() const; bool isMovingHorizontally() const; @@ -143,7 +144,7 @@ public: bool isAtYEnd() const; bool isAtYBeginning() const; - QDeclarativeItem *viewport(); + QDeclarativeItem *contentItem(); enum FlickableDirection { AutoFlickDirection=0x00, HorizontalFlick=0x01, VerticalFlick=0x02, HorizontalAndVerticalFlick=0x03 }; FlickableDirection flickDirection() const; // deprecated diff --git a/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h index 66d2678..b919e1b 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h @@ -125,7 +125,7 @@ public: void itemGeometryChanged(QDeclarativeItem *, const QRectF &, const QRectF &); public: - QDeclarativeItem *viewport; + QDeclarativeItem *contentItem; AxisData hData; AxisData vData; diff --git a/src/declarative/graphicsitems/qdeclarativeflipable_p.h b/src/declarative/graphicsitems/qdeclarativeflipable_p.h index fd0119b..78eaf53 100644 --- a/src/declarative/graphicsitems/qdeclarativeflipable_p.h +++ b/src/declarative/graphicsitems/qdeclarativeflipable_p.h @@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeFlipablePrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeFlipable : public QDeclarativeItem +class Q_AUTOTEST_EXPORT QDeclarativeFlipable : public QDeclarativeItem { Q_OBJECT diff --git a/src/declarative/graphicsitems/qdeclarativefocuspanel_p.h b/src/declarative/graphicsitems/qdeclarativefocuspanel_p.h index d9ca0b0..99bd540 100644 --- a/src/declarative/graphicsitems/qdeclarativefocuspanel_p.h +++ b/src/declarative/graphicsitems/qdeclarativefocuspanel_p.h @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class Q_DECLARATIVE_EXPORT QDeclarativeFocusPanel : public QDeclarativeItem +class Q_AUTOTEST_EXPORT QDeclarativeFocusPanel : public QDeclarativeItem { Q_OBJECT Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged) diff --git a/src/declarative/graphicsitems/qdeclarativefocusscope.cpp b/src/declarative/graphicsitems/qdeclarativefocusscope.cpp index 4bd2a86..e8e6fa2 100644 --- a/src/declarative/graphicsitems/qdeclarativefocusscope.cpp +++ b/src/declarative/graphicsitems/qdeclarativefocusscope.cpp @@ -54,6 +54,8 @@ QT_BEGIN_NAMESPACE Focus scopes assist in keyboard focus handling when building reusable QML components. All the details are covered in the \l {qmlfocus}{keyboard focus documentation}. + + \sa {declarative/keyinteraction/focus}{Keyboard focus example} */ /*! diff --git a/src/declarative/graphicsitems/qdeclarativefocusscope_p.h b/src/declarative/graphicsitems/qdeclarativefocusscope_p.h index c65a07c..363167e 100644 --- a/src/declarative/graphicsitems/qdeclarativefocusscope_p.h +++ b/src/declarative/graphicsitems/qdeclarativefocusscope_p.h @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) //### set component root as focusscope -class Q_DECLARATIVE_EXPORT QDeclarativeFocusScope : public QDeclarativeItem +class Q_AUTOTEST_EXPORT QDeclarativeFocusScope : public QDeclarativeItem { Q_OBJECT Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeItem) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 3792595..cb99129 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -151,9 +151,9 @@ public: void setPosition(qreal pos) { Q_Q(QDeclarativeGridView); if (flow == QDeclarativeGridView::LeftToRight) - q->setContentY(pos); + q->QDeclarativeFlickable::setContentY(pos); else - q->setContentX(pos); + q->QDeclarativeFlickable::setContentX(pos); } int size() const { Q_Q(const QDeclarativeGridView); @@ -421,10 +421,10 @@ FxGridItem *QDeclarativeGridViewPrivate::createItem(int modelIndex) if (model->completePending()) { // complete listItem->item->setZValue(1); - listItem->item->setParentItem(q->viewport()); + listItem->item->setParentItem(q->contentItem()); model->completeItem(); } else { - listItem->item->setParentItem(q->viewport()); + listItem->item->setParentItem(q->contentItem()); } unrequestedItems.remove(listItem->item); } @@ -716,12 +716,12 @@ void QDeclarativeGridViewPrivate::createHighlight() } } else { item = new QDeclarativeItem; - QDeclarative_setParent_noEvent(item, q->viewport()); - item->setParentItem(q->viewport()); + QDeclarative_setParent_noEvent(item, q->contentItem()); + item->setParentItem(q->contentItem()); } if (item) { - QDeclarative_setParent_noEvent(item, q->viewport()); - item->setParentItem(q->viewport()); + QDeclarative_setParent_noEvent(item, q->contentItem()); + item->setParentItem(q->contentItem()); highlight = new FxGridItem(item, q); highlightXAnimator = new QSmoothedAnimation(q); highlightXAnimator->target = QDeclarativeProperty(highlight->item, QLatin1String("x")); @@ -808,8 +808,8 @@ void QDeclarativeGridViewPrivate::updateFooter() delete context; } if (item) { - QDeclarative_setParent_noEvent(item, q->viewport()); - item->setParentItem(q->viewport()); + QDeclarative_setParent_noEvent(item, q->contentItem()); + item->setParentItem(q->contentItem()); item->setZValue(1); QDeclarativeItemPrivate *itemPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(item)); itemPrivate->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry); @@ -854,8 +854,8 @@ void QDeclarativeGridViewPrivate::updateHeader() delete context; } if (item) { - QDeclarative_setParent_noEvent(item, q->viewport()); - item->setParentItem(q->viewport()); + QDeclarative_setParent_noEvent(item, q->contentItem()); + item->setParentItem(q->contentItem()); item->setZValue(1); QDeclarativeItemPrivate *itemPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(item)); itemPrivate->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry); @@ -1099,6 +1099,8 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m is not clipped by another item or the screen, it will be necessary to set \e {clip: true} in order to have the out of view items clipped nicely. + + \sa {declarative/modelviews/gridview}{GridView example} */ QDeclarativeGridView::QDeclarativeGridView(QDeclarativeItem *parent) : QDeclarativeFlickable(*(new QDeclarativeGridViewPrivate), parent) @@ -1742,6 +1744,22 @@ void QDeclarativeGridView::setHeader(QDeclarativeComponent *header) } } +void QDeclarativeGridView::setContentX(qreal pos) +{ + Q_D(QDeclarativeGridView); + // Positioning the view manually should override any current movement state + d->moveReason = QDeclarativeGridViewPrivate::Other; + QDeclarativeFlickable::setContentX(pos); +} + +void QDeclarativeGridView::setContentY(qreal pos) +{ + Q_D(QDeclarativeGridView); + // Positioning the view manually should override any current movement state + d->moveReason = QDeclarativeGridViewPrivate::Other; + QDeclarativeFlickable::setContentY(pos); +} + bool QDeclarativeGridView::event(QEvent *event) { Q_D(QDeclarativeGridView); @@ -1919,6 +1937,8 @@ void QDeclarativeGridView::keyPressEvent(QKeyEvent *event) Move the currentIndex up one item in the view. The current index will wrap if keyNavigationWraps is true and it is currently at the end. + + \bold Note: methods should only be called after the Component has completed. */ void QDeclarativeGridView::moveCurrentIndexUp() { @@ -1942,6 +1962,8 @@ void QDeclarativeGridView::moveCurrentIndexUp() Move the currentIndex down one item in the view. The current index will wrap if keyNavigationWraps is true and it is currently at the end. + + \bold Note: methods should only be called after the Component has completed. */ void QDeclarativeGridView::moveCurrentIndexDown() { @@ -1965,6 +1987,8 @@ void QDeclarativeGridView::moveCurrentIndexDown() Move the currentIndex left one item in the view. The current index will wrap if keyNavigationWraps is true and it is currently at the end. + + \bold Note: methods should only be called after the Component has completed. */ void QDeclarativeGridView::moveCurrentIndexLeft() { @@ -1988,6 +2012,8 @@ void QDeclarativeGridView::moveCurrentIndexLeft() Move the currentIndex right one item in the view. The current index will wrap if keyNavigationWraps is true and it is currently at the end. + + \bold Note: methods should only be called after the Component has completed. */ void QDeclarativeGridView::moveCurrentIndexRight() { @@ -2028,6 +2054,14 @@ void QDeclarativeGridView::moveCurrentIndexRight() at a particular index. This is unreliable since removing items from the start of the view does not cause all other items to be repositioned. The correct way to bring an item into view is with \c positionViewAtIndex. + + \bold Note: methods should only be called after the Component has completed. To position + the view at startup, this method should be called by Component.onCompleted. For + example, to position the view at the end: + + \code + Component.onCompleted: positionViewAtIndex(count - 1, GridView.Beginning) + \endcode */ void QDeclarativeGridView::positionViewAtIndex(int index, int mode) { @@ -2037,6 +2071,8 @@ void QDeclarativeGridView::positionViewAtIndex(int index, int mode) if (mode < Beginning || mode > Contain) return; + if (d->layoutScheduled) + d->layout(); qreal pos = d->position(); FxGridItem *item = d->visibleItem(index); if (!item) { @@ -2079,6 +2115,8 @@ void QDeclarativeGridView::positionViewAtIndex(int index, int mode) pos = qMin(pos, maxExtent); qreal minExtent = d->flow == QDeclarativeGridView::LeftToRight ? -minYExtent() : -minXExtent(); pos = qMax(pos, minExtent); + d->moveReason = QDeclarativeGridViewPrivate::Other; + cancelFlick(); d->setPosition(pos); } d->fixupPosition(); @@ -2093,6 +2131,8 @@ void QDeclarativeGridView::positionViewAtIndex(int index, int mode) If the item is outside the visible area, -1 is returned, regardless of whether an item will exist at that point when scrolled into view. + + \bold Note: methods should only be called after the Component has completed. */ int QDeclarativeGridView::indexAt(int x, int y) const { @@ -2113,10 +2153,16 @@ void QDeclarativeGridView::componentComplete() d->updateGrid(); if (d->isValid()) { refill(); + d->moveReason = QDeclarativeGridViewPrivate::SetIndex; if (d->currentIndex < 0) d->updateCurrent(0); else d->updateCurrent(d->currentIndex); + if (d->highlight) { + d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos()); + d->updateTrackedItem(); + } + d->moveReason = QDeclarativeGridViewPrivate::Other; d->fixupPosition(); } } diff --git a/src/declarative/graphicsitems/qdeclarativegridview_p.h b/src/declarative/graphicsitems/qdeclarativegridview_p.h index 021aad9..d6bbaf3 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview_p.h +++ b/src/declarative/graphicsitems/qdeclarativegridview_p.h @@ -52,7 +52,7 @@ QT_MODULE(Declarative) class QDeclarativeVisualModel; class QDeclarativeGridViewAttached; class QDeclarativeGridViewPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeGridView : public QDeclarativeFlickable +class Q_AUTOTEST_EXPORT QDeclarativeGridView : public QDeclarativeFlickable { Q_OBJECT Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeGridView) @@ -151,6 +151,9 @@ public: QDeclarativeComponent *header() const; void setHeader(QDeclarativeComponent *); + virtual void setContentX(qreal pos); + virtual void setContentY(qreal pos); + enum PositionMode { Beginning, Center, End, Visible, Contain }; Q_INVOKABLE void positionViewAtIndex(int index, int mode); diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index ec08517..ff61302 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -199,6 +199,7 @@ void QDeclarativeImagePrivate::setPixmap(const QPixmap &pixmap) fillMode: Image.PreserveAspectCrop smooth: true source: "qtlogo.png" + clip: true } \endqml @@ -220,6 +221,7 @@ void QDeclarativeImagePrivate::setPixmap(const QPixmap &pixmap) Image { width: 120; height: 120 fillMode: Image.TileVertically + smooth: true source: "qtlogo.png" } \endqml @@ -231,11 +233,14 @@ void QDeclarativeImagePrivate::setPixmap(const QPixmap &pixmap) Image { width: 120; height: 120 fillMode: Image.TileHorizontally + smooth: true source: "qtlogo.png" } \endqml \endtable + + \sa {declarative/imageelements/image}{Image example} */ QDeclarativeImage::FillMode QDeclarativeImage::fillMode() const { diff --git a/src/declarative/graphicsitems/qdeclarativeimage_p.h b/src/declarative/graphicsitems/qdeclarativeimage_p.h index fa5b2a9..a4f4475 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage_p.h +++ b/src/declarative/graphicsitems/qdeclarativeimage_p.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeImagePrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeImage : public QDeclarativeImageBase +class Q_AUTOTEST_EXPORT QDeclarativeImage : public QDeclarativeImageBase { Q_OBJECT Q_ENUMS(FillMode) diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h index 49b1c58..f5896b1 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h +++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h @@ -49,7 +49,7 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE class QDeclarativeImageBasePrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeImageBase : public QDeclarativeItem +class Q_AUTOTEST_EXPORT QDeclarativeImageBase : public QDeclarativeItem { Q_OBJECT Q_ENUMS(Status) diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 336010f..9a17d78 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -149,7 +149,7 @@ QT_BEGIN_NAMESPACE } \endqml - \sa Rotate, Translate + \sa Rotation, Translate */ /*! @@ -196,6 +196,8 @@ QT_BEGIN_NAMESPACE \snippet doc/src/snippets/declarative/rotation.qml 0 \image axisrotation.png + + \sa {declarative/ui-components/dialcontrol}{Dial Control example}, {declarative/toys/clocks}{Clocks example} */ /*! diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 06a3239..e519bd9 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -105,7 +105,7 @@ public: else return (view->orientation() == QDeclarativeListView::Vertical ? item->y() : item->x()); } - int size() const { + qreal size() const { if (section) return (view->orientation() == QDeclarativeListView::Vertical ? item->height()+section->height() : item->width()+section->height()); else @@ -216,9 +216,9 @@ public: void setPosition(qreal pos) { Q_Q(QDeclarativeListView); if (orient == QDeclarativeListView::Vertical) - q->setContentY(pos); + q->QDeclarativeFlickable::setContentY(pos); else - q->setContentX(pos); + q->QDeclarativeFlickable::setContentX(pos); } qreal size() const { Q_Q(const QDeclarativeListView); @@ -421,7 +421,7 @@ public: void itemGeometryChanged(QDeclarativeItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) { Q_Q(QDeclarativeListView); QDeclarativeFlickablePrivate::itemGeometryChanged(item, newGeometry, oldGeometry); - if (item != viewport && (!highlight || item != highlight->item)) { + if (item != contentItem && (!highlight || item != highlight->item)) { if ((orient == QDeclarativeListView::Vertical && newGeometry.height() != oldGeometry.height()) || (orient == QDeclarativeListView::Horizontal && newGeometry.width() != oldGeometry.width())) { scheduleLayout(); @@ -476,7 +476,7 @@ public: QHash<QDeclarativeItem*,int> unrequestedItems; FxListItem *currentItem; QDeclarativeListView::Orientation orient; - int visiblePos; + qreal visiblePos; int visibleIndex; qreal averageSize; int currentIndex; @@ -575,15 +575,19 @@ FxListItem *QDeclarativeListViewPrivate::createItem(int modelIndex) listItem->attached->m_prevSection = item->attached->section(); else listItem->attached->m_prevSection = sectionAt(modelIndex-1); + if (FxListItem *item = visibleItem(modelIndex+1)) + listItem->attached->m_nextSection = item->attached->section(); + else + listItem->attached->m_nextSection = sectionAt(modelIndex+1); } } if (model->completePending()) { // complete listItem->item->setZValue(1); - listItem->item->setParentItem(q->viewport()); + listItem->item->setParentItem(q->contentItem()); model->completeItem(); } else { - listItem->item->setParentItem(q->viewport()); + listItem->item->setParentItem(q->contentItem()); } QDeclarativeItemPrivate *itemPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(item)); itemPrivate->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry); @@ -655,7 +659,7 @@ void QDeclarativeListViewPrivate::refill(qreal from, qreal to, bool doBuffer) bool changed = false; FxListItem *item = 0; - int pos = itemEnd + 1; + qreal pos = itemEnd + 1; while (modelIndex < model->count() && pos <= fillTo) { // qDebug() << "refill: append item" << modelIndex << "pos" << pos; if (!(item = createItem(modelIndex))) @@ -744,8 +748,8 @@ void QDeclarativeListViewPrivate::layout() } updateSections(); if (!visibleItems.isEmpty()) { - int oldEnd = visibleItems.last()->endPosition(); - int pos = visibleItems.first()->endPosition() + spacing + 1; + qreal oldEnd = visibleItems.last()->endPosition(); + qreal pos = visibleItems.first()->endPosition() + spacing + 1; for (int i=1; i < visibleItems.count(); ++i) { FxListItem *item = visibleItems.at(i); item->setPosition(pos); @@ -840,8 +844,8 @@ void QDeclarativeListViewPrivate::createHighlight() item = new QDeclarativeItem; } if (item) { - QDeclarative_setParent_noEvent(item, q->viewport()); - item->setParentItem(q->viewport()); + QDeclarative_setParent_noEvent(item, q->contentItem()); + item->setParentItem(q->contentItem()); highlight = new FxListItem(item, q); if (currentItem && autoHighlight) { if (orient == QDeclarativeListView::Vertical) { @@ -921,8 +925,8 @@ void QDeclarativeListViewPrivate::createSection(FxListItem *listItem) delete nobj; } else { listItem->section->setZValue(1); - QDeclarative_setParent_noEvent(listItem->section, q->viewport()); - listItem->section->setParentItem(q->viewport()); + QDeclarative_setParent_noEvent(listItem->section, q->contentItem()); + listItem->section->setParentItem(q->contentItem()); } } else { delete context; @@ -951,14 +955,26 @@ void QDeclarativeListViewPrivate::updateSections() QString prevSection; if (visibleIndex > 0) prevSection = sectionAt(visibleIndex-1); + QDeclarativeListViewAttached *prevAtt = 0; + int idx = -1; for (int i = 0; i < visibleItems.count(); ++i) { if (visibleItems.at(i)->index != -1) { QDeclarativeListViewAttached *attached = visibleItems.at(i)->attached; attached->setPrevSection(prevSection); + if (prevAtt) + prevAtt->setNextSection(attached->section()); createSection(visibleItems.at(i)); prevSection = attached->section(); + prevAtt = attached; + idx = visibleItems.at(i)->index; } } + if (prevAtt) { + if (idx > 0 && idx < model->count()-1) + prevAtt->setNextSection(sectionAt(idx+1)); + else + prevAtt->setNextSection(QString()); + } } } @@ -1027,7 +1043,7 @@ void QDeclarativeListViewPrivate::updateAverage() qreal sum = 0.0; for (int i = 0; i < visibleItems.count(); ++i) sum += visibleItems.at(i)->size(); - averageSize = sum / visibleItems.count(); + averageSize = qRound(sum / visibleItems.count()); } void QDeclarativeListViewPrivate::updateFooter() @@ -1046,8 +1062,8 @@ void QDeclarativeListViewPrivate::updateFooter() delete context; } if (item) { - QDeclarative_setParent_noEvent(item, q->viewport()); - item->setParentItem(q->viewport()); + QDeclarative_setParent_noEvent(item, q->contentItem()); + item->setParentItem(q->contentItem()); item->setZValue(1); QDeclarativeItemPrivate *itemPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(item)); itemPrivate->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry); @@ -1086,8 +1102,8 @@ void QDeclarativeListViewPrivate::updateHeader() delete context; } if (item) { - QDeclarative_setParent_noEvent(item, q->viewport()); - item->setParentItem(q->viewport()); + QDeclarative_setParent_noEvent(item, q->contentItem()); + item->setParentItem(q->contentItem()); item->setZValue(1); QDeclarativeItemPrivate *itemPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(item)); itemPrivate->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry); @@ -1379,7 +1395,7 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m to set \e {clip: true} in order to have the out of view items clipped nicely. - \sa ListModel, GridView, {declarative/modelviews/listview}{ListView examples} + \sa {Data Models}, GridView, {declarative/modelviews/listview}{ListView examples} */ QDeclarativeListView::QDeclarativeListView(QDeclarativeItem *parent) @@ -1418,7 +1434,7 @@ QDeclarativeListView::~QDeclarativeListView() */ /*! - \qmlattachedproperty string ListView::prevSection + \qmlattachedproperty string ListView::previousSection This attached property holds the section of the previous element. It is attached to each instance of the delegate. @@ -1427,6 +1443,15 @@ QDeclarativeListView::~QDeclarativeListView() */ /*! + \qmlattachedproperty string ListView::nextSection + This attached property holds the section of the next element. + + It is attached to each instance of the delegate. + + The section is evaluated using the \l {ListView::section.property}{section} properties. +*/ + +/*! \qmlattachedproperty string ListView::section This attached property holds the section of this element. @@ -1547,9 +1572,12 @@ void QDeclarativeListView::setModel(const QVariant &model) that is not needed for the normal display of the delegate in a \l Loader which can load additional elements when needed. - Tthe ListView will lay out the items based on the size of the root item + The ListView will lay out the items based on the size of the root item in the delegate. + It is recommended that the delagate's size be a whole number to avoid sub-pixel + alignment of items. + \note Delegates are instantiated as needed and may be destroyed at any time. State should \e never be stored in a delegate. */ @@ -1960,9 +1988,9 @@ void QDeclarativeListView::setCacheBuffer(int b) \c section.delegate holds the delegate component for each section. - Each item in the list has attached properties named \c ListView.section and - \c ListView.prevSection. These may be used to place a section header for - related items. + Each item in the list has attached properties named \c ListView.section, + \c ListView.previousSection and \c ListView.nextSection. These may be + used to place a section header for related items. For example, here is a ListView that displays a list of animals, separated into sections. Each item in the ListView is placed in a different section @@ -2182,6 +2210,22 @@ void QDeclarativeListView::setHeader(QDeclarativeComponent *header) } } +void QDeclarativeListView::setContentX(qreal pos) +{ + Q_D(QDeclarativeListView); + // Positioning the view manually should override any current movement state + d->moveReason = QDeclarativeListViewPrivate::Other; + QDeclarativeFlickable::setContentX(pos); +} + +void QDeclarativeListView::setContentY(qreal pos) +{ + Q_D(QDeclarativeListView); + // Positioning the view manually should override any current movement state + d->moveReason = QDeclarativeListViewPrivate::Other; + QDeclarativeFlickable::setContentY(pos); +} + bool QDeclarativeListView::event(QEvent *event) { Q_D(QDeclarativeListView); @@ -2386,6 +2430,8 @@ void QDeclarativeListView::keyPressEvent(QKeyEvent *event) Increments the current index. The current index will wrap if keyNavigationWraps is true and it is currently at the end. + + \bold Note: methods should only be called after the Component has completed. */ void QDeclarativeListView::incrementCurrentIndex() { @@ -2403,6 +2449,8 @@ void QDeclarativeListView::incrementCurrentIndex() Decrements the current index. The current index will wrap if keyNavigationWraps is true and it is currently at the beginning. + + \bold Note: methods should only be called after the Component has completed. */ void QDeclarativeListView::decrementCurrentIndex() { @@ -2439,6 +2487,14 @@ void QDeclarativeListView::decrementCurrentIndex() of the list does not cause all other items to be repositioned, and because the actual start of the view can vary based on the size of the delegates. The correct way to bring an item into view is with \c positionViewAtIndex. + + \bold Note: methods should only be called after the Component has completed. To position + the view at startup, this method should be called by Component.onCompleted. For + example, to position the view at the end: + + \code + Component.onCompleted: positionViewAtIndex(count - 1, ListView.Beginning) + \endcode */ void QDeclarativeListView::positionViewAtIndex(int index, int mode) { @@ -2448,6 +2504,8 @@ void QDeclarativeListView::positionViewAtIndex(int index, int mode) if (mode < Beginning || mode > Contain) return; + if (d->layoutScheduled) + d->layout(); qreal pos = d->position(); FxListItem *item = d->visibleItem(index); if (!item) { @@ -2491,6 +2549,8 @@ void QDeclarativeListView::positionViewAtIndex(int index, int mode) pos = qMin(pos, maxExtent); qreal minExtent = d->orient == QDeclarativeListView::Vertical ? -minYExtent() : -minXExtent(); pos = qMax(pos, minExtent); + d->moveReason = QDeclarativeListViewPrivate::Other; + cancelFlick(); d->setPosition(pos); } d->fixupPosition(); @@ -2505,6 +2565,8 @@ void QDeclarativeListView::positionViewAtIndex(int index, int mode) If the item is outside the visible area, -1 is returned, regardless of whether an item will exist at that point when scrolled into view. + + \bold Note: methods should only be called after the Component has completed. */ int QDeclarativeListView::indexAt(int x, int y) const { @@ -2529,6 +2591,11 @@ void QDeclarativeListView::componentComplete() d->updateCurrent(0); else d->updateCurrent(d->currentIndex); + if (d->highlight) { + d->highlight->setPosition(d->currentItem->position()); + d->updateTrackedItem(); + } + d->moveReason = QDeclarativeListViewPrivate::Other; d->fixupPosition(); } } @@ -2961,7 +3028,7 @@ void QDeclarativeListView::createdItem(int index, QDeclarativeItem *item) { Q_D(QDeclarativeListView); if (d->requestedIndex != index) { - item->setParentItem(viewport()); + item->setParentItem(contentItem()); d->unrequestedItems.insert(item, index); if (d->orient == QDeclarativeListView::Vertical) item->setY(d->positionAt(index)); diff --git a/src/declarative/graphicsitems/qdeclarativelistview_p.h b/src/declarative/graphicsitems/qdeclarativelistview_p.h index d6e8023..9941040 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview_p.h +++ b/src/declarative/graphicsitems/qdeclarativelistview_p.h @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class Q_DECLARATIVE_EXPORT QDeclarativeViewSection : public QObject +class Q_AUTOTEST_EXPORT QDeclarativeViewSection : public QObject { Q_OBJECT Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY changed) @@ -86,7 +86,7 @@ private: class QDeclarativeVisualModel; class QDeclarativeListViewAttached; class QDeclarativeListViewPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeListView : public QDeclarativeFlickable +class Q_AUTOTEST_EXPORT QDeclarativeListView : public QDeclarativeFlickable { Q_OBJECT Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeListView) @@ -198,6 +198,9 @@ public: QDeclarativeComponent *header() const; void setHeader(QDeclarativeComponent *); + virtual void setContentX(qreal pos); + virtual void setContentY(qreal pos); + static QDeclarativeListViewAttached *qmlAttachedProperties(QObject *); enum PositionMode { Beginning, Center, End, Visible, Contain }; @@ -276,7 +279,7 @@ public: } } - Q_PROPERTY(QString prevSection READ prevSection NOTIFY prevSectionChanged) + Q_PROPERTY(QString previousSection READ prevSection NOTIFY prevSectionChanged) QString prevSection() const { return m_prevSection; } void setPrevSection(const QString §) { if (m_prevSection != sect) { @@ -285,6 +288,15 @@ public: } } + Q_PROPERTY(QString nextSection READ nextSection NOTIFY nextSectionChanged) + QString nextSection() const { return m_nextSection; } + void setNextSection(const QString §) { + if (m_nextSection != sect) { + m_nextSection = sect; + emit nextSectionChanged(); + } + } + Q_PROPERTY(QString section READ section NOTIFY sectionChanged) QString section() const { return m_section; } void setSection(const QString §) { @@ -310,6 +322,7 @@ Q_SIGNALS: void currentItemChanged(); void sectionChanged(); void prevSectionChanged(); + void nextSectionChanged(); void delayRemoveChanged(); void add(); void remove(); @@ -318,6 +331,7 @@ public: QDeclarativeListView *m_view; mutable QString m_section; QString m_prevSection; + QString m_nextSection; bool m_isCurrent : 1; bool m_delayRemove : 1; }; diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp index 25b1119..c8c9e44 100644 --- a/src/declarative/graphicsitems/qdeclarativeloader.cpp +++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp @@ -174,7 +174,7 @@ void QDeclarativeLoaderPrivate::initResize() QDeclarativeLoader::QDeclarativeLoader(QDeclarativeItem *parent) : QDeclarativeItem(*(new QDeclarativeLoaderPrivate), parent) { - Q_D(QDeclarativeItem); + Q_D(QDeclarativeLoader); d->flags |= QGraphicsItem::ItemIsFocusScope; } @@ -183,6 +183,14 @@ QDeclarativeLoader::QDeclarativeLoader(QDeclarativeItem *parent) */ QDeclarativeLoader::~QDeclarativeLoader() { + Q_D(QDeclarativeLoader); + if (d->item) { + if (QDeclarativeItem *qmlItem = qobject_cast<QDeclarativeItem*>(d->item)) { + QDeclarativeItemPrivate *p = + static_cast<QDeclarativeItemPrivate *>(QGraphicsItemPrivate::get(qmlItem)); + p->removeItemChangeListener(d, QDeclarativeItemPrivate::Geometry); + } + } } /*! diff --git a/src/declarative/graphicsitems/qdeclarativeloader_p.h b/src/declarative/graphicsitems/qdeclarativeloader_p.h index ec7ffe9..d63eaf7 100644 --- a/src/declarative/graphicsitems/qdeclarativeloader_p.h +++ b/src/declarative/graphicsitems/qdeclarativeloader_p.h @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeLoaderPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeLoader : public QDeclarativeItem +class Q_AUTOTEST_EXPORT QDeclarativeLoader : public QDeclarativeItem { Q_OBJECT Q_ENUMS(Status) diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index 0bed41b..caf251d 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -192,7 +192,7 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate() MouseArea is an invisible item: it is never painted. - \sa MouseEvent + \sa MouseEvent, {declarative/touchinteraction/mousearea}{MouseArea example} */ /*! diff --git a/src/declarative/graphicsitems/qdeclarativemousearea_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p.h index df77ac6..4fe3fcb 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea_p.h +++ b/src/declarative/graphicsitems/qdeclarativemousearea_p.h @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class Q_DECLARATIVE_EXPORT QDeclarativeDrag : public QObject +class Q_AUTOTEST_EXPORT QDeclarativeDrag : public QObject { Q_OBJECT @@ -110,7 +110,7 @@ private: class QDeclarativeMouseEvent; class QDeclarativeMouseAreaPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeMouseArea : public QDeclarativeItem +class Q_AUTOTEST_EXPORT QDeclarativeMouseArea : public QDeclarativeItem { Q_OBJECT diff --git a/src/declarative/graphicsitems/qdeclarativepainteditem.cpp b/src/declarative/graphicsitems/qdeclarativepainteditem.cpp index 13d1b61..3b9b8df 100644 --- a/src/declarative/graphicsitems/qdeclarativepainteditem.cpp +++ b/src/declarative/graphicsitems/qdeclarativepainteditem.cpp @@ -151,6 +151,7 @@ void QDeclarativePaintedItem::setContentsSize(const QSize &size) { Q_D(QDeclarativePaintedItem); if (d->contentsSize == size) return; + prepareGeometryChange(); d->contentsSize = size; clearCache(); update(); @@ -247,8 +248,7 @@ QRectF QDeclarativePaintedItem::boundingRect() const void QDeclarativePaintedItem::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) { Q_D(QDeclarativePaintedItem); - const QRect content(0,0,qCeil(d->contentsSize.width()*d->contentsScale), - qCeil(d->contentsSize.height()*d->contentsScale)); + const QRect content = boundingRect().toRect(); if (content.width() <= 0 || content.height() <= 0) return; diff --git a/src/declarative/graphicsitems/qdeclarativepainteditem_p.h b/src/declarative/graphicsitems/qdeclarativepainteditem_p.h index 86f065a..8142986 100644 --- a/src/declarative/graphicsitems/qdeclarativepainteditem_p.h +++ b/src/declarative/graphicsitems/qdeclarativepainteditem_p.h @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativePaintedItemPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativePaintedItem : public QDeclarativeItem +class Q_AUTOTEST_EXPORT QDeclarativePaintedItem : public QDeclarativeItem { Q_OBJECT diff --git a/src/declarative/graphicsitems/qdeclarativepath_p.h b/src/declarative/graphicsitems/qdeclarativepath_p.h index dad43e6..001bcdf 100644 --- a/src/declarative/graphicsitems/qdeclarativepath_p.h +++ b/src/declarative/graphicsitems/qdeclarativepath_p.h @@ -54,7 +54,7 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class Q_DECLARATIVE_EXPORT QDeclarativePathElement : public QObject +class Q_AUTOTEST_EXPORT QDeclarativePathElement : public QObject { Q_OBJECT public: @@ -63,7 +63,7 @@ Q_SIGNALS: void changed(); }; -class Q_DECLARATIVE_EXPORT QDeclarativePathAttribute : public QDeclarativePathElement +class Q_AUTOTEST_EXPORT QDeclarativePathAttribute : public QDeclarativePathElement { Q_OBJECT @@ -87,7 +87,7 @@ private: qreal _value; }; -class Q_DECLARATIVE_EXPORT QDeclarativeCurve : public QDeclarativePathElement +class Q_AUTOTEST_EXPORT QDeclarativeCurve : public QDeclarativePathElement { Q_OBJECT @@ -109,7 +109,7 @@ private: qreal _y; }; -class Q_DECLARATIVE_EXPORT QDeclarativePathLine : public QDeclarativeCurve +class Q_AUTOTEST_EXPORT QDeclarativePathLine : public QDeclarativeCurve { Q_OBJECT public: @@ -118,7 +118,7 @@ public: void addToPath(QPainterPath &path); }; -class Q_DECLARATIVE_EXPORT QDeclarativePathQuad : public QDeclarativeCurve +class Q_AUTOTEST_EXPORT QDeclarativePathQuad : public QDeclarativeCurve { Q_OBJECT @@ -140,7 +140,7 @@ private: qreal _controlY; }; -class Q_DECLARATIVE_EXPORT QDeclarativePathCubic : public QDeclarativeCurve +class Q_AUTOTEST_EXPORT QDeclarativePathCubic : public QDeclarativeCurve { Q_OBJECT @@ -172,7 +172,7 @@ private: int _control2Y; }; -class Q_DECLARATIVE_EXPORT QDeclarativePathPercent : public QDeclarativePathElement +class Q_AUTOTEST_EXPORT QDeclarativePathPercent : public QDeclarativePathElement { Q_OBJECT Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY changed) @@ -187,7 +187,7 @@ private: }; class QDeclarativePathPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativePath : public QObject, public QDeclarativeParserStatus +class Q_AUTOTEST_EXPORT QDeclarativePath : public QObject, public QDeclarativeParserStatus { Q_OBJECT diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index 0c2d249..0e980b3 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -552,6 +552,8 @@ void QDeclarativePathView::setCurrentIndex(int idx) \qmlmethod PathView::incrementCurrentIndex() Increments the current index. + + \bold Note: methods should only be called after the Component has completed. */ void QDeclarativePathView::incrementCurrentIndex() { @@ -563,6 +565,8 @@ void QDeclarativePathView::incrementCurrentIndex() \qmlmethod PathView::decrementCurrentIndex() Decrements the current index. + + \bold Note: methods should only be called after the Component has completed. */ void QDeclarativePathView::decrementCurrentIndex() { diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p.h index 8a6f53f..d2980c6 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview_p.h +++ b/src/declarative/graphicsitems/qdeclarativepathview_p.h @@ -53,7 +53,7 @@ QT_MODULE(Declarative) class QDeclarativePathViewPrivate; class QDeclarativePathViewAttached; -class Q_DECLARATIVE_EXPORT QDeclarativePathView : public QDeclarativeItem +class Q_AUTOTEST_EXPORT QDeclarativePathView : public QDeclarativeItem { Q_OBJECT diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp index b9231a1..179f13d 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp +++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp @@ -1027,13 +1027,13 @@ void QDeclarativeFlow::doPositioning(QSizeF *contentSize) continue; if (d->flow == LeftToRight) { - if (hoffset && hoffset + child.item->width() > width()) { + if (widthValid() && hoffset && hoffset + child.item->width() > width()) { hoffset = 0; voffset += linemax + spacing(); linemax = 0; } } else { - if (voffset && voffset + child.item->height() > height()) { + if (heightValid() && voffset && voffset + child.item->height() > height()) { voffset = 0; hoffset += linemax + spacing(); linemax = 0; diff --git a/src/declarative/graphicsitems/qdeclarativepositioners_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p.h index 787dcd3..c03e518 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners_p.h +++ b/src/declarative/graphicsitems/qdeclarativepositioners_p.h @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeBasePositionerPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeBasePositioner : public QDeclarativeItem +class Q_AUTOTEST_EXPORT QDeclarativeBasePositioner : public QDeclarativeItem { Q_OBJECT @@ -112,7 +112,7 @@ private: Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QDeclarativeBasePositioner) }; -class Q_DECLARATIVE_EXPORT QDeclarativeColumn : public QDeclarativeBasePositioner +class Q_AUTOTEST_EXPORT QDeclarativeColumn : public QDeclarativeBasePositioner { Q_OBJECT public: @@ -124,7 +124,7 @@ private: Q_DISABLE_COPY(QDeclarativeColumn) }; -class Q_DECLARATIVE_EXPORT QDeclarativeRow: public QDeclarativeBasePositioner +class Q_AUTOTEST_EXPORT QDeclarativeRow: public QDeclarativeBasePositioner { Q_OBJECT public: @@ -136,7 +136,7 @@ private: Q_DISABLE_COPY(QDeclarativeRow) }; -class Q_DECLARATIVE_EXPORT QDeclarativeGrid : public QDeclarativeBasePositioner +class Q_AUTOTEST_EXPORT QDeclarativeGrid : public QDeclarativeBasePositioner { Q_OBJECT Q_PROPERTY(int rows READ rows WRITE setRows NOTIFY rowsChanged) @@ -174,7 +174,7 @@ private: }; class QDeclarativeFlowPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeFlow: public QDeclarativeBasePositioner +class Q_AUTOTEST_EXPORT QDeclarativeFlow: public QDeclarativeBasePositioner { Q_OBJECT Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged) diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp index 2756877..c49be46 100644 --- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp +++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp @@ -446,6 +446,7 @@ void QDeclarativeRectangle::drawRect(QPainter &p) p.setRenderHint(QPainter::Antialiasing); if (d->pen && d->pen->isValid()) { QPen pn(QColor(d->pen->color()), d->pen->width()); + pn.setJoinStyle(Qt::MiterJoin); p.setPen(pn); } else { p.setPen(Qt::NoPen); diff --git a/src/declarative/graphicsitems/qdeclarativerectangle_p.h b/src/declarative/graphicsitems/qdeclarativerectangle_p.h index 7272962..ecc3fbf 100644 --- a/src/declarative/graphicsitems/qdeclarativerectangle_p.h +++ b/src/declarative/graphicsitems/qdeclarativerectangle_p.h @@ -68,7 +68,7 @@ public: QColor color() const { return _color; } void setColor(const QColor &c); - bool isValid() { return _valid; }; + bool isValid() { return _valid; } Q_SIGNALS: void penChanged(); @@ -79,7 +79,7 @@ private: bool _valid; }; -class Q_DECLARATIVE_EXPORT QDeclarativeGradientStop : public QObject +class Q_AUTOTEST_EXPORT QDeclarativeGradientStop : public QObject { Q_OBJECT @@ -103,7 +103,7 @@ private: QColor m_color; }; -class Q_DECLARATIVE_EXPORT QDeclarativeGradient : public QObject +class Q_AUTOTEST_EXPORT QDeclarativeGradient : public QObject { Q_OBJECT diff --git a/src/declarative/graphicsitems/qdeclarativerepeater_p.h b/src/declarative/graphicsitems/qdeclarativerepeater_p.h index db46699..ff58fa0 100644 --- a/src/declarative/graphicsitems/qdeclarativerepeater_p.h +++ b/src/declarative/graphicsitems/qdeclarativerepeater_p.h @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeRepeaterPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeRepeater : public QDeclarativeItem +class Q_AUTOTEST_EXPORT QDeclarativeRepeater : public QDeclarativeItem { Q_OBJECT diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index c2e0d67..0bd9a53 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -136,6 +136,8 @@ QSet<QUrl> QTextDocumentWithImageResources::errors; HTML img tags that load remote images, the text is reloaded. Text provides read-only text. For editable text, see \l TextEdit. + + \sa {declarative/text/fonts}{Fonts example} */ /*! @@ -225,12 +227,6 @@ QDeclarativeTextPrivate::~QDeclarativeTextPrivate() */ /*! - \qmlproperty bool Text::font.outline - - Sets whether the font has an outline style. -*/ - -/*! \qmlproperty bool Text::font.strikeout Sets whether the font has a strikeout style. @@ -441,6 +437,8 @@ void QDeclarativeText::setStyleColor(const QColor &color) \qml Text { font.pointSize: 18; text: "hello"; style: Text.Raised; styleColor: "gray" } \endqml + + \sa style */ QColor QDeclarativeText::styleColor() const { @@ -663,6 +661,71 @@ void QDeclarativeText::setElideMode(QDeclarativeText::TextElideMode mode) emit elideModeChanged(d->elideMode); } +QRectF QDeclarativeText::boundingRect() const +{ + Q_D(const QDeclarativeText); + + int w = width(); + int h = height(); + + int x = 0; + int y = 0; + + if (d->cache || d->style != Normal) { + switch (d->hAlign) { + case AlignLeft: + x = 0; + break; + case AlignRight: + x = w - d->imgCache.width(); + break; + case AlignHCenter: + x = (w - d->imgCache.width()) / 2; + break; + } + + switch (d->vAlign) { + case AlignTop: + y = 0; + break; + case AlignBottom: + y = h - d->imgCache.height(); + break; + case AlignVCenter: + y = (h - d->imgCache.height()) / 2; + break; + } + + return QRectF(x,y,d->imgCache.width(),d->imgCache.height()); + } else { + switch (d->hAlign) { + case AlignLeft: + x = 0; + break; + case AlignRight: + x = w - d->cachedLayoutSize.width(); + break; + case AlignHCenter: + x = (w - d->cachedLayoutSize.width()) / 2; + break; + } + + switch (d->vAlign) { + case AlignTop: + y = 0; + break; + case AlignBottom: + y = h - d->cachedLayoutSize.height(); + break; + case AlignVCenter: + y = (h - d->cachedLayoutSize.height()) / 2; + break; + } + + return QRectF(x,y,d->cachedLayoutSize.width(),d->cachedLayoutSize.height()); + } +} + void QDeclarativeText::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { @@ -713,6 +776,7 @@ void QDeclarativeTextPrivate::updateLayout() } } + void QDeclarativeTextPrivate::updateSize() { Q_Q(QDeclarativeText); @@ -730,7 +794,10 @@ void QDeclarativeTextPrivate::updateSize() //setup instance of QTextLayout for all cases other than richtext if (!richText) { size = setupTextLayout(&layout); - cachedLayoutSize = size; + if (cachedLayoutSize != size) { + q->prepareGeometryChange(); + cachedLayoutSize = size; + } dy -= size.height(); } else { singleline = false; // richtext can't elide or be optimized for single-line case @@ -744,7 +811,13 @@ void QDeclarativeTextPrivate::updateSize() else doc->setTextWidth(doc->idealWidth()); // ### Text does not align if width is not set (QTextDoc bug) dy -= (int)doc->size().height(); - cachedLayoutSize = doc->size().toSize(); + q->prepareGeometryChange(); + QSize dsize = doc->size().toSize(); + if (dsize != cachedLayoutSize) { + q->prepareGeometryChange(); + cachedLayoutSize = dsize; + } + size = QSize(int(doc->idealWidth()),dsize.height()); } int yoff = 0; @@ -757,8 +830,8 @@ void QDeclarativeTextPrivate::updateSize() q->setBaselineOffset(fm.ascent() + yoff); //### need to comfirm cost of always setting these for richText - q->setImplicitWidth(richText ? (int)doc->idealWidth() : size.width()); - q->setImplicitHeight(richText ? (int)doc->size().height() : size.height()); + q->setImplicitWidth(size.width()); + q->setImplicitHeight(size.height()); emit q->paintedSizeChanged(); } else { dirty = true; @@ -813,6 +886,8 @@ void QDeclarativeTextPrivate::drawOutline() ppm.drawPixmap(pos, imgCache); ppm.end(); + if (imgCache.size() != img.size()) + q_func()->prepareGeometryChange(); imgCache = img; } @@ -831,6 +906,8 @@ void QDeclarativeTextPrivate::drawOutline(int yOffset) ppm.drawPixmap(pos, imgCache); ppm.end(); + if (imgCache.size() != img.size()) + q_func()->prepareGeometryChange(); imgCache = img; } @@ -955,18 +1032,21 @@ void QDeclarativeTextPrivate::checkImgCache() return; bool empty = text.isEmpty(); + QPixmap newImgCache; if (empty) { - imgCache = QPixmap(); imgStyleCache = QPixmap(); } else if (richText) { - imgCache = richTextImage(false); + newImgCache = richTextImage(false); if (style != QDeclarativeText::Normal) imgStyleCache = richTextImage(true); //### should use styleColor } else { - imgCache = wrappedTextImage(false); + newImgCache = wrappedTextImage(false); if (style != QDeclarativeText::Normal) imgStyleCache = wrappedTextImage(true); //### should use styleColor } + if (imgCache.size() != newImgCache.size()) + q_func()->prepareGeometryChange(); + imgCache = newImgCache; if (!empty) switch (style) { case QDeclarativeText::Outline: @@ -1031,35 +1111,7 @@ void QDeclarativeText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWid if (d->smooth) p->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, d->smooth); - int w = width(); - int h = height(); - - int x = 0; - int y = 0; - - switch (d->hAlign) { - case AlignLeft: - x = 0; - break; - case AlignRight: - x = w - d->imgCache.width(); - break; - case AlignHCenter: - x = (w - d->imgCache.width()) / 2; - break; - } - - switch (d->vAlign) { - case AlignTop: - y = 0; - break; - case AlignBottom: - y = h - d->imgCache.height(); - break; - case AlignVCenter: - y = (h - d->imgCache.height()) / 2; - break; - } + QRect br = boundingRect().toRect(); bool needClip = clip() && (d->imgCache.width() > width() || d->imgCache.height() > height()); @@ -1068,7 +1120,7 @@ void QDeclarativeText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWid p->save(); p->setClipRect(boundingRect(), Qt::IntersectClip); } - p->drawPixmap(x, y, d->imgCache); + p->drawPixmap(br.x(), br.y(), d->imgCache); if (needClip) p->restore(); @@ -1077,20 +1129,8 @@ void QDeclarativeText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWid p->setRenderHint(QPainter::SmoothPixmapTransform, oldSmooth); } } else { - int h = height(); - int y = 0; + qreal y = boundingRect().y(); - switch (d->vAlign) { - case AlignTop: - y = 0; - break; - case AlignBottom: - y = h - d->cachedLayoutSize.height(); - break; - case AlignVCenter: - y = (h - d->cachedLayoutSize.height()) / 2; - break; - } bool needClip = !clip() && (d->cachedLayoutSize.width() > width() || d->cachedLayoutSize.height() > height()); diff --git a/src/declarative/graphicsitems/qdeclarativetext_p.h b/src/declarative/graphicsitems/qdeclarativetext_p.h index db21140..cd97df3 100644 --- a/src/declarative/graphicsitems/qdeclarativetext_p.h +++ b/src/declarative/graphicsitems/qdeclarativetext_p.h @@ -143,6 +143,8 @@ public: qreal paintedWidth() const; qreal paintedHeight() const; + QRectF boundingRect() const; + Q_SIGNALS: void textChanged(const QString &text); void linkActivated(const QString &link); diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 3106daf..c6566ff 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -99,7 +99,7 @@ TextEdit { You can translate between cursor positions (characters from the start of the document) and pixel points using positionAt() and positionToRectangle(). - \sa Text, TextInput + \sa Text, TextInput, {declarative/text/textselection}{Text Selection example} */ /*! @@ -186,12 +186,6 @@ QString QDeclarativeTextEdit::text() const */ /*! - \qmlproperty bool TextEdit::font.outline - - Sets whether the font has an outline style. -*/ - -/*! \qmlproperty bool TextEdit::font.strikeout Sets whether the font has a strikeout style. @@ -1231,8 +1225,13 @@ void QDeclarativeTextEdit::updateImgCache(const QRectF &rf) r = QRect(0,0,INT_MAX,INT_MAX); } else { r = rf.toRect(); - if (r != QRect(0,0,INT_MAX,INT_MAX)) // Don't translate "everything" + if (r.height() > INT_MAX/2) { + // Take care of overflow when translating "everything" + r.setTop(r.y() + d->yoff); + r.setBottom(INT_MAX/2); + } else { r = r.translated(0,d->yoff); + } } dirtyCache(r); emit update(); @@ -1284,6 +1283,7 @@ void QDeclarativeTextEditPrivate::init() void QDeclarativeTextEdit::q_textChanged() { updateSize(); + updateMicroFocus(); emit textChanged(text()); } @@ -1325,8 +1325,17 @@ void QDeclarativeTextEdit::updateSelectionMarkers() d->lastSelectionEnd = d->control->textCursor().selectionEnd(); emit selectionEndChanged(); } + updateMicroFocus(); } +QRectF QDeclarativeTextEdit::boundingRect() const +{ + Q_D(const QDeclarativeTextEdit); + QRectF r = QDeclarativePaintedItem::boundingRect(); + return r.translated(0,d->yoff); +} + + //### we should perhaps be a bit smarter here -- depending on what has changed, we shouldn't // need to do all the calculations each time void QDeclarativeTextEdit::updateSize() @@ -1341,13 +1350,20 @@ void QDeclarativeTextEdit::updateSize() d->document->setTextWidth(width()); dy -= (int)d->document->size().height(); + int nyoff; if (heightValid()) { if (d->vAlign == AlignBottom) - d->yoff = dy; + nyoff = dy; else if (d->vAlign == AlignVCenter) - d->yoff = dy/2; + nyoff = dy/2; + else + nyoff = 0; } else { - d->yoff = 0; + nyoff = 0; + } + if (nyoff != d->yoff) { + prepareGeometryChange(); + d->yoff = nyoff; } setBaselineOffset(fm.ascent() + d->yoff + d->textMargin); diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h index d08f607..279af78 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h @@ -58,7 +58,7 @@ QT_MODULE(Declarative) class QDeclarativeTextEditPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeTextEdit : public QDeclarativePaintedItem +class Q_AUTOTEST_EXPORT QDeclarativeTextEdit : public QDeclarativePaintedItem { Q_OBJECT Q_ENUMS(VAlignment) @@ -195,6 +195,8 @@ public: Q_INVOKABLE int positionAt(int x, int y) const; Q_INVOKABLE void moveCursorSelection(int pos); + QRectF boundingRect() const; + Q_SIGNALS: void textChanged(const QString &); void paintedSizeChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index ec14c78..ed999a2 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -69,7 +69,7 @@ QT_BEGIN_NAMESPACE On Mac OS X, the Up/Down key bindings for Home/End are explicitly disabled. If you want such bindings (on any platform), you will need to construct them in QML. - \sa TextEdit, Text + \sa TextEdit, Text, {declarative/text/textselection}{Text Selection example} */ QDeclarativeTextInput::QDeclarativeTextInput(QDeclarativeItem* parent) : QDeclarativePaintedItem(*(new QDeclarativeTextInputPrivate), parent) @@ -152,12 +152,6 @@ void QDeclarativeTextInput::setText(const QString &s) */ /*! - \qmlproperty bool TextInput::font.outline - - Sets whether the font has an outline style. -*/ - -/*! \qmlproperty bool TextInput::font.strikeout Sets whether the font has a strikeout style. @@ -1398,18 +1392,11 @@ void QDeclarativeTextInputPrivate::init() q->connect(control, SIGNAL(selectionChanged()), q, SLOT(selectionChanged())); q->connect(control, SIGNAL(textChanged(const QString &)), - q, SIGNAL(displayTextChanged(const QString &))); - q->connect(control, SIGNAL(textChanged(const QString &)), q, SLOT(q_textChanged())); q->connect(control, SIGNAL(accepted()), q, SIGNAL(accepted())); q->connect(control, SIGNAL(updateNeeded(QRect)), q, SLOT(updateRect(QRect))); - q->connect(control, SIGNAL(cursorPositionChanged(int,int)), - q, SLOT(updateRect()));//TODO: Only update rect between pos's - q->connect(control, SIGNAL(selectionChanged()), - q, SLOT(updateRect()));//TODO: Only update rect in selection - //Note that above TODOs probably aren't that big a savings q->updateSize(); oldValidity = control->hasAcceptableInput(); lastSelectionStart = 0; @@ -1422,6 +1409,8 @@ void QDeclarativeTextInputPrivate::init() void QDeclarativeTextInput::cursorPosChanged() { Q_D(QDeclarativeTextInput); + updateRect();//TODO: Only update rect between pos's + updateMicroFocus(); emit cursorPositionChanged(); if(!d->control->hasSelectedText()){ @@ -1439,6 +1428,7 @@ void QDeclarativeTextInput::cursorPosChanged() void QDeclarativeTextInput::selectionChanged() { Q_D(QDeclarativeTextInput); + updateRect();//TODO: Only update rect in selection emit selectedTextChanged(); if(d->lastSelectionStart != d->control->selectionStart()){ @@ -1460,7 +1450,9 @@ void QDeclarativeTextInput::q_textChanged() Q_D(QDeclarativeTextInput); d->updateHorizontalScroll(); updateSize(); + updateMicroFocus(); emit textChanged(); + emit displayTextChanged(); if(hasAcceptableInput() != d->oldValidity){ d->oldValidity = hasAcceptableInput(); emit acceptableInputChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h index 6934da4..bacd041 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h @@ -56,7 +56,7 @@ QT_MODULE(Declarative) class QDeclarativeTextInputPrivate; class QValidator; -class Q_DECLARATIVE_EXPORT QDeclarativeTextInput : public QDeclarativePaintedItem +class Q_AUTOTEST_EXPORT QDeclarativeTextInput : public QDeclarativePaintedItem { Q_OBJECT Q_ENUMS(HAlignment) @@ -208,7 +208,7 @@ Q_SIGNALS: void inputMaskChanged(const QString &inputMask); void echoModeChanged(EchoMode echoMode); void passwordCharacterChanged(); - void displayTextChanged(const QString &text); + void displayTextChanged(); void focusOnPressChanged(bool focusOnPress); void autoScrollChanged(bool autoScroll); void selectByMouseChanged(bool selectByMouse); diff --git a/src/declarative/graphicsitems/qdeclarativetranslate_p.h b/src/declarative/graphicsitems/qdeclarativetranslate_p.h index 939692b..0207dce 100644 --- a/src/declarative/graphicsitems/qdeclarativetranslate_p.h +++ b/src/declarative/graphicsitems/qdeclarativetranslate_p.h @@ -52,7 +52,7 @@ QT_MODULE(Declarative) class QDeclarativeTranslatePrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeTranslate : public QGraphicsTransform +class Q_AUTOTEST_EXPORT QDeclarativeTranslate : public QGraphicsTransform { Q_OBJECT diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 5092349..786d6f9 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -283,7 +283,7 @@ public: if (m_roles.count() == 1) m_roleNames.insert("modelData", m_roles.at(0)); if (m_roles.count()) - m_roleNames.insert("hasModelChildren", 0); + m_roleNames.insert("hasModelChildren", -1); } else if (m_listAccessor) { m_roleNames.insert("modelData", 0); if (m_listAccessor->type() == QDeclarativeListAccessor::Instance) { @@ -818,6 +818,12 @@ void QDeclarativeVisualDataModel::setDelegate(QDeclarativeComponent *delegate) \c view.qml: \snippet doc/src/snippets/declarative/visualdatamodel_rootindex/view.qml 0 + If the \l model is a QAbstractItemModel subclass, the delegate can also + reference a \c hasModelChildren property (optionally qualified by a + \e model. prefix) that indicates whether the delegate's model item has + any child nodes. + + \sa modelIndex(), parentModelIndex() */ QVariant QDeclarativeVisualDataModel::rootIndex() const diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h b/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h index 079c9e6..d5c0de2 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h @@ -60,7 +60,7 @@ class QDeclarativeComponent; class QDeclarativePackage; class QDeclarativeVisualDataModelPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeVisualModel : public QObject +class Q_AUTOTEST_EXPORT QDeclarativeVisualModel : public QObject { Q_OBJECT @@ -103,7 +103,7 @@ private: class QDeclarativeVisualItemModelAttached; class QDeclarativeVisualItemModelPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeVisualItemModel : public QDeclarativeVisualModel +class Q_AUTOTEST_EXPORT QDeclarativeVisualItemModel : public QDeclarativeVisualModel { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeVisualItemModel) @@ -138,7 +138,7 @@ private: }; -class Q_DECLARATIVE_EXPORT QDeclarativeVisualDataModel : public QDeclarativeVisualModel +class Q_AUTOTEST_EXPORT QDeclarativeVisualDataModel : public QDeclarativeVisualModel { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeVisualDataModel) diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 80a1093..623e3df 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -815,6 +815,10 @@ bool QDeclarativeCompiler::buildObject(Object *obj, const BindingContext &ctxt) } } + QDeclarativeCustomParser *cp = 0; + if (isCustomParser) + cp = output->types.at(obj->type).type->customParser(); + // Build all explicit properties specified foreach(Property *prop, obj->properties) { @@ -825,7 +829,9 @@ bool QDeclarativeCompiler::buildObject(Object *obj, const BindingContext &ctxt) bool canDefer = false; if (isCustomParser) { - if (doesPropertyExist(prop, obj)) { + if (doesPropertyExist(prop, obj) && + (!(cp->flags() & QDeclarativeCustomParser::AcceptsAttachedProperties) || + !isAttachedPropertyName(prop->name))) { int ids = compileState.ids.count(); COMPILE_CHECK(buildProperty(prop, obj, objCtxt)); canDefer = ids == compileState.ids.count(); @@ -876,8 +882,7 @@ bool QDeclarativeCompiler::buildObject(Object *obj, const BindingContext &ctxt) defaultProperty->release(); // Compile custom parser parts - if (isCustomParser/* && !customProps.isEmpty()*/) { - QDeclarativeCustomParser *cp = output->types.at(obj->type).type->customParser(); + if (isCustomParser && !customProps.isEmpty()) { cp->clearErrors(); cp->compiler = this; cp->object = obj; @@ -1356,7 +1361,7 @@ bool QDeclarativeCompiler::buildSignal(QDeclarativeParser::Property *prop, QDecl Returns true if (value) property \a prop exists on obj, false otherwise. */ bool QDeclarativeCompiler::doesPropertyExist(QDeclarativeParser::Property *prop, - QDeclarativeParser::Object *obj) + QDeclarativeParser::Object *obj) { if(isAttachedPropertyName(prop->name) || prop->name == "id") return true; @@ -2176,6 +2181,18 @@ int QDeclarativeCompiler::evaluateEnum(const QByteArray& script) const return -1; } +const QMetaObject *QDeclarativeCompiler::resolveType(const QByteArray& name) const +{ + QDeclarativeType *qmltype = 0; + if (!enginePrivate->importDatabase.resolveType(unit->imports, name, &qmltype, + 0, 0, 0, 0)) + return 0; + if (!qmltype) + return 0; + return qmltype->metaObject(); +} + + // Ensures that the dynamic meta specification on obj is valid bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj) { @@ -2199,6 +2216,10 @@ bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj) if (QString::fromUtf8(prop.name).at(0).isUpper()) COMPILE_EXCEPTION(&prop, tr("Property names cannot begin with an upper case letter")); + + if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(prop.name)) + COMPILE_EXCEPTION(&prop, tr("Illegal property name")); + propNames.insert(prop.name); } @@ -2208,6 +2229,8 @@ bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj) COMPILE_EXCEPTION(obj, tr("Duplicate signal name")); if (QString::fromUtf8(name).at(0).isUpper()) COMPILE_EXCEPTION(obj, tr("Signal names cannot begin with an upper case letter")); + if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(name)) + COMPILE_EXCEPTION(obj, tr("Illegal signal name")); methodNames.insert(name); } for (int ii = 0; ii < obj->dynamicSlots.count(); ++ii) { @@ -2216,6 +2239,8 @@ bool QDeclarativeCompiler::checkDynamicMeta(QDeclarativeParser::Object *obj) COMPILE_EXCEPTION(obj, tr("Duplicate method name")); if (QString::fromUtf8(name).at(0).isUpper()) COMPILE_EXCEPTION(obj, tr("Method names cannot begin with an upper case letter")); + if (QDeclarativeEnginePrivate::get(engine)->globalClass->illegalNames().contains(name)) + COMPILE_EXCEPTION(obj, tr("Illegal method name")); methodNames.insert(name); } diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h index 908c703..49dc53f 100644 --- a/src/declarative/qml/qdeclarativecompiler_p.h +++ b/src/declarative/qml/qdeclarativecompiler_p.h @@ -146,7 +146,7 @@ private: }; class QMetaObjectBuilder; -class Q_DECLARATIVE_EXPORT QDeclarativeCompiler +class Q_AUTOTEST_EXPORT QDeclarativeCompiler { Q_DECLARE_TR_FUNCTIONS(QDeclarativeCompiler) public: @@ -161,6 +161,7 @@ public: static bool isSignalPropertyName(const QByteArray &); int evaluateEnum(const QByteArray& script) const; // for QDeclarativeCustomParser::evaluateEnum + const QMetaObject *resolveType(const QByteArray& name) const; // for QDeclarativeCustomParser::resolveType private: static void reset(QDeclarativeCompiledData *); diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index b4919ff..9d3032c 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -572,7 +572,9 @@ QScriptValue QDeclarativeComponent::createObject(QObject* parent) { Q_D(QDeclarativeComponent); QDeclarativeContext* ctxt = creationContext(); - if(!ctxt) + if(!ctxt && d->engine) + ctxt = d->engine->rootContext(); + if (!ctxt) return QScriptValue(QScriptValue::NullValue); QObject* ret = create(ctxt); if (!ret) diff --git a/src/declarative/qml/qdeclarativecustomparser.cpp b/src/declarative/qml/qdeclarativecustomparser.cpp index 472a883..97a6a00 100644 --- a/src/declarative/qml/qdeclarativecustomparser.cpp +++ b/src/declarative/qml/qdeclarativecustomparser.cpp @@ -295,4 +295,14 @@ int QDeclarativeCustomParser::evaluateEnum(const QByteArray& script) const return compiler->evaluateEnum(script); } +/*! + Resolves \a name to a type, or 0 if it is not a type. This can be used + to type-check object nodes. +*/ +const QMetaObject *QDeclarativeCustomParser::resolveType(const QByteArray& name) const +{ + return compiler->resolveType(name); +} + + QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativecustomparser_p.h b/src/declarative/qml/qdeclarativecustomparser_p.h index 0e397c5..509e30a 100644 --- a/src/declarative/qml/qdeclarativecustomparser_p.h +++ b/src/declarative/qml/qdeclarativecustomparser_p.h @@ -113,10 +113,18 @@ private: class Q_DECLARATIVE_EXPORT QDeclarativeCustomParser { public: - QDeclarativeCustomParser() : compiler(0), object(0) {} + enum Flag { + NoFlag = 0x00000000, + AcceptsAttachedProperties = 0x00000001 + }; + Q_DECLARE_FLAGS(Flags, Flag); + + QDeclarativeCustomParser() : compiler(0), object(0), m_flags(NoFlag) {} + QDeclarativeCustomParser(Flags f) : compiler(0), object(0), m_flags(f) {} virtual ~QDeclarativeCustomParser() {} void clearErrors(); + Flags flags() const { return m_flags; } virtual QByteArray compile(const QList<QDeclarativeCustomParserProperty> &)=0; virtual void setCustomData(QObject *, const QByteArray &)=0; @@ -130,12 +138,16 @@ protected: int evaluateEnum(const QByteArray&) const; + const QMetaObject *resolveType(const QByteArray&) const; + private: QList<QDeclarativeError> exceptions; QDeclarativeCompiler *compiler; QDeclarativeParser::Object *object; + Flags m_flags; friend class QDeclarativeCompiler; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativeCustomParser::Flags); #if 0 #define QML_REGISTER_CUSTOM_TYPE(URI, VERSION_MAJ, VERSION_MIN, NAME, TYPE, CUSTOMTYPE) \ diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 86053c4..8b15ae9 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -1033,6 +1033,17 @@ QDeclarativeContextData *QDeclarativeEnginePrivate::getContext(QScriptContext *c return contextClass->contextFromValue(scopeNode); } +/*! + Returns the QUrl associated with the script \a ctxt for the case that there is + no QDeclarativeContext. +*/ +QUrl QDeclarativeEnginePrivate::getUrl(QScriptContext *ctxt) +{ + QScriptValue scopeNode = QScriptDeclarativeClass::scopeChainValue(ctxt, -3); + Q_ASSERT(scopeNode.isValid()); + Q_ASSERT(QScriptDeclarativeClass::scriptClass(scopeNode) == contextClass); + return contextClass->urlFromValue(scopeNode); +} QString QDeclarativeEnginePrivate::urlToLocalFileOrQrc(const QUrl& url) { @@ -1075,16 +1086,19 @@ QScriptValue QDeclarativeEnginePrivate::createComponent(QScriptContext *ctxt, QS static_cast<QDeclarativeScriptEngine*>(engine)->p; QDeclarativeEngine* activeEngine = activeEnginePriv->q_func(); - QDeclarativeContextData* context = activeEnginePriv->getContext(ctxt); - Q_ASSERT(context); - if(ctxt->argumentCount() != 1) { return ctxt->throwError(QLatin1String("Qt.createComponent(): Invalid arguments")); - }else{ + } else { + QString arg = ctxt->argument(0).toString(); if (arg.isEmpty()) return engine->nullValue(); - QUrl url = QUrl(context->resolvedUrl(QUrl(arg))); + QUrl url; + QDeclarativeContextData* context = activeEnginePriv->getContext(ctxt); + if (context) + url = QUrl(context->resolvedUrl(QUrl(arg))); + else + url = activeEnginePriv->getUrl(ctxt).resolved(QUrl(arg)); QDeclarativeComponent *c = new QDeclarativeComponent(activeEngine, url, activeEngine); QDeclarativeComponentPrivate::get(c)->creationContext = context; QDeclarativeData::get(c, true)->setImplicitDestructible(); diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h index 3269e98..cfa9d73 100644 --- a/src/declarative/qml/qdeclarativeengine_p.h +++ b/src/declarative/qml/qdeclarativeengine_p.h @@ -315,6 +315,7 @@ public: static QDeclarativeEnginePrivate *get(QScriptEngine *e) { return static_cast<QDeclarativeScriptEngine*>(e)->p; } static QDeclarativeEngine *get(QDeclarativeEnginePrivate *p) { return p->q_func(); } QDeclarativeContextData *getContext(QScriptContext *); + QUrl getUrl(QScriptContext *); static QString urlToLocalFileOrQrc(const QUrl& url); diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp index 7ae0050..d765649 100644 --- a/src/declarative/qml/qdeclarativeenginedebug.cpp +++ b/src/declarative/qml/qdeclarativeenginedebug.cpp @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE QList<QDeclarativeEngine *> QDeclarativeEngineDebugServer::m_engines; QDeclarativeEngineDebugServer::QDeclarativeEngineDebugServer(QObject *parent) : QDeclarativeDebugService(QLatin1String("QDeclarativeEngine"), parent), - m_watch(new QDeclarativeWatcher(this)) + m_watch(new QDeclarativeWatcher(this)) { QObject::connect(m_watch, SIGNAL(propertyChanged(int,int,QMetaProperty,QVariant)), this, SLOT(propertyChanged(int,int,QMetaProperty,QVariant))); @@ -99,6 +99,29 @@ QDataStream &operator>>(QDataStream &ds, return ds; } +static inline bool isSignalPropertyName(const QString &signalName) +{ + // see QmlCompiler::isSignalPropertyName + return signalName.length() >= 3 && signalName.startsWith(QLatin1String("on")) && + signalName.at(2).isLetter() && signalName.at(2).isUpper(); +} + +static bool hasValidSignal(QObject *object, const QString &propertyName) +{ + if (!isSignalPropertyName(propertyName)) + return false; + + QString signalName = propertyName.mid(2); + signalName[0] = signalName.at(0).toLower(); + + int sigIdx = QDeclarativePropertyPrivate::findSignalByName(object->metaObject(), signalName.toLatin1()).methodIndex(); + + if (sigIdx == -1) + return false; + + return true; +} + QDeclarativeEngineDebugServer::QDeclarativeObjectProperty QDeclarativeEngineDebugServer::propertyData(QObject *obj, int propIdx) { @@ -396,7 +419,6 @@ void QDeclarativeEngineDebugServer::messageReceived(const QByteArray &message) QByteArray reply; QDataStream rs(&reply, QIODevice::WriteOnly); rs << QByteArray("WATCH_EXPR_OBJECT_R") << queryId << ok; - sendMessage(reply); } else if (type == "NO_WATCH") { int queryId; @@ -430,7 +452,48 @@ void QDeclarativeEngineDebugServer::messageReceived(const QByteArray &message) rs << QByteArray("EVAL_EXPRESSION_R") << queryId << result; sendMessage(reply); + } else if (type == "SET_BINDING") { + int queryId; + int objectId; + QString propertyName; + QVariant expr; + bool isLiteralValue; + ds >> queryId >> objectId >> propertyName >> expr >> isLiteralValue; + setBinding(objectId, propertyName, expr, isLiteralValue); + } +} + +void QDeclarativeEngineDebugServer::setBinding(int objectId, + const QString &propertyName, + const QVariant &expression, + bool isLiteralValue) +{ + QObject *object = objectForId(objectId); + QDeclarativeContext *context = qmlContext(object); + + if (object && context) { + + if (isLiteralValue) { + QDeclarativeProperty literalProperty(object, propertyName, context); + literalProperty.write(expression); + } else { + if (hasValidSignal(object, propertyName)) { + QDeclarativeProperty property(object, propertyName); + QDeclarativeExpression *declarativeExpression = new QDeclarativeExpression(context, object, expression.toString()); + QDeclarativePropertyPrivate::setSignalExpression(property, declarativeExpression); + } else { + QDeclarativeBinding *binding = new QDeclarativeBinding(expression.toString(), object, context); + QDeclarativeProperty property(object, propertyName); + binding->setTarget(property); + binding->setNotifyOnValueChanged(true); + QDeclarativeAbstractBinding *oldBinding = QDeclarativePropertyPrivate::setBinding(property, binding); + if (oldBinding) + oldBinding->destroy(); + binding->update(); + } + } } + } void QDeclarativeEngineDebugServer::propertyChanged(int id, int objectId, const QMetaProperty &property, const QVariant &value) diff --git a/src/declarative/qml/qdeclarativeenginedebug_p.h b/src/declarative/qml/qdeclarativeenginedebug_p.h index 9491411..b3c23bd 100644 --- a/src/declarative/qml/qdeclarativeenginedebug_p.h +++ b/src/declarative/qml/qdeclarativeenginedebug_p.h @@ -107,6 +107,7 @@ private: QDeclarativeObjectData objectData(QObject *); QDeclarativeObjectProperty propertyData(QObject *, int); QVariant valueContents(const QVariant &defaultValue) const; + void setBinding(int objectId, const QString &propertyName, const QVariant &expression, bool isLiteralValue); static QList<QDeclarativeEngine *> m_engines; QDeclarativeWatcher *m_watch; diff --git a/src/declarative/qml/qdeclarativeglobalscriptclass.cpp b/src/declarative/qml/qdeclarativeglobalscriptclass.cpp index 39ea101..d43443d 100644 --- a/src/declarative/qml/qdeclarativeglobalscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeglobalscriptclass.cpp @@ -41,6 +41,7 @@ #include "private/qdeclarativeglobalscriptclass_p.h" +#include <QtCore/qstringlist.h> #include <QtCore/qvector.h> #include <QtScript/qscriptstring.h> #include <QtScript/qscriptengine.h> @@ -57,6 +58,7 @@ QDeclarativeGlobalScriptClass::QDeclarativeGlobalScriptClass(QScriptEngine *engi : QScriptClass(engine) { QString eval = QLatin1String("eval"); + QString version = QLatin1String("version"); QScriptValue originalGlobalObject = engine->globalObject(); @@ -72,6 +74,9 @@ QDeclarativeGlobalScriptClass::QDeclarativeGlobalScriptClass(QScriptEngine *engi QString name = iter.name(); + if (name == version) + continue; + if (name != eval) { names.append(name); values.append(iter.value()); @@ -98,18 +103,7 @@ QDeclarativeGlobalScriptClass::queryProperty(const QScriptValue &object, Q_UNUSED(name); Q_UNUSED(flags); Q_UNUSED(id); - return HandlesReadAccess | HandlesWriteAccess; -} - -QScriptValue -QDeclarativeGlobalScriptClass::property(const QScriptValue &object, - const QScriptString &name, - uint id) -{ - Q_UNUSED(object); - Q_UNUSED(name); - Q_UNUSED(id); - return engine()->undefinedValue(); + return HandlesWriteAccess; } void QDeclarativeGlobalScriptClass::setProperty(QScriptValue &object, @@ -125,8 +119,9 @@ void QDeclarativeGlobalScriptClass::setProperty(QScriptValue &object, } /* This method is for the use of tst_qdeclarativeecmascript::callQtInvokables() only */ -void QDeclarativeGlobalScriptClass::explicitSetProperty(const QString &name, const QScriptValue &value) +void QDeclarativeGlobalScriptClass::explicitSetProperty(const QStringList &names, const QList<QScriptValue> &values) { + Q_ASSERT(names.count() == values.count()); QScriptValue globalObject = engine()->globalObject(); QScriptValue v = engine()->newObject(); @@ -137,7 +132,12 @@ void QDeclarativeGlobalScriptClass::explicitSetProperty(const QString &name, con v.setProperty(iter.scriptName(), iter.value()); } - v.setProperty(name, value); + for (int ii = 0; ii < names.count(); ++ii) { + const QString &name = names.at(ii); + const QScriptValue &value = values.at(ii); + v.setProperty(name, value); + } + v.setScriptClass(this); engine()->setGlobalObject(v); diff --git a/src/declarative/qml/qdeclarativeglobalscriptclass_p.h b/src/declarative/qml/qdeclarativeglobalscriptclass_p.h index 414bf02..b42b7bd 100644 --- a/src/declarative/qml/qdeclarativeglobalscriptclass_p.h +++ b/src/declarative/qml/qdeclarativeglobalscriptclass_p.h @@ -67,13 +67,10 @@ public: const QScriptString &name, QueryFlags flags, uint *id); - virtual QScriptValue property(const QScriptValue &object, - const QScriptString &name, uint id); - virtual void setProperty(QScriptValue &object, const QScriptString &name, uint id, const QScriptValue &value); - void explicitSetProperty(const QString &, const QScriptValue &); + void explicitSetProperty(const QStringList &, const QList<QScriptValue> &); const QScriptValue &staticGlobalObject() const { return m_staticGlobalObject; } diff --git a/src/declarative/qml/qdeclarativeimageprovider.cpp b/src/declarative/qml/qdeclarativeimageprovider.cpp index 4be3472..f4a8588 100644 --- a/src/declarative/qml/qdeclarativeimageprovider.cpp +++ b/src/declarative/qml/qdeclarativeimageprovider.cpp @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE \note the request() method may be called by multiple threads, so ensure the implementation of this method is reentrant. - \sa QDeclarativeEngine::addImageProvider() + \sa QDeclarativeEngine::addImageProvider(), {declarative/cppextensions/imageprovider}{ImageProvider example} */ /*! diff --git a/src/declarative/qml/qdeclarativeinstruction_p.h b/src/declarative/qml/qdeclarativeinstruction_p.h index 4627eb3..d1a0a0a 100644 --- a/src/declarative/qml/qdeclarativeinstruction_p.h +++ b/src/declarative/qml/qdeclarativeinstruction_p.h @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE class QDeclarativeCompiledData; -class Q_DECLARATIVE_EXPORT QDeclarativeInstruction +class Q_AUTOTEST_EXPORT QDeclarativeInstruction { public: enum Type { diff --git a/src/declarative/qml/qdeclarativelist.cpp b/src/declarative/qml/qdeclarativelist.cpp index 31ef4c2..7c89672 100644 --- a/src/declarative/qml/qdeclarativelist.cpp +++ b/src/declarative/qml/qdeclarativelist.cpp @@ -341,6 +341,8 @@ QML list properties are typesafe - in this case \c {Fruit} is a QObject type tha \note QDeclarativeListProperty can only be used for lists of QObject-derived object pointers. +\sa {Object and List Property Types} + */ /*! diff --git a/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp b/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp index 399831d..d22798d 100644 --- a/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp +++ b/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE Note: the create() method may be called by multiple threads, so ensure the implementation of this method is reentrant. - \sa QDeclarativeEngine::setNetworkAccessManagerFactory() + \sa QDeclarativeEngine::setNetworkAccessManagerFactory(), {declarative/cppextensions/networkaccessmanagerfactory}{NetworkAccessManagerFactory example} */ /*! diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp index aca01b2..3af892d 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp +++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp @@ -797,6 +797,26 @@ QScriptDeclarativeClass::Value MetaCallArgument::toValue(QDeclarativeEngine *e) } } +int QDeclarativeObjectMethodScriptClass::enumType(const QMetaObject *meta, const QString &strname) +{ + QByteArray str = strname.toUtf8(); + QByteArray scope; + QByteArray name; + int scopeIdx = str.lastIndexOf("::"); + if (scopeIdx != -1) { + scope = str.left(scopeIdx); + name = str.mid(scopeIdx + 2); + } else { + name = str; + } + for (int i = meta->enumeratorCount() - 1; i >= 0; --i) { + QMetaEnum m = meta->enumerator(i); + if ((m.name() == name) && (scope.isEmpty() || (m.scope() == scope))) + return QVariant::Int; + } + return QVariant::Invalid; +} + QDeclarativeObjectMethodScriptClass::Value QDeclarativeObjectMethodScriptClass::call(Object *o, QScriptContext *ctxt) { MethodData *method = static_cast<MethodData *>(o); @@ -810,7 +830,9 @@ QDeclarativeObjectMethodScriptClass::Value QDeclarativeObjectMethodScriptClass:: // ### Cache for (int ii = 0; ii < argTypeNames.count(); ++ii) { argTypes[ii] = QMetaType::type(argTypeNames.at(ii)); - if (argTypes[ii] == QVariant::Invalid) + if (argTypes[ii] == QVariant::Invalid) + argTypes[ii] = enumType(method->object->metaObject(), argTypeNames.at(ii)); + if (argTypes[ii] == QVariant::Invalid) return Value(ctxt, ctxt->throwError(QString::fromLatin1("Unknown method parameter type: %1").arg(QLatin1String(argTypeNames.at(ii))))); } diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass_p.h b/src/declarative/qml/qdeclarativeobjectscriptclass_p.h index 4b27e53..75e384c 100644 --- a/src/declarative/qml/qdeclarativeobjectscriptclass_p.h +++ b/src/declarative/qml/qdeclarativeobjectscriptclass_p.h @@ -80,6 +80,8 @@ protected: virtual Value property(Object *, const Identifier &); private: + int enumType(const QMetaObject *, const QString &); + PersistentIdentifier m_connectId; PersistentIdentifier m_disconnectId; QScriptValue m_connect; diff --git a/src/declarative/qml/qdeclarativetypenamescriptclass.cpp b/src/declarative/qml/qdeclarativetypenamescriptclass.cpp index 2a3417a..764a8db 100644 --- a/src/declarative/qml/qdeclarativetypenamescriptclass.cpp +++ b/src/declarative/qml/qdeclarativetypenamescriptclass.cpp @@ -107,8 +107,7 @@ QDeclarativeTypeNameScriptClass::queryProperty(Object *obj, const Identifier &na return 0; } - } else { - Q_ASSERT(data->type); + } else if (data->type) { QString strName = toString(name); @@ -134,6 +133,7 @@ QDeclarativeTypeNameScriptClass::queryProperty(Object *obj, const Identifier &na if (!object) return 0; return ep->objectClass->queryProperty(object, name, flags, 0); } + } return 0; diff --git a/src/declarative/qml/qdeclarativeworkerscript_p.h b/src/declarative/qml/qdeclarativeworkerscript_p.h index dc73811..2b1f9f9 100644 --- a/src/declarative/qml/qdeclarativeworkerscript_p.h +++ b/src/declarative/qml/qdeclarativeworkerscript_p.h @@ -87,7 +87,7 @@ private: QDeclarativeWorkerScriptEnginePrivate *d; }; -class Q_DECLARATIVE_EXPORT QDeclarativeWorkerScript : public QObject, public QDeclarativeParserStatus +class Q_AUTOTEST_EXPORT QDeclarativeWorkerScript : public QObject, public QDeclarativeParserStatus { Q_OBJECT Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index f807866..add27f3 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -176,6 +176,8 @@ void QDeclarativeAbstractAnimation::setRunning(bool r) { Q_D(QDeclarativeAbstractAnimation); if (!d->componentComplete) { + if (d->running && r == d->running) //don't re-register + return; d->running = r; if (r == false) d->avoidPropertyValueSourceStart = true; diff --git a/src/declarative/util/qdeclarativebehavior.cpp b/src/declarative/util/qdeclarativebehavior.cpp index 90e0ca3..047993e 100644 --- a/src/declarative/util/qdeclarativebehavior.cpp +++ b/src/declarative/util/qdeclarativebehavior.cpp @@ -94,7 +94,7 @@ public: Currently only a single Behavior may be specified for a property; this Behavior can be enabled and disabled via the \l{enabled} property. - \sa QtDeclarative + \sa {declarative/animation/behaviors}{Behavior example}, QtDeclarative */ diff --git a/src/declarative/util/qdeclarativebind_p.h b/src/declarative/util/qdeclarativebind_p.h index f89c2eb..3dc7dba 100644 --- a/src/declarative/util/qdeclarativebind_p.h +++ b/src/declarative/util/qdeclarativebind_p.h @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeBindPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeBind : public QObject, public QDeclarativeParserStatus +class Q_AUTOTEST_EXPORT QDeclarativeBind : public QObject, public QDeclarativeParserStatus { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeBind) diff --git a/src/declarative/util/qdeclarativeconnections_p.h b/src/declarative/util/qdeclarativeconnections_p.h index a914166..e8105b4 100644 --- a/src/declarative/util/qdeclarativeconnections_p.h +++ b/src/declarative/util/qdeclarativeconnections_p.h @@ -58,7 +58,7 @@ QT_MODULE(Declarative) class QDeclarativeBoundSignal; class QDeclarativeContext; class QDeclarativeConnectionsPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeConnections : public QObject, public QDeclarativeParserStatus +class Q_AUTOTEST_EXPORT QDeclarativeConnections : public QObject, public QDeclarativeParserStatus { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeConnections) diff --git a/src/declarative/util/qdeclarativefontloader_p.h b/src/declarative/util/qdeclarativefontloader_p.h index 14335ab..6947547 100644 --- a/src/declarative/util/qdeclarativefontloader_p.h +++ b/src/declarative/util/qdeclarativefontloader_p.h @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeFontLoaderPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeFontLoader : public QObject +class Q_AUTOTEST_EXPORT QDeclarativeFontLoader : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeFontLoader) diff --git a/src/declarative/util/qdeclarativelistaccessor_p.h b/src/declarative/util/qdeclarativelistaccessor_p.h index d8bb8af..41aacb9 100644 --- a/src/declarative/util/qdeclarativelistaccessor_p.h +++ b/src/declarative/util/qdeclarativelistaccessor_p.h @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeEngine; -class Q_DECLARATIVE_EXPORT QDeclarativeListAccessor +class Q_AUTOTEST_EXPORT QDeclarativeListAccessor { public: QDeclarativeListAccessor(); diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 9ed21a6..deb835d 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -551,9 +551,13 @@ bool QDeclarativeListModelParser::compileProperty(const QDeclarativeCustomParser QDeclarativeCustomParserNode node = qvariant_cast<QDeclarativeCustomParserNode>(value); - if (node.name() != "ListElement") { - error(node, QDeclarativeListModel::tr("ListElement: cannot contain nested elements")); - return false; + if (node.name() != listElementTypeName) { + const QMetaObject *mo = resolveType(node.name()); + if (mo != &QDeclarativeListElement::staticMetaObject) { + error(node, QDeclarativeListModel::tr("ListElement: cannot contain nested elements")); + return false; + } + listElementTypeName = node.name(); // cache right name for next time } { @@ -650,6 +654,7 @@ QByteArray QDeclarativeListModelParser::compile(const QList<QDeclarativeCustomPa { QList<ListInstruction> instr; QByteArray data; + listElementTypeName = QByteArray(); // unknown for(int ii = 0; ii < customProps.count(); ++ii) { const QDeclarativeCustomParserProperty &prop = customProps.at(ii); diff --git a/src/declarative/util/qdeclarativelistmodel_p.h b/src/declarative/util/qdeclarativelistmodel_p.h index d09062e..6aff9c6 100644 --- a/src/declarative/util/qdeclarativelistmodel_p.h +++ b/src/declarative/util/qdeclarativelistmodel_p.h @@ -135,6 +135,8 @@ private: bool compileProperty(const QDeclarativeCustomParserProperty &prop, QList<ListInstruction> &instr, QByteArray &data); bool definesEmptyList(const QString &); + + QByteArray listElementTypeName; }; diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp index a4ddf46..0c2f23d 100644 --- a/src/declarative/util/qdeclarativepixmapcache.cpp +++ b/src/declarative/util/qdeclarativepixmapcache.cpp @@ -220,18 +220,20 @@ bool QDeclarativeImageRequestHandler::event(QEvent *event) if (reader->cancelled.count()) { for (int i = 0; i < reader->cancelled.count(); ++i) { QDeclarativePixmapReply *job = reader->cancelled.at(i); - // cancel any jobs already started QNetworkReply *reply = replies.key(job, 0); if (reply && reply->isRunning()) { + // cancel any jobs already started replies.remove(reply); reply->close(); - } - // remove from pending job list - for (int j = 0; j < reader->jobs.count(); ++j) { - if (reader->jobs.at(j) == job) { - reader->jobs.removeAt(j); - job->release(true); - break; + job->release(true); + } else { + // remove from pending job list + for (int j = 0; j < reader->jobs.count(); ++j) { + if (reader->jobs.at(j) == job) { + reader->jobs.removeAt(j); + job->release(true); + break; + } } } } @@ -306,27 +308,27 @@ void QDeclarativeImageRequestHandler::networkRequestDone() QNetworkReply *reply = static_cast<QNetworkReply *>(sender()); QDeclarativePixmapReply *job = replies.take(reply); - redirectCount++; - if (redirectCount < IMAGEREQUESTHANDLER_MAX_REDIRECT_RECURSION) { - QVariant redirect = reply->attribute(QNetworkRequest::RedirectionTargetAttribute); - if (redirect.isValid()) { - QUrl url = reply->url().resolved(redirect.toUrl()); - QNetworkRequest req(url); - req.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true); - - reply->deleteLater(); - reply = networkAccessManager()->get(req); - - QMetaObject::connect(reply, replyDownloadProgress, job, downloadProgress); - QMetaObject::connect(reply, replyFinished, this, thisNetworkRequestDone); - - replies.insert(reply, job); - return; + if (job) { + redirectCount++; + if (redirectCount < IMAGEREQUESTHANDLER_MAX_REDIRECT_RECURSION) { + QVariant redirect = reply->attribute(QNetworkRequest::RedirectionTargetAttribute); + if (redirect.isValid()) { + QUrl url = reply->url().resolved(redirect.toUrl()); + QNetworkRequest req(url); + req.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true); + + reply->deleteLater(); + reply = networkAccessManager()->get(req); + + QMetaObject::connect(reply, replyDownloadProgress, job, downloadProgress); + QMetaObject::connect(reply, replyFinished, this, thisNetworkRequestDone); + + replies.insert(reply, job); + return; + } } - } - redirectCount=0; + redirectCount=0; - if (job) { QImage image; QDeclarativeImageReaderEvent::ReadError error; QString errorString; @@ -510,6 +512,12 @@ bool QDeclarativePixmapReply::event(QEvent *event) else d->errorString = de->errorString; QByteArray key = d->url.toEncoded(QUrl::FormattingOption(0x100)); + if (d->forced_width > 0 || d->forced_height > 0) { + key += ':'; + key += QByteArray::number(d->forced_width); + key += 'x'; + key += QByteArray::number(d->forced_height); + } QString strKey = QString::fromLatin1(key.constData(), key.count()); QPixmapCache::insert(strKey, d->pixmap); // note: may fail (returns false) emit finished(); diff --git a/src/declarative/util/qdeclarativepropertychanges.cpp b/src/declarative/util/qdeclarativepropertychanges.cpp index 8e3ec82..12c6353 100644 --- a/src/declarative/util/qdeclarativepropertychanges.cpp +++ b/src/declarative/util/qdeclarativepropertychanges.cpp @@ -145,7 +145,7 @@ QT_BEGIN_NAMESPACE an Item's parent should be done using the associated change elements (ParentChange and AnchorChanges, respectively). - \sa {qmlstate}{States}, QtDeclarative + \sa {declarative/animation/states}{states example}, {qmlstate}{States}, QtDeclarative */ /*! diff --git a/src/declarative/util/qdeclarativepropertychanges_p.h b/src/declarative/util/qdeclarativepropertychanges_p.h index c2ed466..8578086 100644 --- a/src/declarative/util/qdeclarativepropertychanges_p.h +++ b/src/declarative/util/qdeclarativepropertychanges_p.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativePropertyChangesPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativePropertyChanges : public QDeclarativeStateOperation +class Q_AUTOTEST_EXPORT QDeclarativePropertyChanges : public QDeclarativeStateOperation { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativePropertyChanges) @@ -79,6 +79,9 @@ public: class QDeclarativePropertyChangesParser : public QDeclarativeCustomParser { public: + QDeclarativePropertyChangesParser() + : QDeclarativeCustomParser(AcceptsAttachedProperties) {} + void compileList(QList<QPair<QByteArray, QVariant> > &list, const QByteArray &pre, const QDeclarativeCustomParserProperty &prop); virtual QByteArray compile(const QList<QDeclarativeCustomParserProperty> &); diff --git a/src/declarative/util/qdeclarativesmoothedanimation_p.h b/src/declarative/util/qdeclarativesmoothedanimation_p.h index f45d19f..8b51209 100644 --- a/src/declarative/util/qdeclarativesmoothedanimation_p.h +++ b/src/declarative/util/qdeclarativesmoothedanimation_p.h @@ -55,7 +55,7 @@ QT_MODULE(Declarative) class QDeclarativeProperty; class QDeclarativeSmoothedAnimationPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeSmoothedAnimation : public QDeclarativeNumberAnimation +class Q_AUTOTEST_EXPORT QDeclarativeSmoothedAnimation : public QDeclarativeNumberAnimation { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeSmoothedAnimation) diff --git a/src/declarative/util/qdeclarativesmoothedfollow_p.h b/src/declarative/util/qdeclarativesmoothedfollow_p.h index 6319192..f852311 100644 --- a/src/declarative/util/qdeclarativesmoothedfollow_p.h +++ b/src/declarative/util/qdeclarativesmoothedfollow_p.h @@ -55,7 +55,7 @@ QT_MODULE(Declarative) class QDeclarativeProperty; class QDeclarativeSmoothedFollowPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeSmoothedFollow : public QObject, +class Q_AUTOTEST_EXPORT QDeclarativeSmoothedFollow : public QObject, public QDeclarativePropertyValueSource { Q_OBJECT diff --git a/src/declarative/util/qdeclarativespringfollow_p.h b/src/declarative/util/qdeclarativespringfollow_p.h index b829c57..b6277c3 100644 --- a/src/declarative/util/qdeclarativespringfollow_p.h +++ b/src/declarative/util/qdeclarativespringfollow_p.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeSpringFollowPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeSpringFollow : public QObject, +class Q_AUTOTEST_EXPORT QDeclarativeSpringFollow : public QObject, public QDeclarativePropertyValueSource { Q_OBJECT diff --git a/src/declarative/util/qdeclarativestateoperations_p.h b/src/declarative/util/qdeclarativestateoperations_p.h index 05ad052..4f905b6 100644 --- a/src/declarative/util/qdeclarativestateoperations_p.h +++ b/src/declarative/util/qdeclarativestateoperations_p.h @@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeParentChangePrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeParentChange : public QDeclarativeStateOperation, public QDeclarativeActionEvent +class Q_AUTOTEST_EXPORT QDeclarativeParentChange : public QDeclarativeStateOperation, public QDeclarativeActionEvent { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeParentChange) @@ -118,7 +118,7 @@ public: }; class QDeclarativeStateChangeScriptPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeStateChangeScript : public QDeclarativeStateOperation, public QDeclarativeActionEvent +class Q_AUTOTEST_EXPORT QDeclarativeStateChangeScript : public QDeclarativeStateOperation, public QDeclarativeActionEvent { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeStateChangeScript) @@ -251,7 +251,7 @@ private: }; class QDeclarativeAnchorChangesPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeAnchorChanges : public QDeclarativeStateOperation, public QDeclarativeActionEvent +class Q_AUTOTEST_EXPORT QDeclarativeAnchorChanges : public QDeclarativeStateOperation, public QDeclarativeActionEvent { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeAnchorChanges) diff --git a/src/declarative/util/qdeclarativestyledtext_p.h b/src/declarative/util/qdeclarativestyledtext_p.h index 8d2c42d..d80ff9d 100644 --- a/src/declarative/util/qdeclarativestyledtext_p.h +++ b/src/declarative/util/qdeclarativestyledtext_p.h @@ -52,7 +52,7 @@ class QString; class QDeclarativeStyledTextPrivate; class QTextLayout; -class Q_DECLARATIVE_EXPORT QDeclarativeStyledText +class Q_AUTOTEST_EXPORT QDeclarativeStyledText { public: static void parse(const QString &string, QTextLayout &layout); diff --git a/src/declarative/util/qdeclarativesystempalette_p.h b/src/declarative/util/qdeclarativesystempalette_p.h index 9fa6b08..4dfbeff 100644 --- a/src/declarative/util/qdeclarativesystempalette_p.h +++ b/src/declarative/util/qdeclarativesystempalette_p.h @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeSystemPalettePrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeSystemPalette : public QObject +class Q_AUTOTEST_EXPORT QDeclarativeSystemPalette : public QObject { Q_OBJECT Q_ENUMS(ColorGroup) diff --git a/src/declarative/util/qdeclarativetimer.cpp b/src/declarative/util/qdeclarativetimer.cpp index 9e18eb5..576995f 100644 --- a/src/declarative/util/qdeclarativetimer.cpp +++ b/src/declarative/util/qdeclarativetimer.cpp @@ -103,6 +103,8 @@ public: 1000ms has its \e repeat property changed 500ms after starting, the elapsed time will be reset to 0, and the Timer will be triggered 1000ms later. + + \sa {declarative/toys/clocks}{Clocks example} */ QDeclarativeTimer::QDeclarativeTimer(QObject *parent) diff --git a/src/declarative/util/qdeclarativetimer_p.h b/src/declarative/util/qdeclarativetimer_p.h index 08c3d4e..93b0965 100644 --- a/src/declarative/util/qdeclarativetimer_p.h +++ b/src/declarative/util/qdeclarativetimer_p.h @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeTimerPrivate; -class Q_DECLARATIVE_EXPORT QDeclarativeTimer : public QObject, public QDeclarativeParserStatus +class Q_AUTOTEST_EXPORT QDeclarativeTimer : public QObject, public QDeclarativeParserStatus { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeTimer) diff --git a/src/declarative/util/qdeclarativetransition.cpp b/src/declarative/util/qdeclarativetransition.cpp index ab8b116..38ed97e 100644 --- a/src/declarative/util/qdeclarativetransition.cpp +++ b/src/declarative/util/qdeclarativetransition.cpp @@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE \since 4.7 \brief The Transition element defines animated transitions that occur on state changes. - \sa {qmlstates}{States}, {state-transitions}{Transitions}, {QtDeclarative} + \sa {declarative/animation/states}{states example}, {qmlstates}{States}, {state-transitions}{Transitions}, {QtDeclarative} */ /*! diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index bfd25be..0692aaa 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -588,6 +588,8 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty<QDecla If multiple key roles are specified, the model only adds and reload items with a combined value of all key roles that is not already present in the model. + + \sa {declarative/rssnews}{RSS News demo} */ QDeclarativeXmlListModel::QDeclarativeXmlListModel(QObject *parent) diff --git a/src/declarative/util/qdeclarativexmllistmodel_p.h b/src/declarative/util/qdeclarativexmllistmodel_p.h index 8d848c8..832847e 100644 --- a/src/declarative/util/qdeclarativexmllistmodel_p.h +++ b/src/declarative/util/qdeclarativexmllistmodel_p.h @@ -70,7 +70,7 @@ struct QDeclarativeXmlQueryResult { QStringList keyRoleResultsCache; }; -class Q_DECLARATIVE_EXPORT QDeclarativeXmlListModel : public QListModelInterface, public QDeclarativeParserStatus +class Q_AUTOTEST_EXPORT QDeclarativeXmlListModel : public QListModelInterface, public QDeclarativeParserStatus { Q_OBJECT Q_INTERFACES(QDeclarativeParserStatus) @@ -149,7 +149,7 @@ private: Q_DISABLE_COPY(QDeclarativeXmlListModel) }; -class Q_DECLARATIVE_EXPORT QDeclarativeXmlListModelRole : public QObject +class Q_AUTOTEST_EXPORT QDeclarativeXmlListModelRole : public QObject { Q_OBJECT Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) |