aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-03-04 18:17:10 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-04 18:17:10 +0100
commit3e0dc9ef3894c39fc617c96eecbd419a7a2fefa4 (patch)
tree6982bea25e173186d356a60545544ab54d2d3da2 /src/quick
parent3b507d2c48a1637966a6e7537af7763824f0bef8 (diff)
parent15dc45ce109fe41699950a9b87282901b21f2d3d (diff)
Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/doc/src/appdevguide/debugging.qdoc8
-rw-r--r--src/quick/doc/src/appdevguide/qtquicktest.qdoc28
-rw-r--r--src/quick/items/qquickflickable.cpp47
-rw-r--r--src/quick/items/qquicklistview.cpp4
-rw-r--r--src/quick/items/qquickmousearea.cpp49
-rw-r--r--src/quick/items/qquicktextcontrol.cpp36
-rw-r--r--src/quick/items/qquicktextcontrol_p_p.h6
-rw-r--r--src/quick/items/qquicktextnode.cpp1
-rw-r--r--src/quick/scenegraph/util/qsgsimplematerial.h4
-rw-r--r--src/quick/scenegraph/util/qsgtexturematerial.h4
-rw-r--r--src/quick/util/qquicktimeline.cpp7
11 files changed, 101 insertions, 93 deletions
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));