aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-02-07 17:46:39 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-07 17:46:39 +0100
commit77686f3b94dfd572778eb8dfa77717114e3abb93 (patch)
tree922cae3c7f7a4abbdf0890e5a53096c8b242a080
parentfbada9b1c12b5245e2eb07ed9383a0bccb1a968f (diff)
parent0906ae8ae7df09ec775ef2f038e4924a5de95a33 (diff)
Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev
-rw-r--r--src/3rdparty/masm/wtf/MathExtras.h4
-rw-r--r--src/quick/items/qquickflickable.cpp2
-rw-r--r--src/quick/items/qquickpositioners.cpp80
-rw-r--r--src/quick/items/qquickpositioners_p.h4
-rw-r--r--src/quick/items/qquickpositioners_p_p.h8
-rw-r--r--tests/auto/auto.pro3
-rw-r--r--tests/auto/qml/debugger/debugger.pro2
-rw-r--r--tests/auto/quick/qquickanimations/qquickanimations.pro2
-rw-r--r--tests/auto/quick/qquickflickable/data/pressDelayWithLoader.qml18
-rw-r--r--tests/auto/quick/qquickflickable/tst_qquickflickable.cpp22
-rw-r--r--tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp8
11 files changed, 125 insertions, 28 deletions
diff --git a/src/3rdparty/masm/wtf/MathExtras.h b/src/3rdparty/masm/wtf/MathExtras.h
index 5b12157148..9a85291ae2 100644
--- a/src/3rdparty/masm/wtf/MathExtras.h
+++ b/src/3rdparty/masm/wtf/MathExtras.h
@@ -147,8 +147,8 @@ inline long lroundf(float num) { return static_cast<long>(roundf(num)); }
#endif
-#if COMPILER(GCC) && OS(QNX)
-// The stdlib on QNX doesn't contain long abs(long). See PR #104666.
+#if COMPILER(GCC) && OS(QNX) && _CPPLIB_VER < 640
+// The stdlib on QNX < 6.6 doesn't contain long abs(long). See PR #104666.
inline long long abs(long num) { return labs(num); }
#endif
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index 333c11cb29..ec199a5a9b 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -1234,7 +1234,7 @@ void QQuickFlickable::mouseReleaseEvent(QMouseEvent *event)
d->replayDelayedPress();
// Now send the release
- if (window()->mouseGrabberItem()) {
+ if (window() && window()->mouseGrabberItem()) {
QPointF localPos = window()->mouseGrabberItem()->mapFromScene(event->windowPos());
QScopedPointer<QMouseEvent> mouseEvent(QQuickWindowPrivate::cloneMouseEvent(event, &localPos));
window()->sendEvent(window()->mouseGrabberItem(), mouseEvent.data());
diff --git a/src/quick/items/qquickpositioners.cpp b/src/quick/items/qquickpositioners.cpp
index c72c2276e0..0ef871be43 100644
--- a/src/quick/items/qquickpositioners.cpp
+++ b/src/quick/items/qquickpositioners.cpp
@@ -869,8 +869,31 @@ void QQuickColumn::reportConflictingAnchors()
\sa Grid::spacing
*/
+class QQuickRowPrivate : public QQuickBasePositionerPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickRow)
+
+public:
+ QQuickRowPrivate()
+ : QQuickBasePositionerPrivate()
+ {}
+
+ void effectiveLayoutDirectionChange()
+ {
+ Q_Q(QQuickRow);
+ // For RTL layout the positioning changes when the width changes.
+ if (getEffectiveLayoutDirection(q) == Qt::RightToLeft)
+ addItemChangeListener(this, QQuickItemPrivate::Geometry);
+ else
+ removeItemChangeListener(this, QQuickItemPrivate::Geometry);
+ // Don't postpone, as it might be the only trigger for visible changes.
+ q->prePositioning();
+ emit q->effectiveLayoutDirectionChanged();
+ }
+};
+
QQuickRow::QQuickRow(QQuickItem *parent)
-: QQuickBasePositioner(Horizontal, parent)
+: QQuickBasePositioner(*new QQuickRowPrivate, Horizontal, parent)
{
}
/*!
@@ -900,14 +923,8 @@ void QQuickRow::setLayoutDirection(Qt::LayoutDirection layoutDirection)
QQuickBasePositionerPrivate *d = static_cast<QQuickBasePositionerPrivate* >(QQuickBasePositionerPrivate::get(this));
if (d->layoutDirection != layoutDirection) {
d->layoutDirection = layoutDirection;
- // For RTL layout the positioning changes when the width changes.
- if (d->layoutDirection == Qt::RightToLeft)
- d->addItemChangeListener(d, QQuickItemPrivate::Geometry);
- else
- d->removeItemChangeListener(d, QQuickItemPrivate::Geometry);
- prePositioning();
emit layoutDirectionChanged();
- emit effectiveLayoutDirectionChanged();
+ d->effectiveLayoutDirectionChange();
}
}
/*!
@@ -1111,8 +1128,33 @@ void QQuickRow::reportConflictingAnchors()
\sa rows, columns
*/
+
+class QQuickGridPrivate : public QQuickBasePositionerPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickGrid)
+
+public:
+ QQuickGridPrivate()
+ : QQuickBasePositionerPrivate()
+ {}
+
+ void effectiveLayoutDirectionChange()
+ {
+ Q_Q(QQuickGrid);
+ // For RTL layout the positioning changes when the width changes.
+ if (getEffectiveLayoutDirection(q) == Qt::RightToLeft)
+ addItemChangeListener(this, QQuickItemPrivate::Geometry);
+ else
+ removeItemChangeListener(this, QQuickItemPrivate::Geometry);
+ // Don't postpone, as it might be the only trigger for visible changes.
+ q->prePositioning();
+ emit q->effectiveLayoutDirectionChanged();
+ emit q->effectiveHorizontalAlignmentChanged(q->effectiveHAlign());
+ }
+};
+
QQuickGrid::QQuickGrid(QQuickItem *parent)
- : QQuickBasePositioner(Both, parent)
+ : QQuickBasePositioner(*new QQuickGridPrivate, Both, parent)
, m_rows(-1)
, m_columns(-1)
, m_rowSpacing(-1)
@@ -1260,15 +1302,8 @@ void QQuickGrid::setLayoutDirection(Qt::LayoutDirection layoutDirection)
QQuickBasePositionerPrivate *d = static_cast<QQuickBasePositionerPrivate*>(QQuickBasePositionerPrivate::get(this));
if (d->layoutDirection != layoutDirection) {
d->layoutDirection = layoutDirection;
- // For RTL layout the positioning changes when the width changes.
- if (d->layoutDirection == Qt::RightToLeft)
- d->addItemChangeListener(d, QQuickItemPrivate::Geometry);
- else
- d->removeItemChangeListener(d, QQuickItemPrivate::Geometry);
- prePositioning();
emit layoutDirectionChanged();
- emit effectiveLayoutDirectionChanged();
- emit effectiveHorizontalAlignmentChanged(effectiveHAlign());
+ d->effectiveLayoutDirectionChange();
}
}
@@ -1652,6 +1687,14 @@ public:
: QQuickBasePositionerPrivate(), flow(QQuickFlow::LeftToRight)
{}
+ void effectiveLayoutDirectionChange()
+ {
+ Q_Q(QQuickFlow);
+ // Don't postpone, as it might be the only trigger for visible changes.
+ q->prePositioning();
+ emit q->effectiveLayoutDirectionChanged();
+ }
+
QQuickFlow::Flow flow;
};
@@ -1724,9 +1767,8 @@ void QQuickFlow::setLayoutDirection(Qt::LayoutDirection layoutDirection)
Q_D(QQuickFlow);
if (d->layoutDirection != layoutDirection) {
d->layoutDirection = layoutDirection;
- prePositioning();
emit layoutDirectionChanged();
- emit effectiveLayoutDirectionChanged();
+ d->effectiveLayoutDirectionChange();
}
}
diff --git a/src/quick/items/qquickpositioners_p.h b/src/quick/items/qquickpositioners_p.h
index eaccdf7653..bbb8319b15 100644
--- a/src/quick/items/qquickpositioners_p.h
+++ b/src/quick/items/qquickpositioners_p.h
@@ -187,6 +187,7 @@ private:
Q_DISABLE_COPY(QQuickColumn)
};
+class QQuickRowPrivate;
class Q_AUTOTEST_EXPORT QQuickRow: public QQuickBasePositioner
{
Q_OBJECT
@@ -208,8 +209,10 @@ protected:
virtual void reportConflictingAnchors();
private:
Q_DISABLE_COPY(QQuickRow)
+ Q_DECLARE_PRIVATE(QQuickRow)
};
+class QQuickGridPrivate;
class Q_AUTOTEST_EXPORT QQuickGrid : public QQuickBasePositioner
{
Q_OBJECT
@@ -293,6 +296,7 @@ private:
HAlignment m_hItemAlign;
VAlignment m_vItemAlign;
Q_DISABLE_COPY(QQuickGrid)
+ Q_DECLARE_PRIVATE(QQuickGrid)
};
class QQuickFlowPrivate;
diff --git a/src/quick/items/qquickpositioners_p_p.h b/src/quick/items/qquickpositioners_p_p.h
index 835c5929ac..c04500303c 100644
--- a/src/quick/items/qquickpositioners_p_p.h
+++ b/src/quick/items/qquickpositioners_p_p.h
@@ -107,9 +107,7 @@ public:
Qt::LayoutDirection layoutDirection;
void mirrorChange() {
- Q_Q(QQuickBasePositioner);
- if (type != QQuickBasePositioner::Vertical)
- q->prePositioning(); //Don't postpone, as it might be the only trigger for visible changes.
+ effectiveLayoutDirectionChange();
}
bool isLeftToRight() const {
if (type == QQuickBasePositioner::Vertical)
@@ -155,6 +153,10 @@ public:
else
return positioner->d_func()->layoutDirection;
}
+
+ virtual void effectiveLayoutDirectionChange()
+ {
+ }
};
QT_END_NAMESPACE
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 30bc175346..715f3e01ad 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -1,7 +1,10 @@
TEMPLATE=subdirs
SUBDIRS=\
qml \
+ quick \
headersclean \
+ particles \
+ qmltest \
qmldevtools \
cmake \
installed_cmake
diff --git a/tests/auto/qml/debugger/debugger.pro b/tests/auto/qml/debugger/debugger.pro
index 6838d01352..8013f46c9b 100644
--- a/tests/auto/qml/debugger/debugger.pro
+++ b/tests/auto/qml/debugger/debugger.pro
@@ -3,6 +3,8 @@ TEMPLATE = subdirs
PUBLICTESTS += \
qqmlenginedebugservice \
qqmldebugjs \
+ qqmlinspector \
+ qqmlprofilerservice \
qpacketprotocol \
# qv4profilerservice \
# qdebugmessageservice \
diff --git a/tests/auto/quick/qquickanimations/qquickanimations.pro b/tests/auto/quick/qquickanimations/qquickanimations.pro
index 1e294b9ae0..f3e1cd082f 100644
--- a/tests/auto/quick/qquickanimations/qquickanimations.pro
+++ b/tests/auto/quick/qquickanimations/qquickanimations.pro
@@ -1,5 +1,5 @@
CONFIG += testcase
-mac:CONFIG+=insignificant_test # QTBUG-29062
+win32-g++|mac:CONFIG+=insignificant_test # QTBUG-29062
TARGET = tst_qquickanimations
SOURCES += tst_qquickanimations.cpp
diff --git a/tests/auto/quick/qquickflickable/data/pressDelayWithLoader.qml b/tests/auto/quick/qquickflickable/data/pressDelayWithLoader.qml
new file mode 100644
index 0000000000..7ef4e70c95
--- /dev/null
+++ b/tests/auto/quick/qquickflickable/data/pressDelayWithLoader.qml
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+
+Loader {
+ id: loader
+
+ width: 300
+ height: 300
+
+ sourceComponent: Flickable {
+ pressDelay: 1000
+ contentWidth: loader.width
+ contentHeight: loader.height
+ MouseArea {
+ anchors.fill: parent
+ onPressed: loader.sourceComponent = null
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
index 59b54e7ba5..8ab86bf2d3 100644
--- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
+++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
@@ -97,6 +97,7 @@ private slots:
void stopAtBounds();
void stopAtBounds_data();
void nestedMouseAreaUsingTouch();
+ void pressDelayWithLoader();
private:
void flickWithTouch(QWindow *window, QTouchDevice *touchDevice, const QPoint &from, const QPoint &to);
@@ -1532,9 +1533,9 @@ void tst_qquickflickable::stopAtBounds()
flickable->setContentX(invert ? 100 : 0);
}
if (invert)
- flick(&view, QPoint(20,20), QPoint(100,100), 100);
+ flick(&view, QPoint(20,20), QPoint(120,120), 100);
else
- flick(&view, QPoint(100,100), QPoint(20,20), 100);
+ flick(&view, QPoint(120,120), QPoint(20,20), 100);
QVERIFY(flickable->isFlicking());
if (transpose) {
@@ -1580,6 +1581,23 @@ void tst_qquickflickable::nestedMouseAreaUsingTouch()
QVERIFY(nested->y() < 100.0);
}
+// QTBUG-31328
+void tst_qquickflickable::pressDelayWithLoader()
+{
+ QScopedPointer<QQuickView> window(new QQuickView);
+ window->setSource(testFileUrl("pressDelayWithLoader.qml"));
+ QTRY_COMPARE(window->status(), QQuickView::Ready);
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QQuickViewTestUtil::moveMouseAway(window.data());
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+ QVERIFY(window->rootObject() != 0);
+
+ // do not crash
+ QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(150, 150));
+ QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(150, 150));
+}
+
QTEST_MAIN(tst_qquickflickable)
#include "tst_qquickflickable.moc"
diff --git a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp
index 69008486c4..e63ff6639e 100644
--- a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp
+++ b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp
@@ -1968,6 +1968,14 @@ void tst_qquickpositioners::test_mirroring()
QQuickItem *itemA = rootA->findChild<QQuickItem*>(objectName);
QQuickItem *itemB = rootB->findChild<QQuickItem*>(objectName);
QTRY_COMPARE(itemA->x(), itemB->x());
+
+ // after resize (QTBUG-35095)
+ QQuickItem *positionerA = itemA->parentItem();
+ QQuickItem *positionerB = itemB->parentItem();
+ positionerA->setWidth(positionerA->width() * 2);
+ positionerB->setWidth(positionerB->width() * 2);
+ QTRY_VERIFY(!QQuickItemPrivate::get(positionerA)->polishScheduled && !QQuickItemPrivate::get(positionerB)->polishScheduled);
+ QTRY_COMPARE(itemA->x(), itemB->x());
}
rootA->setProperty("testRightToLeft", false); // layoutDirection: Qt.LeftToRight