diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2016-01-19 10:32:37 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2016-01-19 10:32:37 +0100 |
commit | 81b3d791b5920832eefb616720bccf5cd386cd57 (patch) | |
tree | 9c89f63c0977c5c7ae09d8a35b505dd09e88a64f | |
parent | 7c9e51e7e7b358fb9c4829ee8f02918ec4cfd016 (diff) | |
parent | d1461c8429c7b6f9e9442f319d5a49b7e7a5b67d (diff) |
Merge remote-tracking branch 'origin/5.5' into 5.6
Change-Id: Ieb48911638b5c1acdfd4dee8aa19dca9be99a1f6
-rw-r--r-- | src/qml/qml/qqmlcomponent.cpp | 4 | ||||
-rw-r--r-- | src/quick/items/context2d/qquickcanvasitem.cpp | 8 | ||||
-rw-r--r-- | src/quick/items/qquickmousearea.cpp | 2 | ||||
-rw-r--r-- | src/quick/items/qquicktext.cpp | 2 | ||||
-rw-r--r-- | tests/auto/quick/qquickmousearea/data/qtbug49100.qml | 29 | ||||
-rw-r--r-- | tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp | 13 |
6 files changed, 54 insertions, 4 deletions
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index 040089db20..22a54d732e 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -289,7 +289,7 @@ V4_DEFINE_EXTENSION(QQmlComponentExtension, componentExtension); \value Null This QQmlComponent has no data. Call loadUrl() or setData() to add QML content. \value Ready This QQmlComponent is ready and create() may be called. \value Loading This QQmlComponent is loading network data. - \value Error An error has occurred. Call errors() to retrieve a list of \{QQmlError}{errors}. + \value Error An error has occurred. Call errors() to retrieve a list of \l {QQmlError}{errors}. */ /*! @@ -679,7 +679,7 @@ void QQmlComponentPrivate::loadUrl(const QUrl &newUrl, QQmlComponent::Compilatio } /*! - Return the list of errors that occurred during the last compile or create + Returns the list of errors that occurred during the last compile or create operation. An empty list is returned if isError() is not set. */ QList<QQmlError> QQmlComponent::errors() const diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp index 9abca59b1c..9fb49f9c9e 100644 --- a/src/quick/items/context2d/qquickcanvasitem.cpp +++ b/src/quick/items/context2d/qquickcanvasitem.cpp @@ -222,6 +222,9 @@ QQuickCanvasItemPrivate::~QQuickCanvasItemPrivate() operations. The Canvas output may be saved as an image file or serialized to a URL. + Rendering to the Canvas is done using a Context2D object, usually as a + result of the \l paint signal. + To define a drawing area in the Canvas item set the \c width and \c height properties. For example, the following code creates a Canvas item which has a drawing area with a height of 100 pixels and width of 200 pixels: @@ -231,6 +234,11 @@ QQuickCanvasItemPrivate::~QQuickCanvasItemPrivate() id: mycanvas width: 100 height: 200 + onPaint: { + var ctx = getContext("2d"); + ctx.fillStyle = Qt.rgba(1, 0, 0, 1); + ctx.fillRect(0, 0, width, height); + } } \endqml diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp index b933dc240a..ef053abbd1 100644 --- a/src/quick/items/qquickmousearea.cpp +++ b/src/quick/items/qquickmousearea.cpp @@ -118,7 +118,7 @@ bool QQuickMouseAreaPrivate::isWheelConnected() void QQuickMouseAreaPrivate::propagate(QQuickMouseEvent* event, PropagateType t) { Q_Q(QQuickMouseArea); - if (!propagateComposedEvents) + if (!window || !propagateComposedEvents) return; QPointF scenePos = q->mapToScene(QPointF(event->x(), event->y())); propagateHelper(event, window->contentItem(), scenePos, t); diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index 223219a3f9..5c436d2074 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -461,7 +461,7 @@ void QQuickTextPrivate::updateSize() } QQuickTextLine::QQuickTextLine() - : QObject(), m_line(0), m_height(0) + : QObject(), m_line(0), m_height(0), m_lineOffset(0) { } diff --git a/tests/auto/quick/qquickmousearea/data/qtbug49100.qml b/tests/auto/quick/qquickmousearea/data/qtbug49100.qml new file mode 100644 index 0000000000..39b293c8fa --- /dev/null +++ b/tests/auto/quick/qquickmousearea/data/qtbug49100.qml @@ -0,0 +1,29 @@ +import QtQuick 2.2 + +ListView { + id: list + width: 200 + height: 200 + model: 50 + delegate: Text { + text: index + 1 + height: 30 + width: parent.width + MouseArea { + anchors.fill: parent + } + Rectangle { + anchors.fill: parent + opacity: 0.5 + MouseArea { + anchors.fill: parent + propagateComposedEvents: true + onReleased: { + list.currentIndex = 0; + list.positionViewAtIndex(list.currentIndex, ListView.Contain) + } + } + } + } + Component.onCompleted: list.positionViewAtIndex(40, ListView.Beginning) +} diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp index 6e6c9da829..82c053d76a 100644 --- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp +++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp @@ -1149,6 +1149,19 @@ void tst_QQuickMouseArea::clickThrough() QCOMPARE(window->rootObject()->property("clicksEnabled").toInt(), 2); QCOMPARE(window->rootObject()->property("clicksDisabled").toInt(), 1); //disabled, shouldn't increment + + window.reset(new QQuickView); + + //QTBUG-49100 + QVERIFY2(initView(*window.data(), testFileUrl("qtbug49100.qml"), true, &errorMessage), errorMessage.constData()); + window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); + QVERIFY(window->rootObject() != 0); + + QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + + QVERIFY(window->rootObject() != 0); } void tst_QQuickMouseArea::hoverPosition() |