diff options
38 files changed, 627 insertions, 128 deletions
diff --git a/examples/examples.pro b/examples/examples.pro index 1bcc66d164..0712e81552 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -1,5 +1,4 @@ TEMPLATE = subdirs -SUBDIRS += \ - qmltest \ - qml \ - quick +qtHaveModule(qmltest): SUBDIRS += qmltest +SUBDIRS += qml +qtHaveModule(quick): SUBDIRS += quick diff --git a/examples/qml/dynamicscene/dynamicscene.qmlproject b/examples/qml/dynamicscene/dynamicscene.qmlproject new file mode 100644 index 0000000000..52ac474383 --- /dev/null +++ b/examples/qml/dynamicscene/dynamicscene.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.1 + +Project { + mainFile: "dynamicscene.qml" + + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } +} diff --git a/examples/qml/i18n/i18n.qmlproject b/examples/qml/i18n/i18n.qmlproject new file mode 100644 index 0000000000..7ee5b76b92 --- /dev/null +++ b/examples/qml/i18n/i18n.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.1 + +Project { + mainFile: "i18n.qml" + + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } +} diff --git a/examples/qml/qml.pro b/examples/qml/qml.pro index e6591c895f..34b2622b98 100644 --- a/examples/qml/qml.pro +++ b/examples/qml/qml.pro @@ -1,11 +1,11 @@ TEMPLATE = subdirs +qtHaveModule(quick): SUBDIRS += networkaccessmanagerfactory xmlhttprequest + SUBDIRS += \ - networkaccessmanagerfactory \ plugins \ referenceexamples \ - shell \ - xmlhttprequest + shell EXAMPLE_FILES = \ dynamicscene \ diff --git a/examples/quick/demos/calqlatr/doc/src/calqlatr.qdoc b/examples/quick/demos/calqlatr/doc/src/calqlatr.qdoc index 60a9725e53..9e2dc01667 100644 --- a/examples/quick/demos/calqlatr/doc/src/calqlatr.qdoc +++ b/examples/quick/demos/calqlatr/doc/src/calqlatr.qdoc @@ -27,7 +27,7 @@ /*! \title QML Demo - Calqlatr - \example demos/calqlatr + \example quick/demos/calqlatr \brief This is an example calculator written in QML. \image qml-calqlatr-demo-small.png \ingroup qmldemos diff --git a/examples/quick/localstorage/doc/src/localstorage.qdoc b/examples/quick/localstorage/doc/src/localstorage.qdoc index d3b7fef798..f4dfa56dcf 100644 --- a/examples/quick/localstorage/doc/src/localstorage.qdoc +++ b/examples/quick/localstorage/doc/src/localstorage.qdoc @@ -26,13 +26,13 @@ ****************************************************************************/ /*! \title QtQuick Examples - Local Storage - \example localstorage - \brief This is a collection of QML local storage examples + \example quick/localstorage + \brief A collection of QML local storage examples. \image qml-localstorage-example.png This is a collection of small QML examples relating to local storage functionality. - Hello World demos creating a simple SQL table and how to do inserting/selecting operations. + \e {Hello World} demonstrates creating a simple SQL table and doing insert/select operations. */ diff --git a/examples/quick/painteditem/textballoons/doc/src/textballoons.qdoc b/examples/quick/painteditem/textballoons/doc/src/textballoons.qdoc index e733512712..6f1d751a5f 100644 --- a/examples/quick/painteditem/textballoons/doc/src/textballoons.qdoc +++ b/examples/quick/painteditem/textballoons/doc/src/textballoons.qdoc @@ -28,8 +28,8 @@ /*! \title Scenegraph Painted Item Example - \brief Shows how to implement QPainter-based custom scenegraph items - \example quick/painteditem/textballoons + \brief Shows how to implement QPainter-based custom scenegraph items. + \example quick/customitems/painteditem \ingroup qtquickexamples The Painted Item example shows how to use the QML Scene Graph framework to diff --git a/examples/quick/tutorials/dynamicview/dynamicview1/dynamicview1.qmlproject b/examples/quick/tutorials/dynamicview/dynamicview1/dynamicview1.qmlproject new file mode 100644 index 0000000000..aa20fbadc0 --- /dev/null +++ b/examples/quick/tutorials/dynamicview/dynamicview1/dynamicview1.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.1 + +Project { + mainFile: "dynamicview.qml" + + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } +} diff --git a/examples/quick/tutorials/dynamicview/dynamicview2/dynamicview2.qmlproject b/examples/quick/tutorials/dynamicview/dynamicview2/dynamicview2.qmlproject new file mode 100644 index 0000000000..aa20fbadc0 --- /dev/null +++ b/examples/quick/tutorials/dynamicview/dynamicview2/dynamicview2.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.1 + +Project { + mainFile: "dynamicview.qml" + + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } +} diff --git a/examples/quick/tutorials/dynamicview/dynamicview3/dynamicview3.qmlproject b/examples/quick/tutorials/dynamicview/dynamicview3/dynamicview3.qmlproject new file mode 100644 index 0000000000..aa20fbadc0 --- /dev/null +++ b/examples/quick/tutorials/dynamicview/dynamicview3/dynamicview3.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.1 + +Project { + mainFile: "dynamicview.qml" + + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } +} diff --git a/examples/quick/tutorials/dynamicview/dynamicview4/dynamicview4.qmlproject b/examples/quick/tutorials/dynamicview/dynamicview4/dynamicview4.qmlproject new file mode 100644 index 0000000000..aa20fbadc0 --- /dev/null +++ b/examples/quick/tutorials/dynamicview/dynamicview4/dynamicview4.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.1 + +Project { + mainFile: "dynamicview.qml" + + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } +} diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index b335d6f402..5c123a678b 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -1137,9 +1137,9 @@ static void QQmlComponent_setQmlParent(QObject *me, QObject *parent) As of QtQuick 1.1, this method accepts an optional \a properties argument that specifies a map of initial property values for the created object. These values are applied before object - creation is finalized. (This is more efficient than setting property values after object creation, + creation is finalized. This is more efficient than setting property values after object creation, particularly where large sets of property values are defined, and also allows property bindings - to be set up before the object is created.) + to be set up (using \l{Qt::binding}{Qt.binding}) before the object is created. The \a properties argument is specified as a map of property-value items. For example, the code below creates an object with initial \c x and \c y values of 100 and 200, respectively: diff --git a/src/qml/util/qqmlpropertymap.h b/src/qml/util/qqmlpropertymap.h index c327fd8ce4..f963e9074a 100644 --- a/src/qml/util/qqmlpropertymap.h +++ b/src/qml/util/qqmlpropertymap.h @@ -81,8 +81,8 @@ protected: virtual QVariant updateValue(const QString &key, const QVariant &input); template<class DerivedType> - QQmlPropertyMap(DerivedType *derived, QObject *parent) - : QObject(*allocatePrivate(), parent) + QQmlPropertyMap(DerivedType *derived, QObject *parentObj) + : QObject(*allocatePrivate(), parentObj) { Q_UNUSED(derived) init(&DerivedType::staticMetaObject); diff --git a/src/quick/doc/src/appdevguide/debugging.qdoc b/src/quick/doc/src/appdevguide/debugging.qdoc index 86a577f069..94ce13459c 100644 --- a/src/quick/doc/src/appdevguide/debugging.qdoc +++ b/src/quick/doc/src/appdevguide/debugging.qdoc @@ -123,14 +123,6 @@ function f() { \c console.exception prints an error message together with the stack trace of JavaScript execution at the point where it is called. -\section1 Debugging Transitions - -When a transition doesn't look quite right, it can be helpful to view it in slow -motion to see what is happening more clearly. This functionality is supported -in the \l{qtquick-qmlscene.html}{QML Scene} tool: to enable this, -click on the "Debugging" menu, then "Slow Down Animations". - - \section1 Debugging module imports The \c QML_IMPORT_TRACE environment variable can be set to enable debug output diff --git a/src/quick/doc/src/appdevguide/qtquicktest.qdoc b/src/quick/doc/src/appdevguide/qtquicktest.qdoc index bf8ca86959..f6085764be 100644 --- a/src/quick/doc/src/appdevguide/qtquicktest.qdoc +++ b/src/quick/doc/src/appdevguide/qtquicktest.qdoc @@ -95,6 +95,20 @@ tst_example -input /mnt/SDCard/qmltests \endcode + It is also possible to run a single file using the \c{-input} option. + For example: + + \code + tst_example -input data/test.qml + \endcode + + \code + tst_example -input <full_path>/test.qml + \endcode + + \note Specifying the full path to the qml test file is for example + needed for shadow builds. + If your test case needs QML imports, then you can add them as \c{-import} options to the test program command-line by adding the following line to your .pro file: @@ -102,4 +116,18 @@ \code IMPORTPATH += $$PWD/../imports/my_module1 $$PWD/../imports/my_module2 \endcode + + The \c{-functions} command-line option will return a list of the current + tests functions. It is possible to run a single test function using the name + of the test function as an argument. For example: + + \code + tst_example Test_Name::function1 + \endcode + + The \c{-help} command-line option will return all the options available. + + \code + tst_example -help + \endcode */ diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index c1e8dd378c..3482db0dfe 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -1018,9 +1018,9 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event) if (q->yflick()) { qreal dy = event->localPos().y() - pressPos.y(); bool overThreshold = QQuickWindowPrivate::dragOverThreshold(dy, Qt::YAxis, event); + if (vData.dragStartOffset == 0) + vData.dragStartOffset = dy; if (overThreshold || elapsedSincePress > 200) { - if (!vMoved) - vData.dragStartOffset = dy; qreal newY = dy + vData.pressPos - vData.dragStartOffset; // Recalculate bounds in case margins have changed, but use the content // size estimate taken at the start of the drag in case the drag causes @@ -1031,23 +1031,20 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event) newY = minY + (newY - minY) / 2; if (newY < maxY && maxY - minY <= 0) newY = maxY + (newY - maxY) / 2; - if (boundsBehavior == QQuickFlickable::StopAtBounds && (newY > minY || newY < maxY)) { - rejectY = true; - if (newY < maxY) { - newY = maxY; - rejectY = false; - } - if (newY > minY) { - newY = minY; - rejectY = false; - } + if (boundsBehavior == QQuickFlickable::StopAtBounds && newY <= maxY) { + newY = maxY; + rejectY = vData.pressPos == maxY && dy < 0; + } + if (boundsBehavior == QQuickFlickable::StopAtBounds && newY >= minY) { + newY = minY; + rejectY = vData.pressPos == minY && dy > 0; } if (!rejectY && stealMouse && dy != 0.0) { clearTimeline(); vData.move.setValue(newY); vMoved = true; } - if (overThreshold) + if (!rejectY && overThreshold) stealY = true; } } @@ -1055,9 +1052,9 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event) if (q->xflick()) { qreal dx = event->localPos().x() - pressPos.x(); bool overThreshold = QQuickWindowPrivate::dragOverThreshold(dx, Qt::XAxis, event); + if (hData.dragStartOffset == 0) + hData.dragStartOffset = dx; if (overThreshold || elapsedSincePress > 200) { - if (!hMoved) - hData.dragStartOffset = dx; qreal newX = dx + hData.pressPos - hData.dragStartOffset; const qreal minX = hData.dragMinBound + hData.startMargin; const qreal maxX = hData.dragMaxBound - hData.endMargin; @@ -1065,24 +1062,22 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event) newX = minX + (newX - minX) / 2; if (newX < maxX && maxX - minX <= 0) newX = maxX + (newX - maxX) / 2; - if (boundsBehavior == QQuickFlickable::StopAtBounds && (newX > minX || newX < maxX)) { - rejectX = true; - if (newX < maxX) { - newX = maxX; - rejectX = false; - } - if (newX > minX) { - newX = minX; - rejectX = false; - } + if (boundsBehavior == QQuickFlickable::StopAtBounds && newX <= maxX) { + newX = maxX; + rejectX = hData.pressPos == maxX && dx < 0; + } + if (boundsBehavior == QQuickFlickable::StopAtBounds && newX >= minX) { + newX = minX; + rejectX = hData.pressPos == minX && dx > 0; } + if (!rejectX && stealMouse && dx != 0.0) { clearTimeline(); hData.move.setValue(newX); hMoved = true; } - if (overThreshold) + if (!rejectX && overThreshold) stealX = true; } } diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp index 297f64176c..53dc715469 100644 --- a/src/quick/items/qquicklistview.cpp +++ b/src/quick/items/qquicklistview.cpp @@ -172,7 +172,9 @@ public: , highlightMoveVelocity(400), highlightResizeVelocity(400), highlightResizeDuration(-1) , sectionCriteria(0), currentSectionItem(0), nextSectionItem(0) , overshootDist(0.0), correctFlick(false), inFlickCorrection(false) - {} + { + highlightMoveDuration = -1; //override default value set in base class + } ~QQuickListViewPrivate() { delete highlightPosAnimator; delete highlightSizeAnimator; diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp index e75a60181f..2fa52d9ed2 100644 --- a/src/quick/items/qquickmousearea.cpp +++ b/src/quick/items/qquickmousearea.cpp @@ -797,9 +797,6 @@ void QQuickMouseArea::mouseMoveEvent(QMouseEvent *event) curLocalPos = event->windowPos(); } - qreal dx = qAbs(curLocalPos.x() - startLocalPos.x()); - qreal dy = qAbs(curLocalPos.y() - startLocalPos.y()); - if (keepMouseGrab() && d->stealMouse && !d->drag->active()) d->drag->setActive(true); @@ -807,38 +804,30 @@ void QQuickMouseArea::mouseMoveEvent(QMouseEvent *event) ? d->drag->target()->parentItem()->mapFromScene(d->targetStartPos) : d->targetStartPos; - QPointF dragPos = d->drag->target()->position(); - bool dragX = drag()->axis() & QQuickDrag::XAxis; bool dragY = drag()->axis() & QQuickDrag::YAxis; - if (dragX && d->drag->active()) { - qreal x = (curLocalPos.x() - startLocalPos.x()) + startPos.x(); - if (x < drag()->xmin()) - x = drag()->xmin(); - else if (x > drag()->xmax()) - x = drag()->xmax(); - dragPos.setX(x); + QPointF dragPos = d->drag->target()->position(); + if (dragX) { + dragPos.setX(qBound( + d->drag->xmin(), + startPos.x() + curLocalPos.x() - startLocalPos.x(), + d->drag->xmax())); } - if (dragY && d->drag->active()) { - qreal y = (curLocalPos.y() - startLocalPos.y()) + startPos.y(); - if (y < drag()->ymin()) - y = drag()->ymin(); - else if (y > drag()->ymax()) - y = drag()->ymax(); - dragPos.setY(y); + if (dragY) { + dragPos.setY(qBound( + d->drag->ymin(), + startPos.y() + curLocalPos.y() - startLocalPos.y(), + d->drag->ymax())); } - d->drag->target()->setPosition(dragPos); - - if (!keepMouseGrab()) { - bool xDragged = QQuickWindowPrivate::dragOverThreshold(dx, Qt::XAxis, event); - bool yDragged = QQuickWindowPrivate::dragOverThreshold(dy, Qt::YAxis, event); - if ((!dragY && !yDragged && dragX && xDragged) - || (!dragX && !xDragged && dragY && yDragged) - || (dragX && dragY && (xDragged || yDragged))) { - setKeepMouseGrab(true); - d->stealMouse = true; - } + if (d->drag->active()) + d->drag->target()->setPosition(dragPos); + + if (!keepMouseGrab() + && (QQuickWindowPrivate::dragOverThreshold(dragPos.x() - startPos.x(), Qt::XAxis, event) + || QQuickWindowPrivate::dragOverThreshold(dragPos.y() - startPos.y(), Qt::YAxis, event))) { + setKeepMouseGrab(true); + d->stealMouse = true; } d->moved = true; diff --git a/src/quick/items/qquicktextcontrol.cpp b/src/quick/items/qquicktextcontrol.cpp index 02aeaa7e35..6cce3cc25a 100644 --- a/src/quick/items/qquicktextcontrol.cpp +++ b/src/quick/items/qquicktextcontrol.cpp @@ -359,7 +359,7 @@ void QQuickTextControlPrivate::setCursorPosition(int pos, QTextCursor::MoveMode if (mode != QTextCursor::KeepAnchor) { selectedWordOnDoubleClick = QTextCursor(); - selectedBlockOnTrippleClick = QTextCursor(); + selectedBlockOnTripleClick = QTextCursor(); } } @@ -527,18 +527,18 @@ void QQuickTextControlPrivate::extendBlockwiseSelection(int suggestedNewPosition Q_Q(QQuickTextControl); // if inside the initial selected line keep that - if (suggestedNewPosition >= selectedBlockOnTrippleClick.selectionStart() - && suggestedNewPosition <= selectedBlockOnTrippleClick.selectionEnd()) { - q->setTextCursor(selectedBlockOnTrippleClick); + if (suggestedNewPosition >= selectedBlockOnTripleClick.selectionStart() + && suggestedNewPosition <= selectedBlockOnTripleClick.selectionEnd()) { + q->setTextCursor(selectedBlockOnTripleClick); return; } - if (suggestedNewPosition < selectedBlockOnTrippleClick.position()) { - cursor.setPosition(selectedBlockOnTrippleClick.selectionEnd()); + if (suggestedNewPosition < selectedBlockOnTripleClick.position()) { + cursor.setPosition(selectedBlockOnTripleClick.selectionEnd()); cursor.setPosition(suggestedNewPosition, QTextCursor::KeepAnchor); cursor.movePosition(QTextCursor::StartOfBlock, QTextCursor::KeepAnchor); } else { - cursor.setPosition(selectedBlockOnTrippleClick.selectionStart()); + cursor.setPosition(selectedBlockOnTripleClick.selectionStart()); cursor.setPosition(suggestedNewPosition, QTextCursor::KeepAnchor); cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor); cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor); @@ -791,8 +791,8 @@ void QQuickTextControl::timerEvent(QTimerEvent *e) d->cursorOn = !d->cursorOn; d->repaintCursor(); - } else if (e->timerId() == d->trippleClickTimer.timerId()) { - d->trippleClickTimer.stop(); + } else if (e->timerId() == d->tripleClickTimer.timerId()) { + d->tripleClickTimer.stop(); } } @@ -1022,17 +1022,17 @@ void QQuickTextControlPrivate::mousePressEvent(QMouseEvent *e, const QPointF &po commitPreedit(); #endif - if (trippleClickTimer.isActive() - && ((pos - trippleClickPoint).toPoint().manhattanLength() < qApp->styleHints()->startDragDistance())) { + if (tripleClickTimer.isActive() + && ((pos - tripleClickPoint).toPoint().manhattanLength() < qApp->styleHints()->startDragDistance())) { cursor.movePosition(QTextCursor::StartOfBlock); cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor); cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor); - selectedBlockOnTrippleClick = cursor; + selectedBlockOnTripleClick = cursor; anchorOnMousePress = QString(); - trippleClickTimer.stop(); + tripleClickTimer.stop(); } else { int cursorPos = q->hitTest(pos, Qt::FuzzyHit); if (cursorPos == -1) { @@ -1046,7 +1046,7 @@ void QQuickTextControlPrivate::mousePressEvent(QMouseEvent *e, const QPointF &po selectedWordOnDoubleClick.select(QTextCursor::WordUnderCursor); } - if (selectedBlockOnTrippleClick.hasSelection()) + if (selectedBlockOnTripleClick.hasSelection()) extendBlockwiseSelection(cursorPos); else if (selectedWordOnDoubleClick.hasSelection()) extendWordwiseSelection(cursorPos, pos.x()); @@ -1079,7 +1079,7 @@ void QQuickTextControlPrivate::mouseMoveEvent(QMouseEvent *e, const QPointF &mou if (!(mousePressed || editable || selectedWordOnDoubleClick.hasSelection() - || selectedBlockOnTrippleClick.hasSelection())) + || selectedBlockOnTripleClick.hasSelection())) return; const QTextCursor oldSelection = cursor; @@ -1114,7 +1114,7 @@ void QQuickTextControlPrivate::mouseMoveEvent(QMouseEvent *e, const QPointF &mou selectedWordOnDoubleClick.select(QTextCursor::WordUnderCursor); } - if (selectedBlockOnTrippleClick.hasSelection()) + if (selectedBlockOnTripleClick.hasSelection()) extendBlockwiseSelection(newCursorPos); else if (selectedWordOnDoubleClick.hasSelection()) extendWordwiseSelection(newCursorPos, mouseX); @@ -1219,8 +1219,8 @@ void QQuickTextControlPrivate::mouseDoubleClickEvent(QMouseEvent *e, const QPoin cursorIsFocusIndicator = false; selectedWordOnDoubleClick = cursor; - trippleClickPoint = pos; - trippleClickTimer.start(qApp->styleHints()->mouseDoubleClickInterval(), q); + tripleClickPoint = pos; + tripleClickTimer.start(qApp->styleHints()->mouseDoubleClickInterval(), q); if (doEmit) { selectionChanged(); #ifndef QT_NO_CLIPBOARD diff --git a/src/quick/items/qquicktextcontrol_p_p.h b/src/quick/items/qquicktextcontrol_p_p.h index 059ccd36bf..a0727c7a71 100644 --- a/src/quick/items/qquicktextcontrol_p_p.h +++ b/src/quick/items/qquicktextcontrol_p_p.h @@ -126,7 +126,7 @@ public: void cancelPreedit(); #endif - QPointF trippleClickPoint; + QPointF tripleClickPoint; QPointF mousePressPos; QTextCharFormat lastCharFormat; @@ -134,12 +134,12 @@ public: QTextDocument *doc; QTextCursor cursor; QTextCursor selectedWordOnDoubleClick; - QTextCursor selectedBlockOnTrippleClick; + QTextCursor selectedBlockOnTripleClick; QString anchorOnMousePress; QString linkToCopy; QBasicTimer cursorBlinkTimer; - QBasicTimer trippleClickTimer; + QBasicTimer tripleClickTimer; #ifndef QT_NO_IM int preeditCursor; diff --git a/src/quick/items/qquicktextnode.cpp b/src/quick/items/qquicktextnode.cpp index 4d3f97adaf..5e1b20c032 100644 --- a/src/quick/items/qquicktextnode.cpp +++ b/src/quick/items/qquicktextnode.cpp @@ -1105,6 +1105,7 @@ void QQuickTextNode::addImage(const QRectF &rect, const QImage &image) QSGTexture *texture = m_context->createTexture(image); m_textures.append(texture); node->setTargetRect(rect); + node->setInnerTargetRect(rect); node->setTexture(texture); appendChildNode(node); node->update(); diff --git a/src/quick/scenegraph/util/qsgsimplematerial.h b/src/quick/scenegraph/util/qsgsimplematerial.h index 0a733e346a..a1e5aa23be 100644 --- a/src/quick/scenegraph/util/qsgsimplematerial.h +++ b/src/quick/scenegraph/util/qsgsimplematerial.h @@ -140,8 +140,8 @@ class QSGSimpleMaterial : public QSGMaterial { public: #ifndef qdoc - QSGSimpleMaterial(const State &state, PtrShaderCreateFunc func) - : m_state(state) + QSGSimpleMaterial(const State &aState, PtrShaderCreateFunc func) + : m_state(aState) , m_func(func) { } diff --git a/src/quick/scenegraph/util/qsgtexturematerial.h b/src/quick/scenegraph/util/qsgtexturematerial.h index ee4f7cc2e4..b842779716 100644 --- a/src/quick/scenegraph/util/qsgtexturematerial.h +++ b/src/quick/scenegraph/util/qsgtexturematerial.h @@ -59,10 +59,10 @@ public: void setTexture(QSGTexture *texture); QSGTexture *texture() const { return m_texture; } - void setMipmapFiltering(QSGTexture::Filtering filtering) { m_mipmap_filtering = filtering; } + void setMipmapFiltering(QSGTexture::Filtering filteringType) { m_mipmap_filtering = filteringType; } QSGTexture::Filtering mipmapFiltering() const { return (QSGTexture::Filtering) m_mipmap_filtering; } - void setFiltering(QSGTexture::Filtering filtering) { m_filtering = filtering; } + void setFiltering(QSGTexture::Filtering filteringType) { m_filtering = filteringType; } QSGTexture::Filtering filtering() const { return (QSGTexture::Filtering) m_filtering; } void setHorizontalWrapMode(QSGTexture::WrapMode mode) { m_horizontal_wrap = mode; } diff --git a/src/quick/util/qquicktimeline.cpp b/src/quick/util/qquicktimeline.cpp index a3a9220f03..f1d7e19dc2 100644 --- a/src/quick/util/qquicktimeline.cpp +++ b/src/quick/util/qquicktimeline.cpp @@ -49,6 +49,7 @@ #include <QCoreApplication> #include <QEasingCurve> #include <QTime> +#include <QtNumeric> QT_BEGIN_NAMESPACE @@ -386,7 +387,7 @@ void QQuickTimeLine::set(QQuickTimeLineValue &timeLineValue, qreal value) */ int QQuickTimeLine::accel(QQuickTimeLineValue &timeLineValue, qreal velocity, qreal acceleration) { - if (acceleration == 0.0f) + if (qFuzzyIsNull(acceleration) || qIsNaN(acceleration)) return -1; if ((velocity > 0.0f) == (acceleration > 0.0f)) @@ -412,7 +413,7 @@ int QQuickTimeLine::accel(QQuickTimeLineValue &timeLineValue, qreal velocity, qr */ int QQuickTimeLine::accel(QQuickTimeLineValue &timeLineValue, qreal velocity, qreal acceleration, qreal maxDistance) { - if (maxDistance == 0.0f || acceleration == 0.0f) + if (qFuzzyIsNull(maxDistance) || qIsNaN(maxDistance) || qFuzzyIsNull(acceleration) || qIsNaN(acceleration)) return -1; Q_ASSERT(acceleration > 0.0f && maxDistance > 0.0f); @@ -441,7 +442,7 @@ int QQuickTimeLine::accel(QQuickTimeLineValue &timeLineValue, qreal velocity, qr */ int QQuickTimeLine::accelDistance(QQuickTimeLineValue &timeLineValue, qreal velocity, qreal distance) { - if (distance == 0.0f || velocity == 0.0f) + if (qFuzzyIsNull(distance) || qIsNaN(distance) || qFuzzyIsNull(velocity) || qIsNaN(velocity)) return -1; Q_ASSERT((distance >= 0.0f) == (velocity >= 0.0f)); diff --git a/src/src.pro b/src/src.pro index f593eb8968..758482304f 100644 --- a/src/src.pro +++ b/src/src.pro @@ -3,7 +3,7 @@ CONFIG += ordered SUBDIRS += \ qml -qtHaveModule(gui) { +qtHaveModule(gui):contains(QT_CONFIG, opengl(es1|es2)?) { SUBDIRS += \ quick \ qmltest \ diff --git a/tests/auto/headersclean/headersclean.pro b/tests/auto/headersclean/headersclean.pro index 6d2f74a6bc..4457fe1c38 100644 --- a/tests/auto/headersclean/headersclean.pro +++ b/tests/auto/headersclean/headersclean.pro @@ -1,4 +1,2 @@ QT = qml quick qmltest qmldevtools load(qt_headersclean) -# shadowing problems in scenegraph, allow it for now -*-g++*: QMAKE_CXXFLAGS -= -Wshadow diff --git a/tests/auto/quick/qquickdynamicpropertyanimation/data/MyItem.qml b/tests/auto/quick/qquickdynamicpropertyanimation/data/MyItem.qml new file mode 100644 index 0000000000..2fc8b90ac8 --- /dev/null +++ b/tests/auto/quick/qquickdynamicpropertyanimation/data/MyItem.qml @@ -0,0 +1,13 @@ +import QtQuick 2.0 + +Item +{ + property int testInt: 0 + property double testDouble: 0.0 + property real testReal: 0.0 + property point testPoint: Qt.point(0, 0) + property size testSize: Qt.size(0, 0) + property rect testRect: Qt.rect(0, 0, 0, 0) + property color testColor: Qt.rgba(0.0, 0.0, 0.0, 0.0) + property var testVar: 0 +} diff --git a/tests/auto/quick/qquickdynamicpropertyanimation/qquickdynamicpropertyanimation.pro b/tests/auto/quick/qquickdynamicpropertyanimation/qquickdynamicpropertyanimation.pro new file mode 100644 index 0000000000..a67daa91ba --- /dev/null +++ b/tests/auto/quick/qquickdynamicpropertyanimation/qquickdynamicpropertyanimation.pro @@ -0,0 +1,14 @@ +CONFIG += testcase +TARGET = tst_qquickdynamicpropertyanimation +SOURCES += tst_qquickdynamicpropertyanimation.cpp + +include (../../shared/util.pri) + +macx:CONFIG -= app_bundle + +TESTDATA = data/* + +CONFIG += parallel_test + +QT += core gui qml quick testlib +DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickdynamicpropertyanimation/tst_qquickdynamicpropertyanimation.cpp b/tests/auto/quick/qquickdynamicpropertyanimation/tst_qquickdynamicpropertyanimation.cpp new file mode 100644 index 0000000000..78f2d17e9b --- /dev/null +++ b/tests/auto/quick/qquickdynamicpropertyanimation/tst_qquickdynamicpropertyanimation.cpp @@ -0,0 +1,138 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include <QtTest/QtTest> +#include <QtQml/QQmlEngine> +#include <QtQml/QQmlProperty> +#include <QtQuick/QQuickView> +#include <QtQuick/QQuickItem> +#include <QtCore/QPropertyAnimation> +#include <QtCore/QPoint> +#include <QtCore/QSize> +#include <QtCore/QRect> +#include <QtGui/QColor> + +#include "../../shared/util.h" + +class tst_qquickdynamicpropertyanimation : public QQmlDataTest +{ + Q_OBJECT +public: + tst_qquickdynamicpropertyanimation() {} + +private: + template<class T> + void dynamicPropertyAnimation(const QByteArray & propertyName, T toValue) + { + QQuickView view(testFileUrl("MyItem.qml")); + QQuickItem * item = qobject_cast<QQuickItem *>(view.rootObject()); + QVERIFY(item); + QQmlProperty testProp(item, propertyName); + QPropertyAnimation animation(item, propertyName, this); + animation.setEndValue(toValue); + QVERIFY(animation.targetObject() == item); + QVERIFY(animation.propertyName() == propertyName); + QVERIFY(animation.endValue().value<T>() == toValue); + animation.start(); + QVERIFY(animation.state() == QAbstractAnimation::Running); + QTest::qWait(animation.duration()); + QTRY_COMPARE(testProp.read().value<T>(), toValue); + } + +private slots: + void initTestCase() + { + QQmlEngine engine; // ensure types are registered + QQmlDataTest::initTestCase(); + } + + void dynamicIntPropertyAnimation(); + void dynamicDoublePropertyAnimation(); + void dynamicRealPropertyAnimation(); + void dynamicPointPropertyAnimation(); + void dynamicSizePropertyAnimation(); + void dynamicRectPropertyAnimation(); + void dynamicColorPropertyAnimation(); + void dynamicVarPropertyAnimation(); +}; + +void tst_qquickdynamicpropertyanimation::dynamicIntPropertyAnimation() +{ + dynamicPropertyAnimation("testInt", 1); +} + +void tst_qquickdynamicpropertyanimation::dynamicDoublePropertyAnimation() +{ + dynamicPropertyAnimation("testDouble", 1.0); +} + +void tst_qquickdynamicpropertyanimation::dynamicRealPropertyAnimation() +{ + dynamicPropertyAnimation("testReal", qreal(1.0)); +} + +void tst_qquickdynamicpropertyanimation::dynamicPointPropertyAnimation() +{ + dynamicPropertyAnimation("testPoint", QPoint(1, 1)); +} + +void tst_qquickdynamicpropertyanimation::dynamicSizePropertyAnimation() +{ + dynamicPropertyAnimation("testSize", QSize(1,1)); +} + +void tst_qquickdynamicpropertyanimation::dynamicRectPropertyAnimation() +{ + dynamicPropertyAnimation("testRect", QRect(1, 1, 1, 1)); +} + +void tst_qquickdynamicpropertyanimation::dynamicColorPropertyAnimation() +{ + dynamicPropertyAnimation("testColor", QColor::fromRgbF(1.0, 1.0, 1.0, 1.0)); +} + +void tst_qquickdynamicpropertyanimation::dynamicVarPropertyAnimation() +{ + dynamicPropertyAnimation("testVar", QVariant::fromValue(1)); +} + +QTEST_MAIN(tst_qquickdynamicpropertyanimation) + +#include "tst_qquickdynamicpropertyanimation.moc" diff --git a/tests/auto/quick/qquickflickable/data/nestedStopAtBounds.qml b/tests/auto/quick/qquickflickable/data/nestedStopAtBounds.qml new file mode 100644 index 0000000000..59318e5b95 --- /dev/null +++ b/tests/auto/quick/qquickflickable/data/nestedStopAtBounds.qml @@ -0,0 +1,37 @@ +import QtQuick 2.0 + +Flickable { + id: outer + objectName: "outerFlickable" + width: 400 + height: 400 + contentX: 50 + contentY: 50 + contentWidth: 500 + contentHeight: 500 + flickableDirection: inner.flickableDirection + + Rectangle { + x: 100 + y: 100 + width: 300 + height: 300 + + color: "yellow" + Flickable { + id: inner + objectName: "innerFlickable" + anchors.fill: parent + contentX: 100 + contentY: 100 + contentWidth: 400 + contentHeight: 400 + boundsBehavior: Flickable.StopAtBounds + Rectangle { + anchors.fill: parent + anchors.margins: 100 + color: "blue" + } + } + } +} diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp index 9645aaaab3..875ade45b8 100644 --- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp +++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp @@ -91,6 +91,8 @@ private slots: void cancelOnMouseGrab(); void clickAndDragWhenTransformed(); void flickTwiceUsingTouches(); + void nestedStopAtBounds(); + void nestedStopAtBounds_data(); private: void flickWithTouch(QWindow *window, QTouchDevice *touchDevice); @@ -1308,6 +1310,75 @@ void tst_qquickflickable::flickWithTouch(QWindow *window, QTouchDevice *touchDev QTest::qWait(1); } +void tst_qquickflickable::nestedStopAtBounds_data() +{ + QTest::addColumn<bool>("transpose"); + QTest::addColumn<bool>("invert"); + + QTest::newRow("left") << false << false; + QTest::newRow("right") << false << true; + QTest::newRow("top") << true << false; + QTest::newRow("bottom") << true << true; +} + +void tst_qquickflickable::nestedStopAtBounds() +{ + QFETCH(bool, transpose); + QFETCH(bool, invert); + + QQuickView view; + view.setSource(testFileUrl("nestedStopAtBounds.qml")); + view.show(); + view.requestActivate(); + QVERIFY(QTest::qWaitForWindowExposed(&view)); + QVERIFY(view.rootObject()); + + QQuickFlickable *outer = qobject_cast<QQuickFlickable*>(view.rootObject()); + QVERIFY(outer); + + QQuickFlickable *inner = outer->findChild<QQuickFlickable*>("innerFlickable"); + QVERIFY(inner); + inner->setFlickableDirection(transpose ? QQuickFlickable::VerticalFlick : QQuickFlickable::HorizontalFlick); + inner->setContentX(invert ? 0 : 100); + inner->setContentY(invert ? 0 : 100); + + const int threshold = qApp->styleHints()->startDragDistance(); + + QPoint position(200, 200); + int &axis = transpose ? position.ry() : position.rx(); + + // drag toward the aligned boundary. Outer flickable dragged. + QTest::mousePress(&view, Qt::LeftButton, 0, position); + QTest::qWait(10); + axis += invert ? threshold * 2 : -threshold * 2; + QTest::mouseMove(&view, position); + axis += invert ? threshold : -threshold; + QTest::mouseMove(&view, position); + QCOMPARE(outer->isDragging(), true); + QCOMPARE(inner->isDragging(), false); + QTest::mouseRelease(&view, Qt::LeftButton, 0, position); + + QVERIFY(!outer->isDragging()); + QTRY_VERIFY(!outer->isMoving()); + + axis = 200; + outer->setContentX(50); + outer->setContentY(50); + + // drag away from the aligned boundary. Inner flickable dragged. + QTest::mousePress(&view, Qt::LeftButton, 0, position); + QTest::qWait(10); + axis += invert ? -threshold * 2 : threshold * 2; + QTest::mouseMove(&view, position); + axis += invert ? -threshold : threshold; + QTest::mouseMove(&view, position); + QCOMPARE(outer->isDragging(), false); + QCOMPARE(inner->isDragging(), true); + QTest::mouseRelease(&view, Qt::LeftButton, 0, position); + + QTRY_VERIFY(!outer->isMoving()); +} + QTEST_MAIN(tst_qquickflickable) #include "tst_qquickflickable.moc" diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp index 5c0bbb1e21..0c9788ab8e 100644 --- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp +++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp @@ -4308,22 +4308,22 @@ void tst_QQuickGridView::snapOneRow_data() QTest::addColumn<qreal>("startExtent"); QTest::newRow("vertical, left to right") << QQuickGridView::FlowLeftToRight << Qt::LeftToRight << int(QQuickItemView::NoHighlightRange) - << QPoint(20, 200) << QPoint(20, 20) << 100.0 << 240.0 << 0.0; + << QPoint(20, 160) << QPoint(20, 20) << 100.0 << 240.0 << 0.0; QTest::newRow("horizontal, left to right") << QQuickGridView::FlowTopToBottom << Qt::LeftToRight << int(QQuickItemView::NoHighlightRange) - << QPoint(200, 20) << QPoint(20, 20) << 100.0 << 240.0 << 0.0; + << QPoint(160, 20) << QPoint(20, 20) << 100.0 << 240.0 << 0.0; QTest::newRow("horizontal, right to left") << QQuickGridView::FlowTopToBottom << Qt::RightToLeft << int(QQuickItemView::NoHighlightRange) - << QPoint(20, 20) << QPoint(200, 20) << -340.0 << -240.0 - 240.0 << -240.0; + << QPoint(20, 20) << QPoint(160, 20) << -340.0 << -240.0 - 240.0 << -240.0; QTest::newRow("vertical, left to right, enforce range") << QQuickGridView::FlowLeftToRight << Qt::LeftToRight << int(QQuickItemView::StrictlyEnforceRange) - << QPoint(20, 200) << QPoint(20, 20) << 100.0 << 340.0 << -20.0; + << QPoint(20, 160) << QPoint(20, 20) << 100.0 << 340.0 << -20.0; QTest::newRow("horizontal, left to right, enforce range") << QQuickGridView::FlowTopToBottom << Qt::LeftToRight << int(QQuickItemView::StrictlyEnforceRange) - << QPoint(200, 20) << QPoint(20, 20) << 100.0 << 340.0 << -20.0; + << QPoint(160, 20) << QPoint(20, 20) << 100.0 << 340.0 << -20.0; QTest::newRow("horizontal, right to left, enforce range") << QQuickGridView::FlowTopToBottom << Qt::RightToLeft << int(QQuickItemView::StrictlyEnforceRange) - << QPoint(20, 20) << QPoint(200, 20) << -340.0 << -240.0 - 240.0 - 100.0 << -220.0; + << QPoint(20, 20) << QPoint(160, 20) << -340.0 << -240.0 - 240.0 - 100.0 << -220.0; } void tst_QQuickGridView::snapOneRow() diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index 9bcf9d6333..65892ddd9b 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -206,6 +206,7 @@ private slots: void destroyItemOnCreation(); void parentBinding(); + void defaultHighlightMoveDuration(); private: template <class T> void items(const QUrl &source, bool forceLayout); @@ -6801,6 +6802,18 @@ void tst_QQuickListView::parentBinding() delete window; } +void tst_QQuickListView::defaultHighlightMoveDuration() +{ + QQmlEngine engine; + QQmlComponent component(&engine); + component.setData("import QtQuick 2.0; ListView {}", QUrl::fromLocalFile("")); + + QObject *obj = component.create(); + QVERIFY(obj); + + QCOMPARE(obj->property("highlightMoveDuration").toInt(), -1); +} + QTEST_MAIN(tst_QQuickListView) #include "tst_qquicklistview.moc" diff --git a/tests/auto/quick/qquickmousearea/data/nestedStopAtBounds.qml b/tests/auto/quick/qquickmousearea/data/nestedStopAtBounds.qml new file mode 100644 index 0000000000..1fd39bb321 --- /dev/null +++ b/tests/auto/quick/qquickmousearea/data/nestedStopAtBounds.qml @@ -0,0 +1,44 @@ +import QtQuick 2.0 + +Rectangle { + width: 400 + height: 400 + + MouseArea { + id: outer + objectName: "outer" + x: 50 + y: 50 + width: 300 + height: 300 + + drag.target: outer + drag.filterChildren: true + + Rectangle { + anchors.fill: parent + color: "yellow" + } + + MouseArea { + id: inner + objectName: "inner" + + x: 0 + y: 0 + width: 200 + height: 200 + + drag.target: inner + drag.minimumX: 0 + drag.maximumX: 100 + drag.minimumY: 0 + drag.maximumY: 100 + + Rectangle { + anchors.fill: parent + color: "blue" + } + } + } +} diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp index 37ce0fd394..327abbebd5 100644 --- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp +++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp @@ -89,6 +89,8 @@ private slots: void cursorShape(); #endif void moveAndReleaseWithoutPress(); + void nestedStopAtBounds(); + void nestedStopAtBounds_data(); private: void acceptedButton_data(); @@ -803,8 +805,8 @@ void tst_QQuickMouseArea::preventStealing() // Flickable content should have moved. - QCOMPARE(flickable->contentX(), 11.); - QCOMPARE(flickable->contentY(), 11.); + QCOMPARE(flickable->contentX(), 22.); + QCOMPARE(flickable->contentY(), 22.); QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(50, 50)); @@ -1426,6 +1428,72 @@ void tst_QQuickMouseArea::moveAndReleaseWithoutPress() delete window; } +void tst_QQuickMouseArea::nestedStopAtBounds_data() +{ + QTest::addColumn<bool>("transpose"); + QTest::addColumn<bool>("invert"); + + QTest::newRow("left") << false << false; + QTest::newRow("right") << false << true; + QTest::newRow("top") << true << false; + QTest::newRow("bottom") << true << true; +} + +void tst_QQuickMouseArea::nestedStopAtBounds() +{ + QFETCH(bool, transpose); + QFETCH(bool, invert); + + QQuickView view; + view.setSource(testFileUrl("nestedStopAtBounds.qml")); + view.show(); + view.requestActivate(); + QVERIFY(QTest::qWaitForWindowExposed(&view)); + QVERIFY(view.rootObject()); + + QQuickMouseArea *outer = view.rootObject()->findChild<QQuickMouseArea*>("outer"); + QVERIFY(outer); + + QQuickMouseArea *inner = outer->findChild<QQuickMouseArea*>("inner"); + QVERIFY(inner); + inner->drag()->setAxis(transpose ? QQuickDrag::YAxis : QQuickDrag::XAxis); + inner->setX(invert ? 100 : 0); + inner->setY(invert ? 100 : 0); + + const int threshold = qApp->styleHints()->startDragDistance(); + + QPoint position(200, 200); + int &axis = transpose ? position.ry() : position.rx(); + + // drag toward the aligned boundary. Outer mouse area dragged. + QTest::mousePress(&view, Qt::LeftButton, 0, position); + QTest::qWait(10); + axis += invert ? threshold * 2 : -threshold * 2; + QTest::mouseMove(&view, position); + axis += invert ? threshold : -threshold; + QTest::mouseMove(&view, position); + QCOMPARE(outer->drag()->active(), true); + QCOMPARE(inner->drag()->active(), false); + QTest::mouseRelease(&view, Qt::LeftButton, 0, position); + + QVERIFY(!outer->drag()->active()); + + axis = 200; + outer->setX(50); + outer->setY(50); + + // drag away from the aligned boundary. Inner mouse area dragged. + QTest::mousePress(&view, Qt::LeftButton, 0, position); + QTest::qWait(10); + axis += invert ? -threshold * 2 : threshold * 2; + QTest::mouseMove(&view, position); + axis += invert ? -threshold : threshold; + QTest::mouseMove(&view, position); + QCOMPARE(outer->drag()->active(), false); + QCOMPARE(inner->drag()->active(), true); + QTest::mouseRelease(&view, Qt::LeftButton, 0, position); +} + QTEST_MAIN(tst_QQuickMouseArea) #include "tst_qquickmousearea.moc" diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp index 0139e156c3..c29c6c05d6 100644 --- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp +++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp @@ -1872,6 +1872,8 @@ void tst_qquicktextedit::mouseSelection() QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, p2); QTRY_COMPARE(textEditObject->selectedText(), selectedText); + QTest::qWait(QGuiApplication::styleHints()->mouseDoubleClickInterval() + 10); + // Clicking and shift to clicking between the same points should select the same text. textEditObject->setCursorPosition(0); if (clicks > 1) diff --git a/tests/auto/quick/quick.pro b/tests/auto/quick/quick.pro index b969927b8f..81d4fd3348 100644 --- a/tests/auto/quick/quick.pro +++ b/tests/auto/quick/quick.pro @@ -35,6 +35,7 @@ QUICKTESTS = \ qquickanchors \ qquickanimatedimage \ qquickanimatedsprite \ + qquickdynamicpropertyanimation \ qquickborderimage \ qquickwindow \ qquickdrag \ diff --git a/tools/tools.pro b/tools/tools.pro index c193cc97d0..86e2f3804f 100644 --- a/tools/tools.pro +++ b/tools/tools.pro @@ -1,11 +1,8 @@ TEMPLATE = subdirs +qtHaveModule(quick): SUBDIRS += qmlscene qmlplugindump +qtHaveModule(qmltest): SUBDIRS += qmltestrunner SUBDIRS += \ - qmlscene \ - qmlplugindump \ qmlmin \ qmlprofiler \ - qmlbundle \ - qmltestrunner -qtHaveModule(widgets): SUBDIRS += qmleasing - - + qmlbundle +qtHaveModule(quick):qtHaveModule(widgets): SUBDIRS += qmleasing |