diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-07-22 06:10:02 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-07-22 06:10:02 (GMT) |
commit | 16cafa618c31db1cb3594767701751c489ce88b9 (patch) | |
tree | 18fd1516a6590e937f7fba157a0289c4f74a6675 | |
parent | 58b9468d70fcfdd178f17e89d163c6f9879221d8 (diff) | |
parent | 0767c2ff719a35c16c72fac97e6ff612e8c71e21 (diff) | |
download | Qt-16cafa618c31db1cb3594767701751c489ce88b9.zip Qt-16cafa618c31db1cb3594767701751c489ce88b9.tar.gz Qt-16cafa618c31db1cb3594767701751c489ce88b9.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
19 files changed, 326 insertions, 37 deletions
diff --git a/doc/src/snippets/declarative/mouseareadragfilter.qml b/doc/src/snippets/declarative/mouseareadragfilter.qml new file mode 100644 index 0000000..52ed10c --- /dev/null +++ b/doc/src/snippets/declarative/mouseareadragfilter.qml @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +//! [dragfilter] +import Qt 4.7 + +Rectangle { + width: 480 + height: 320 + Rectangle { + x: 30; y: 30 + width: 300; height: 240 + color: "lightsteelblue" + + MouseArea { + anchors.fill: parent + drag.target: parent; + drag.axis: "XAxis" + drag.minimumX: 30 + drag.maximumX: 150 + drag.filterChildren: true + + Rectangle { + color: "yellow" + x: 50; y : 50 + width: 100; height: 100 + MouseArea { + anchors.fill: parent + onClicked: console.log("Clicked") + } + } + } + } +} +//! [dragfilter] diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index 9af5f56..b286e11 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -1214,6 +1214,7 @@ bool QDeclarativeFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event) d->handleMousePressEvent(&mouseEvent); d->captureDelayedPress(event); + stealThisEvent = d->stealMouse; // Update stealThisEvent in case changed by function call above break; case QEvent::GraphicsSceneMouseRelease: if (d->delayedPressEvent) { @@ -1234,7 +1235,6 @@ bool QDeclarativeFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event) default: break; } - stealThisEvent = d->stealMouse; // Update stealThisEvent and grabber in case changed by function calls above grabber = qobject_cast<QDeclarativeItem*>(s->mouseGrabberItem()); if (grabber && stealThisEvent && !grabber->keepMouseGrab() && grabber != this) { d->clearDelayedPress(); diff --git a/src/declarative/graphicsitems/qdeclarativeitem.h b/src/declarative/graphicsitems/qdeclarativeitem.h index cd9b910..afb1f2e 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.h +++ b/src/declarative/graphicsitems/qdeclarativeitem.h @@ -152,7 +152,6 @@ public: Q_INVOKABLE QDeclarativeItem *childAt(qreal x, qreal y) const; Q_SIGNALS: - void childrenChanged(); void childrenRectChanged(const QRectF &); void baselineOffsetChanged(qreal); void stateChanged(const QString &); diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index 8ee6093..40c621a 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -53,7 +53,7 @@ static const int PressAndHoldDelay = 800; QDeclarativeDrag::QDeclarativeDrag(QObject *parent) : QObject(parent), _target(0), _axis(XandYAxis), _xmin(-FLT_MAX), _xmax(FLT_MAX), _ymin(-FLT_MAX), _ymax(FLT_MAX), -_active(false) +_active(false), _filterChildren(false) { } @@ -160,12 +160,24 @@ void QDeclarativeDrag::setActive(bool drag) emit activeChanged(); } +bool QDeclarativeDrag::filterChildren() const +{ + return _filterChildren; +} + +void QDeclarativeDrag::setFilterChildren(bool filter) +{ + if (_filterChildren == filter) + return; + _filterChildren = filter; + emit filterChildrenChanged(); +} + QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate() { delete drag; } - /*! \qmlclass MouseArea QDeclarativeMouseArea \since 4.7 @@ -398,6 +410,7 @@ void QDeclarativeMouseArea::mousePressEvent(QGraphicsSceneMouseEvent *event) { Q_D(QDeclarativeMouseArea); d->moved = false; + d->stealMouse = false; if (!d->absorb) QDeclarativeItem::mousePressEvent(event); else { @@ -456,8 +469,10 @@ void QDeclarativeMouseArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event) const int dragThreshold = QApplication::startDragDistance(); qreal dx = qAbs(curLocalPos.x() - startLocalPos.x()); qreal dy = qAbs(curLocalPos.y() - startLocalPos.y()); - if ((d->dragX && !(dx < dragThreshold)) || (d->dragY && !(dy < dragThreshold))) + if ((d->dragX && !(dx < dragThreshold)) || (d->dragY && !(dy < dragThreshold))) { d->drag->setActive(true); + d->stealMouse = true; + } if (!keepMouseGrab()) { if ((!d->dragY && dy < dragThreshold && d->dragX && dx > dragThreshold) || (!d->dragX && dx < dragThreshold && d->dragY && dy > dragThreshold) @@ -495,6 +510,7 @@ void QDeclarativeMouseArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event) void QDeclarativeMouseArea::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { Q_D(QDeclarativeMouseArea); + d->stealMouse = false; if (!d->absorb) { QDeclarativeItem::mouseReleaseEvent(event); } else { @@ -505,6 +521,8 @@ void QDeclarativeMouseArea::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) // If we don't accept hover, we need to reset containsMouse. if (!acceptHoverEvents()) setHovered(false); + if (scene()->mouseGrabberItem() == this) + ungrabMouse(); setKeepMouseGrab(false); } } @@ -579,6 +597,71 @@ bool QDeclarativeMouseArea::sceneEvent(QEvent *event) return rv; } +bool QDeclarativeMouseArea::sendMouseEvent(QGraphicsSceneMouseEvent *event) +{ + Q_D(QDeclarativeMouseArea); + QGraphicsSceneMouseEvent mouseEvent(event->type()); + QRectF myRect = mapToScene(QRectF(0, 0, width(), height())).boundingRect(); + + QGraphicsScene *s = scene(); + QDeclarativeItem *grabber = s ? qobject_cast<QDeclarativeItem*>(s->mouseGrabberItem()) : 0; + bool stealThisEvent = d->stealMouse; + if ((stealThisEvent || myRect.contains(event->scenePos().toPoint())) && (!grabber || !grabber->keepMouseGrab())) { + mouseEvent.setAccepted(false); + for (int i = 0x1; i <= 0x10; i <<= 1) { + if (event->buttons() & i) { + Qt::MouseButton button = Qt::MouseButton(i); + mouseEvent.setButtonDownPos(button, mapFromScene(event->buttonDownPos(button))); + } + } + mouseEvent.setScenePos(event->scenePos()); + mouseEvent.setLastScenePos(event->lastScenePos()); + mouseEvent.setPos(mapFromScene(event->scenePos())); + mouseEvent.setLastPos(mapFromScene(event->lastScenePos())); + + switch(mouseEvent.type()) { + case QEvent::GraphicsSceneMouseMove: + mouseMoveEvent(&mouseEvent); + break; + case QEvent::GraphicsSceneMousePress: + mousePressEvent(&mouseEvent); + break; + case QEvent::GraphicsSceneMouseRelease: + mouseReleaseEvent(&mouseEvent); + break; + default: + break; + } + grabber = qobject_cast<QDeclarativeItem*>(s->mouseGrabberItem()); + if (grabber && stealThisEvent && !grabber->keepMouseGrab() && grabber != this) + grabMouse(); + + return stealThisEvent; + } + if (mouseEvent.type() == QEvent::GraphicsSceneMouseRelease) { + d->stealMouse = false; + ungrabMouse(); + } + return false; +} + +bool QDeclarativeMouseArea::sceneEventFilter(QGraphicsItem *i, QEvent *e) +{ + Q_D(QDeclarativeMouseArea); + if (!d->absorb || !isVisible() || !d->drag || !d->drag->filterChildren()) + return QDeclarativeItem::sceneEventFilter(i, e); + switch (e->type()) { + case QEvent::GraphicsSceneMousePress: + case QEvent::GraphicsSceneMouseMove: + case QEvent::GraphicsSceneMouseRelease: + return sendMouseEvent(static_cast<QGraphicsSceneMouseEvent *>(e)); + default: + break; + } + + return QDeclarativeItem::sceneEventFilter(i, e); +} + void QDeclarativeMouseArea::timerEvent(QTimerEvent *event) { Q_D(QDeclarativeMouseArea); @@ -759,6 +842,7 @@ QDeclarativeDrag *QDeclarativeMouseArea::drag() \qmlproperty real MouseArea::drag.maximumX \qmlproperty real MouseArea::drag.minimumY \qmlproperty real MouseArea::drag.maximumY + \qmlproperty bool MouseArea::drag.filterChildren \c drag provides a convenient way to make an item draggable. @@ -779,6 +863,12 @@ QDeclarativeDrag *QDeclarativeMouseArea::drag() for \c rect in the above example, it cannot be dragged along the X-axis. This can be avoided by settng the anchor value to \c undefined in an \l onPressed handler. + + If \c drag.filterChildren is set to true, a drag can override descendant MouseAreas. This + enables a parent MouseArea to handle drags, for example, while descendants handle clicks: + + \snippet doc/src/snippets/declarative/mouseareadragfilter.qml dragfilter + */ QT_END_NAMESPACE diff --git a/src/declarative/graphicsitems/qdeclarativemousearea_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p.h index 4fe3fcb..0da7515 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea_p.h +++ b/src/declarative/graphicsitems/qdeclarativemousearea_p.h @@ -62,6 +62,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeDrag : public QObject Q_PROPERTY(qreal minimumY READ ymin WRITE setYmin NOTIFY minimumYChanged) Q_PROPERTY(qreal maximumY READ ymax WRITE setYmax NOTIFY maximumYChanged) Q_PROPERTY(bool active READ active NOTIFY activeChanged) + Q_PROPERTY(bool filterChildren READ filterChildren WRITE setFilterChildren NOTIFY filterChildrenChanged) //### consider drag and drop public: @@ -88,6 +89,9 @@ public: bool active() const; void setActive(bool); + bool filterChildren() const; + void setFilterChildren(bool); + Q_SIGNALS: void targetChanged(); void axisChanged(); @@ -96,6 +100,7 @@ Q_SIGNALS: void minimumYChanged(); void maximumYChanged(); void activeChanged(); + void filterChildrenChanged(); private: QGraphicsObject *_target; @@ -104,7 +109,8 @@ private: qreal _xmax; qreal _ymin; qreal _ymax; - bool _active; + bool _active : 1; + bool _filterChildren: 1; Q_DISABLE_COPY(QDeclarativeDrag) }; @@ -177,6 +183,8 @@ protected: void hoverMoveEvent(QGraphicsSceneHoverEvent *event); void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); bool sceneEvent(QEvent *); + bool sendMouseEvent(QGraphicsSceneMouseEvent *event); + bool sceneEventFilter(QGraphicsItem *i, QEvent *e); void timerEvent(QTimerEvent *event); virtual void geometryChanged(const QRectF &newGeometry, diff --git a/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h index 3d7bd1e..cf9dc18 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h @@ -68,7 +68,7 @@ class QDeclarativeMouseAreaPrivate : public QDeclarativeItemPrivate public: QDeclarativeMouseAreaPrivate() : absorb(true), hovered(false), pressed(false), longPress(false), - moved(false), drag(0) + moved(false), stealMouse(false), drag(0) { } @@ -78,6 +78,7 @@ public: { Q_Q(QDeclarativeMouseArea); q->setAcceptedMouseButtons(Qt::LeftButton); + q->setFiltersChildEvents(true); } void saveEvent(QGraphicsSceneMouseEvent *event) { @@ -101,6 +102,7 @@ public: bool moved : 1; bool dragX : 1; bool dragY : 1; + bool stealMouse : 1; QDeclarativeDrag *drag; QPointF startScene; qreal startX; diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index f7b2ebf..8117676 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -256,7 +256,6 @@ void QDeclarativeTextEdit::setText(const QString &text) Q_D(QDeclarativeTextEdit); if (QDeclarativeTextEdit::text() == text) return; - d->text = text; d->richText = d->format == RichText || (d->format == AutoText && Qt::mightBeRichText(text)); if (d->richText) { #ifndef QT_NO_TEXTHTMLPARSER @@ -1291,9 +1290,11 @@ void QDeclarativeTextEditPrivate::init() void QDeclarativeTextEdit::q_textChanged() { + Q_D(QDeclarativeTextEdit); + d->text = text(); updateSize(); updateMicroFocus(); - emit textChanged(text()); + emit textChanged(d->text); } void QDeclarativeTextEdit::moveCursorDelegate() diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 9dae64d..e3ebca3 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -578,9 +578,9 @@ void QDeclarativeEngine::clearComponentCache() component instances should be added to sub-contexts parented to the root context. */ -QDeclarativeContext *QDeclarativeEngine::rootContext() +QDeclarativeContext *QDeclarativeEngine::rootContext() const { - Q_D(QDeclarativeEngine); + Q_D(const QDeclarativeEngine); return d->rootContext; } diff --git a/src/declarative/qml/qdeclarativeengine.h b/src/declarative/qml/qdeclarativeengine.h index 01487f5..d971d80 100644 --- a/src/declarative/qml/qdeclarativeengine.h +++ b/src/declarative/qml/qdeclarativeengine.h @@ -74,7 +74,7 @@ public: QDeclarativeEngine(QObject *p = 0); virtual ~QDeclarativeEngine(); - QDeclarativeContext *rootContext(); + QDeclarativeContext *rootContext() const; void clearComponentCache(); diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp index 496f2ad..7546a50 100644 --- a/src/declarative/util/qdeclarativeview.cpp +++ b/src/declarative/util/qdeclarativeview.cpp @@ -132,7 +132,7 @@ class QDeclarativeViewPrivate : public QGraphicsViewPrivate, public QDeclarative public: QDeclarativeViewPrivate() : root(0), declarativeItemRoot(0), graphicsWidgetRoot(0), component(0), resizeMode(QDeclarativeView::SizeViewToRootObject), initialSize(0,0) {} - ~QDeclarativeViewPrivate() { delete root; } + ~QDeclarativeViewPrivate() { delete root; delete engine; } void execute(); void itemGeometryChanged(QDeclarativeItem *item, const QRectF &newGeometry, const QRectF &oldGeometry); void initResize(); @@ -145,7 +145,7 @@ public: QUrl source; - QDeclarativeEngine engine; + QDeclarativeEngine* engine; QDeclarativeComponent *component; QBasicTimer resizetimer; @@ -170,7 +170,7 @@ void QDeclarativeViewPrivate::execute() component = 0; } if (!source.isEmpty()) { - component = new QDeclarativeComponent(&engine, source, q); + component = new QDeclarativeComponent(engine, source, q); if (!component->isLoading()) { q->continueExecute(); } else { @@ -275,6 +275,7 @@ QDeclarativeView::QDeclarativeView(const QUrl &source, QWidget *parent) void QDeclarativeViewPrivate::init() { Q_Q(QDeclarativeView); + engine = new QDeclarativeEngine(); q->setScene(&scene); q->setOptimizationFlags(QGraphicsView::DontSavePainterState); @@ -338,10 +339,10 @@ QUrl QDeclarativeView::source() const Returns a pointer to the QDeclarativeEngine used for instantiating QML Components. */ -QDeclarativeEngine* QDeclarativeView::engine() +QDeclarativeEngine* QDeclarativeView::engine() const { - Q_D(QDeclarativeView); - return &d->engine; + Q_D(const QDeclarativeView); + return d->engine; } /*! @@ -351,10 +352,10 @@ QDeclarativeEngine* QDeclarativeView::engine() arranged hierarchically and this hierarchy is managed by the QDeclarativeEngine. */ -QDeclarativeContext* QDeclarativeView::rootContext() +QDeclarativeContext* QDeclarativeView::rootContext() const { - Q_D(QDeclarativeView); - return d->engine.rootContext(); + Q_D(const QDeclarativeView); + return d->engine->rootContext(); } /*! diff --git a/src/declarative/util/qdeclarativeview.h b/src/declarative/util/qdeclarativeview.h index cdcf134..d3e4948 100644 --- a/src/declarative/util/qdeclarativeview.h +++ b/src/declarative/util/qdeclarativeview.h @@ -75,8 +75,8 @@ public: QUrl source() const; void setSource(const QUrl&); - QDeclarativeEngine* engine(); - QDeclarativeContext* rootContext(); + QDeclarativeEngine* engine() const; + QDeclarativeContext* rootContext() const; QGraphicsObject *rootObject() const; diff --git a/src/s60installs/bwins/QtDeclarativeu.def b/src/s60installs/bwins/QtDeclarativeu.def index 8fdd72c..19e1e01 100644 --- a/src/s60installs/bwins/QtDeclarativeu.def +++ b/src/s60installs/bwins/QtDeclarativeu.def @@ -12,7 +12,7 @@ EXPORTS ??0QDeclarativeText@@QAE@PAVQDeclarativeItem@@@Z @ 11 NONAME ; QDeclarativeText::QDeclarativeText(class QDeclarativeItem *) ?trUtf8@QDeclarativePixmapReply@@SA?AVQString@@PBD0H@Z @ 12 NONAME ABSENT ; class QString QDeclarativePixmapReply::trUtf8(char const *, char const *, int) ?propertyTypeName@QDeclarativeProperty@@QBEPBDXZ @ 13 NONAME ; char const * QDeclarativeProperty::propertyTypeName(void) const - ?wantsFocusChanged@QDeclarativeItem@@IAEX_N@Z @ 14 NONAME ; void QDeclarativeItem::wantsFocusChanged(bool) + ?wantsFocusChanged@QDeclarativeItem@@IAEX_N@Z @ 14 NONAME ABSENT ; void QDeclarativeItem::wantsFocusChanged(bool) ?getStaticMetaObject@QDeclarativeDebugService@@SAABUQMetaObject@@XZ @ 15 NONAME ; struct QMetaObject const & QDeclarativeDebugService::getStaticMetaObject(void) ?setLeft@QDeclarativeAnchors@@QAEXABVQDeclarativeAnchorLine@@@Z @ 16 NONAME ; void QDeclarativeAnchors::setLeft(class QDeclarativeAnchorLine const &) ?qt_metacall@QDeclarativeExpression@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 17 NONAME ; int QDeclarativeExpression::qt_metacall(enum QMetaObject::Call, int, void * *) @@ -265,7 +265,7 @@ EXPORTS ?readyRead@QPacketProtocol@@IAEXXZ @ 264 NONAME ; void QPacketProtocol::readyRead(void) ?qt_metacall@QDeclarativeValueType@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 265 NONAME ; int QDeclarativeValueType::qt_metacall(enum QMetaObject::Call, int, void * *) ?propertyType@QDeclarativePropertyPrivate@@QBEHXZ @ 266 NONAME ; int QDeclarativePropertyPrivate::propertyType(void) const - ?engine@QDeclarativeView@@QAEPAVQDeclarativeEngine@@XZ @ 267 NONAME ; class QDeclarativeEngine * QDeclarativeView::engine(void) + ?engine@QDeclarativeView@@QAEPAVQDeclarativeEngine@@XZ @ 267 NONAME ABSENT ; class QDeclarativeEngine * QDeclarativeView::engine(void) ?inputMethodQuery@QDeclarativeItem@@MBE?AVQVariant@@W4InputMethodQuery@Qt@@@Z @ 268 NONAME ; class QVariant QDeclarativeItem::inputMethodQuery(enum Qt::InputMethodQuery) const ?sizeHint@QDeclarativeView@@UBE?AVQSize@@XZ @ 269 NONAME ; class QSize QDeclarativeView::sizeHint(void) const ?flags@QDeclarativeCustomParser@@QBE?AV?$QFlags@W4Flag@QDeclarativeCustomParser@@@@XZ @ 270 NONAME ; class QFlags<enum QDeclarativeCustomParser::Flag> QDeclarativeCustomParser::flags(void) const @@ -813,7 +813,7 @@ EXPORTS ??0QDeclarativeView@@QAE@ABVQUrl@@PAVQWidget@@@Z @ 812 NONAME ; QDeclarativeView::QDeclarativeView(class QUrl const &, class QWidget *) ?qt_metacall@QDeclarativePixmapReply@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 813 NONAME ABSENT ; int QDeclarativePixmapReply::qt_metacall(enum QMetaObject::Call, int, void * *) ?valueChanged@QDeclarativeExpression@@IAEXXZ @ 814 NONAME ; void QDeclarativeExpression::valueChanged(void) - ?childrenChanged@QDeclarativeItem@@IAEXXZ @ 815 NONAME ; void QDeclarativeItem::childrenChanged(void) + ?childrenChanged@QDeclarativeItem@@IAEXXZ @ 815 NONAME ABSENT ; void QDeclarativeItem::childrenChanged(void) ??_EQDeclarativeView@@UAE@I@Z @ 816 NONAME ; QDeclarativeView::~QDeclarativeView(unsigned int) ?trUtf8@QDeclarativeStateGroup@@SA?AVQString@@PBD0H@Z @ 817 NONAME ; class QString QDeclarativeStateGroup::trUtf8(char const *, char const *, int) ?tag@QMetaMethodBuilder@@QBE?AVQByteArray@@XZ @ 818 NONAME ; class QByteArray QMetaMethodBuilder::tag(void) const @@ -877,7 +877,7 @@ EXPORTS ?setWidth@QDeclarativeItemPrivate@@UAEXM@Z @ 876 NONAME ; void QDeclarativeItemPrivate::setWidth(float) ?staticMetaObject@QDeclarativeDebugWatch@@2UQMetaObject@@B @ 877 NONAME ; struct QMetaObject const QDeclarativeDebugWatch::staticMetaObject ??_EQDeclarativeContext@@UAE@I@Z @ 878 NONAME ; QDeclarativeContext::~QDeclarativeContext(unsigned int) - ?rootContext@QDeclarativeView@@QAEPAVQDeclarativeContext@@XZ @ 879 NONAME ; class QDeclarativeContext * QDeclarativeView::rootContext(void) + ?rootContext@QDeclarativeView@@QAEPAVQDeclarativeContext@@XZ @ 879 NONAME ABSENT ; class QDeclarativeContext * QDeclarativeView::rootContext(void) ?staticMetaObject@QDeclarativeDebugQuery@@2UQMetaObject@@B @ 880 NONAME ; struct QMetaObject const QDeclarativeDebugQuery::staticMetaObject ??0QDeclarativeExtensionPlugin@@QAE@PAVQObject@@@Z @ 881 NONAME ; QDeclarativeExtensionPlugin::QDeclarativeExtensionPlugin(class QObject *) ??_EQDeclarativeOpenMetaObject@@UAE@I@Z @ 882 NONAME ; QDeclarativeOpenMetaObject::~QDeclarativeOpenMetaObject(unsigned int) @@ -1077,7 +1077,7 @@ EXPORTS ??1QDeclarativeEngine@@UAE@XZ @ 1076 NONAME ; QDeclarativeEngine::~QDeclarativeEngine(void) ?debugId@QDeclarativeDebugContextReference@@QBEHXZ @ 1077 NONAME ; int QDeclarativeDebugContextReference::debugId(void) const ?propertyNameParts@QDeclarativeDomProperty@@QBE?AV?$QList@VQByteArray@@@@XZ @ 1078 NONAME ; class QList<class QByteArray> QDeclarativeDomProperty::propertyNameParts(void) const - ?rootContext@QDeclarativeEngine@@QAEPAVQDeclarativeContext@@XZ @ 1079 NONAME ; class QDeclarativeContext * QDeclarativeEngine::rootContext(void) + ?rootContext@QDeclarativeEngine@@QAEPAVQDeclarativeContext@@XZ @ 1079 NONAME ABSENT ; class QDeclarativeContext * QDeclarativeEngine::rootContext(void) ?resetWidth@QDeclarativeItemPrivate@@UAEXXZ @ 1080 NONAME ; void QDeclarativeItemPrivate::resetWidth(void) ??AQDeclarativeOpenMetaObject@@QAEAAVQVariant@@ABVQByteArray@@@Z @ 1081 NONAME ; class QVariant & QDeclarativeOpenMetaObject::operator[](class QByteArray const &) ?bottom@QDeclarativeItemPrivate@@QBE?AVQDeclarativeAnchorLine@@XZ @ 1082 NONAME ; class QDeclarativeAnchorLine QDeclarativeItemPrivate::bottom(void) const @@ -1182,7 +1182,7 @@ EXPORTS ??_EQDeclarativeEngineDebug@@UAE@I@Z @ 1181 NONAME ; QDeclarativeEngineDebug::~QDeclarativeEngineDebug(unsigned int) ?bottom@QDeclarativeScaleGrid@@QBEHXZ @ 1182 NONAME ; int QDeclarativeScaleGrid::bottom(void) const ?d_func@QDeclarativePropertyMap@@AAEPAVQDeclarativePropertyMapPrivate@@XZ @ 1183 NONAME ; class QDeclarativePropertyMapPrivate * QDeclarativePropertyMap::d_func(void) - ?forceFocus@QDeclarativeItem@@QAEXXZ @ 1184 NONAME ; void QDeclarativeItem::forceFocus(void) + ?forceFocus@QDeclarativeItem@@QAEXXZ @ 1184 NONAME ABSENT ; void QDeclarativeItem::forceFocus(void) ?trUtf8@QDeclarativeView@@SA?AVQString@@PBD0@Z @ 1185 NONAME ; class QString QDeclarativeView::trUtf8(char const *, char const *) ??0QDeclarativeTransition@@QAE@PAVQObject@@@Z @ 1186 NONAME ; QDeclarativeTransition::QDeclarativeTransition(class QObject *) ?horizontalCenter@QDeclarativeAnchors@@QBE?AVQDeclarativeAnchorLine@@XZ @ 1187 NONAME ; class QDeclarativeAnchorLine QDeclarativeAnchors::horizontalCenter(void) const @@ -1442,7 +1442,7 @@ EXPORTS ?drawRect@QDeclarativeRectangle@@AAEXAAVQPainter@@@Z @ 1441 NONAME ; void QDeclarativeRectangle::drawRect(class QPainter &) ?read@QDeclarativeProperty@@QBE?AVQVariant@@XZ @ 1442 NONAME ; class QVariant QDeclarativeProperty::read(void) const ?isEmpty@QDeclarativePropertyMap@@QBE_NXZ @ 1443 NONAME ; bool QDeclarativePropertyMap::isEmpty(void) const - ?wantsFocus@QDeclarativeItem@@QBE_NXZ @ 1444 NONAME ; bool QDeclarativeItem::wantsFocus(void) const + ?wantsFocus@QDeclarativeItem@@QBE_NXZ @ 1444 NONAME ABSENT ; bool QDeclarativeItem::wantsFocus(void) const ??6@YAAAVQDataStream@@AAV0@ABUQDeclarativeObjectData@QDeclarativeEngineDebugServer@@@Z @ 1445 NONAME ; class QDataStream & operator<<(class QDataStream &, struct QDeclarativeEngineDebugServer::QDeclarativeObjectData const &) ?trUtf8@QDeclarativeDebugObjectQuery@@SA?AVQString@@PBD0H@Z @ 1446 NONAME ; class QString QDeclarativeDebugObjectQuery::trUtf8(char const *, char const *, int) ??0QDeclarativeBinding@@QAE@ABVQString@@PAVQObject@@PAVQDeclarativeContext@@1@Z @ 1447 NONAME ; QDeclarativeBinding::QDeclarativeBinding(class QString const &, class QObject *, class QDeclarativeContext *, class QObject *) @@ -1676,4 +1676,11 @@ EXPORTS ??0QDeclarativeImageProvider@@QAE@W4ImageType@0@@Z @ 1675 NONAME ; QDeclarativeImageProvider::QDeclarativeImageProvider(enum QDeclarativeImageProvider::ImageType) ?setMethodBody@QDeclarativeEngineDebug@@QAE_NHABVQString@@0@Z @ 1676 NONAME ; bool QDeclarativeEngineDebug::setMethodBody(int, class QString const &, class QString const &) ?resetBindingForObject@QDeclarativeEngineDebug@@QAE_NHABVQString@@@Z @ 1677 NONAME ; bool QDeclarativeEngineDebug::resetBindingForObject(int, class QString const &) + ?forceActiveFocus@QDeclarativeItem@@QAEXXZ @ 1678 NONAME ; void QDeclarativeItem::forceActiveFocus(void) + ?activeFocusChanged@QDeclarativeItem@@IAEX_N@Z @ 1679 NONAME ; void QDeclarativeItem::activeFocusChanged(bool) + ?focusScopeItemChange@QDeclarativeItemPrivate@@UAEX_N@Z @ 1680 NONAME ; void QDeclarativeItemPrivate::focusScopeItemChange(bool) + ?hasActiveFocus@QDeclarativeItem@@QBE_NXZ @ 1681 NONAME ; bool QDeclarativeItem::hasActiveFocus(void) const + ?engine@QDeclarativeView@@QBEPAVQDeclarativeEngine@@XZ @ 1682 NONAME ; class QDeclarativeEngine * QDeclarativeView::engine(void) const + ?rootContext@QDeclarativeView@@QBEPAVQDeclarativeContext@@XZ @ 1683 NONAME ; class QDeclarativeContext * QDeclarativeView::rootContext(void) const + ?rootContext@QDeclarativeEngine@@QBEPAVQDeclarativeContext@@XZ @ 1684 NONAME ; class QDeclarativeContext * QDeclarativeEngine::rootContext(void) const diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 1df9b84..b06cbba 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -12879,4 +12879,8 @@ EXPORTS ?PreDocConstructL@QS60MainApplication@@UAEXXZ @ 12878 NONAME ; void QS60MainApplication::PreDocConstructL(void) ?NewAppServerL@QS60MainApplication@@UAEXAAPAVCApaAppServer@@@Z @ 12879 NONAME ; void QS60MainApplication::NewAppServerL(class CApaAppServer * &) ?HandleViewDeactivation@QS60MainAppUi@@UAEXABVTVwsViewId@@0@Z @ 12880 NONAME ; void QS60MainAppUi::HandleViewDeactivation(class TVwsViewId const &, class TVwsViewId const &) + ?timeout@QTapAndHoldGesture@@SAHXZ @ 12881 NONAME ; int QTapAndHoldGesture::timeout(void) + ?focusScopeItemChange@QGraphicsItemPrivate@@UAEX_N@Z @ 12882 NONAME ; void QGraphicsItemPrivate::focusScopeItemChange(bool) + ?setTimeout@QTapAndHoldGesture@@SAXH@Z @ 12883 NONAME ; void QTapAndHoldGesture::setTimeout(int) + ?childrenBoundingRectHelper@QGraphicsItemPrivate@@QAEXPAVQTransform@@PAVQRectF@@_N@Z @ 12884 NONAME ; void QGraphicsItemPrivate::childrenBoundingRectHelper(class QTransform *, class QRectF *, bool) diff --git a/src/s60installs/eabi/QtDeclarativeu.def b/src/s60installs/eabi/QtDeclarativeu.def index dd5103f..7868e28 100644 --- a/src/s60installs/eabi/QtDeclarativeu.def +++ b/src/s60installs/eabi/QtDeclarativeu.def @@ -44,7 +44,7 @@ EXPORTS _ZN16QDeclarativeInfoD1Ev @ 43 NONAME _ZN16QDeclarativeInfoD2Ev @ 44 NONAME _ZN16QDeclarativeItem10classBeginEv @ 45 NONAME - _ZN16QDeclarativeItem10forceFocusEv @ 46 NONAME + _ZN16QDeclarativeItem10forceFocusEv @ 46 NONAME ABSENT _ZN16QDeclarativeItem10itemChangeEN13QGraphicsItem18GraphicsItemChangeERK8QVariant @ 47 NONAME _ZN16QDeclarativeItem10resetWidthEv @ 48 NONAME _ZN16QDeclarativeItem10sceneEventEP6QEvent @ 49 NONAME @@ -59,7 +59,7 @@ EXPORTS _ZN16QDeclarativeItem13parentChangedEPS_ @ 58 NONAME _ZN16QDeclarativeItem13setParentItemEPS_ @ 59 NONAME _ZN16QDeclarativeItem13smoothChangedEb @ 60 NONAME - _ZN16QDeclarativeItem15childrenChangedEv @ 61 NONAME + _ZN16QDeclarativeItem15childrenChangedEv @ 61 NONAME ABSENT _ZN16QDeclarativeItem15geometryChangedERK6QRectFS2_ @ 62 NONAME _ZN16QDeclarativeItem15keyReleaseEventEP9QKeyEvent @ 63 NONAME _ZN16QDeclarativeItem16inputMethodEventEP17QInputMethodEvent @ 64 NONAME @@ -69,7 +69,7 @@ EXPORTS _ZN16QDeclarativeItem17componentCompleteEv @ 68 NONAME _ZN16QDeclarativeItem17setBaselineOffsetEf @ 69 NONAME _ZN16QDeclarativeItem17setImplicitHeightEf @ 70 NONAME - _ZN16QDeclarativeItem17wantsFocusChangedEb @ 71 NONAME + _ZN16QDeclarativeItem17wantsFocusChangedEb @ 71 NONAME ABSENT _ZN16QDeclarativeItem18keyPressPreHandlerEP9QKeyEvent @ 72 NONAME _ZN16QDeclarativeItem18setTransformOriginENS_15TransformOriginE @ 73 NONAME _ZN16QDeclarativeItem19childrenRectChangedERK6QRectF @ 74 NONAME @@ -143,7 +143,7 @@ EXPORTS _ZN16QDeclarativeView11qt_metacallEN11QMetaObject4CallEiPPv @ 142 NONAME _ZN16QDeclarativeView11qt_metacastEPKc @ 143 NONAME _ZN16QDeclarativeView11resizeEventEP12QResizeEvent @ 144 NONAME - _ZN16QDeclarativeView11rootContextEv @ 145 NONAME + _ZN16QDeclarativeView11rootContextEv @ 145 NONAME ABSENT _ZN16QDeclarativeView12sceneResizedE5QSize @ 146 NONAME _ZN16QDeclarativeView13setResizeModeENS_10ResizeModeE @ 147 NONAME _ZN16QDeclarativeView13setRootObjectEP7QObject @ 148 NONAME @@ -151,7 +151,7 @@ EXPORTS _ZN16QDeclarativeView15continueExecuteEv @ 150 NONAME _ZN16QDeclarativeView16staticMetaObjectE @ 151 NONAME DATA 16 _ZN16QDeclarativeView19getStaticMetaObjectEv @ 152 NONAME - _ZN16QDeclarativeView6engineEv @ 153 NONAME + _ZN16QDeclarativeView6engineEv @ 153 NONAME ABSENT _ZN16QDeclarativeView9setSourceERK4QUrl @ 154 NONAME _ZN16QDeclarativeViewC1EP7QWidget @ 155 NONAME _ZN16QDeclarativeViewC1ERK4QUrlP7QWidget @ 156 NONAME @@ -202,7 +202,7 @@ EXPORTS _ZN18QDeclarativeEngine10setBaseUrlERK4QUrl @ 201 NONAME _ZN18QDeclarativeEngine11qt_metacallEN11QMetaObject4CallEiPPv @ 202 NONAME _ZN18QDeclarativeEngine11qt_metacastEPKc @ 203 NONAME - _ZN18QDeclarativeEngine11rootContextEv @ 204 NONAME + _ZN18QDeclarativeEngine11rootContextEv @ 204 NONAME ABSENT _ZN18QDeclarativeEngine12importPluginERK7QStringS2_PS0_ @ 205 NONAME _ZN18QDeclarativeEngine13addImportPathERK7QString @ 206 NONAME _ZN18QDeclarativeEngine13addPluginPathERK7QString @ 207 NONAME @@ -1075,7 +1075,7 @@ EXPORTS _ZNK15QPacketProtocol17maximumPacketSizeEv @ 1074 NONAME _ZNK16QDeclarativeItem10metaObjectEv @ 1075 NONAME _ZNK16QDeclarativeItem10parentItemEv @ 1076 NONAME - _ZNK16QDeclarativeItem10wantsFocusEv @ 1077 NONAME + _ZNK16QDeclarativeItem10wantsFocusEv @ 1077 NONAME ABSENT _ZNK16QDeclarativeItem10widthValidEv @ 1078 NONAME _ZNK16QDeclarativeItem11heightValidEv @ 1079 NONAME _ZNK16QDeclarativeItem11mapFromItemERK12QScriptValueff @ 1080 NONAME @@ -1707,4 +1707,10 @@ EXPORTS _ZN25QDeclarativeImageProviderC2ENS_9ImageTypeE @ 1706 NONAME _ZNK25QDeclarativeImageProvider9imageTypeEv @ 1707 NONAME _ZN23QDeclarativeEngineDebug21resetBindingForObjectEiRK7QString @ 1708 NONAME + _ZN16QDeclarativeItem16forceActiveFocusEv @ 1709 NONAME + _ZN16QDeclarativeItem18activeFocusChangedEb @ 1710 NONAME + _ZNK16QDeclarativeItem14hasActiveFocusEv @ 1711 NONAME + _ZNK16QDeclarativeView11rootContextEv @ 1712 NONAME + _ZNK16QDeclarativeView6engineEv @ 1713 NONAME + _ZNK18QDeclarativeEngine11rootContextEv @ 1714 NONAME diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 580e173..8c11002 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12084,4 +12084,8 @@ EXPORTS _ZThn24_N13QS60MainAppUi15ProcessCommandLEi @ 12083 NONAME _ZThn40_N13QS60MainAppUi15MopSupplyObjectE8TTypeUid @ 12084 NONAME _ZThn92_N13QS60MainAppUi22HandleViewDeactivationERK10TVwsViewIdS2_ @ 12085 NONAME + _ZN18QTapAndHoldGesture10setTimeoutEi @ 12086 NONAME + _ZN18QTapAndHoldGesture7timeoutEv @ 12087 NONAME + _ZN20QGraphicsItemPrivate20focusScopeItemChangeEb @ 12088 NONAME + _ZN20QGraphicsItemPrivate26childrenBoundingRectHelperEP10QTransformP6QRectFb @ 12089 NONAME diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp index 345ce38..d76d360 100644 --- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp +++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp @@ -665,6 +665,7 @@ void tst_QDeclarativeItem::propertyChanges() QSignalSpy childrenRectSpy(parentItem, SIGNAL(childrenRectChanged(QRectF))); QSignalSpy focusSpy(item, SIGNAL(focusChanged(bool))); QSignalSpy wantsFocusSpy(parentItem, SIGNAL(activeFocusChanged(bool))); + QSignalSpy childrenChangedSpy(parentItem, SIGNAL(childrenChanged())); item->setParentItem(parentItem); item->setWidth(100.0); @@ -677,6 +678,10 @@ void tst_QDeclarativeItem::propertyChanges() QList<QVariant> parentArguments = parentSpy.first(); QVERIFY(parentArguments.count() == 1); QCOMPARE(item->parentItem(), qvariant_cast<QDeclarativeItem *>(parentArguments.at(0))); + QCOMPARE(childrenChangedSpy.count(),1); + + item->setParentItem(parentItem); + QCOMPARE(childrenChangedSpy.count(),1); QCOMPARE(item->width(), 100.0); QCOMPARE(widthSpy.count(),1); diff --git a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp index 5a10372..c9bb467 100644 --- a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp +++ b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp @@ -137,6 +137,17 @@ void tst_QDeclarativeMouseArea::dragProperties() QCOMPARE(yminSpy.count(),1); QCOMPARE(ymaxSpy.count(),1); + // filterChildren + QSignalSpy filterChildrenSpy(drag, SIGNAL(filterChildrenChanged())); + + drag->setFilterChildren(true); + + QVERIFY(drag->filterChildren()); + QCOMPARE(filterChildrenSpy.count(), 1); + + drag->setFilterChildren(true); + QCOMPARE(filterChildrenSpy.count(), 1); + delete canvas; } diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 93351a8..57a5e29 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -115,6 +115,7 @@ private slots: void navigation(); void readOnly(); void copyAndPaste(); + void textInput(); void openInputPanelOnClick(); void openInputPanelOnFocus(); void geometrySignals(); @@ -882,6 +883,12 @@ void tst_qdeclarativetextedit::copyAndPaste() { QCOMPARE(textEdit->text(), QString("Hello world!Hello world!")); QCOMPARE(textEdit->text().length(), 24); + // QTBUG-12339 + // test that document and internal text attribute are in sync + QDeclarativeItemPrivate* pri = QDeclarativeItemPrivate::get(textEdit); + QDeclarativeTextEditPrivate *editPrivate = static_cast<QDeclarativeTextEditPrivate*>(pri); + QCOMPARE(textEdit->text(), editPrivate->text); + // select word textEdit->setCursorPosition(0); textEdit->selectWord(); @@ -961,6 +968,33 @@ public: bool closeInputPanelReceived; }; +void tst_qdeclarativetextedit::textInput() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + QDeclarativeTextEdit edit; + QDeclarativeItemPrivate* pri = QDeclarativeItemPrivate::get(&edit); + QDeclarativeTextEditPrivate *editPrivate = static_cast<QDeclarativeTextEditPrivate*>(pri); + edit.setPos(0, 0); + scene.addItem(&edit); + view.show(); + QApplication::setActiveWindow(&view); + QTest::qWaitForWindowShown(&view); + QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view)); + edit.setFocus(true); + QVERIFY(edit.hasActiveFocus() == true); + + // test that input method event is committed + QInputMethodEvent event; + event.setCommitString( "Hello world!", 0, 0); + QApplication::sendEvent(&view, &event); + QCOMPARE(edit.text(), QString("Hello world!")); + + // QTBUG-12339 + // test that document and internal text attribute are in sync + QCOMPARE(editPrivate->text, QString("Hello world!")); +} + void tst_qdeclarativetextedit::openInputPanelOnClick() { QGraphicsScene scene; diff --git a/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp index 82dc7dd..58cec4f 100644 --- a/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp @@ -66,6 +66,11 @@ private slots: void floatVariantAssignment(); void rectVariantAssignment(); void stringVariantAssignment(); + + void doubleVariantValue(); + void floatVariantValue(); + void rectVariantValue(); + void stringVariantValue(); }; void tst_qvariant::testBound() @@ -175,6 +180,46 @@ void tst_qvariant::stringVariantAssignment() variantAssignment<QString>(QString()); } +void tst_qvariant::doubleVariantValue() +{ + QVariant v(0.0); + QBENCHMARK { + for(int i = 0; i < ITERATION_COUNT; ++i) { + v.toDouble(); + } + } +} + +void tst_qvariant::floatVariantValue() +{ + QVariant v(0.0f); + QBENCHMARK { + for(int i = 0; i < ITERATION_COUNT; ++i) { + v.toFloat(); + } + } +} + +void tst_qvariant::rectVariantValue() +{ + QVariant v(QRect(1,2,3,4)); + QBENCHMARK { + for(int i = 0; i < ITERATION_COUNT; ++i) { + v.toRect(); + } + } +} + +void tst_qvariant::stringVariantValue() +{ + QVariant v = QString(); + QBENCHMARK { + for(int i = 0; i < ITERATION_COUNT; ++i) { + v.toString(); + } + } +} + QTEST_MAIN(tst_qvariant) #include "tst_qvariant.moc" |