From fdf94daed26175d7cf1d5abf59acff5437ad68a1 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Fri, 20 Jan 2017 13:04:28 +0100 Subject: Doc: reinserted hello.qml which had been deleted by mistake During the update of plugin.cpp this file was deleted by mistake. plugin.cpp still refers to it and it needs to be reinserted in src/quick/doc/snippets. Change-Id: Ie23c926ff6096392da96f0063c767009a3965a30 Reviewed-by: Venugopal Shivashankar --- src/quick/doc/snippets/qml/localstorage/hello.qml | 76 +++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 src/quick/doc/snippets/qml/localstorage/hello.qml (limited to 'src/quick') diff --git a/src/quick/doc/snippets/qml/localstorage/hello.qml b/src/quick/doc/snippets/qml/localstorage/hello.qml new file mode 100644 index 0000000000..959895c82a --- /dev/null +++ b/src/quick/doc/snippets/qml/localstorage/hello.qml @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples 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 The Qt Company Ltd 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$ +** +****************************************************************************/ +//![0] +import QtQuick 2.0 + +Rectangle { + color: "white" + width: 200 + height: 100 + + Text { + text: "?" + anchors.horizontalCenter: parent.horizontalCenter + function findGreetings() { + var db = openDatabaseSync("QDeclarativeExampleDB", "1.0", "The Example QML SQL!", 1000000); + + db.transaction( + function(tx) { + // Create the database if it doesn't already exist + tx.executeSql('CREATE TABLE IF NOT EXISTS Greeting(salutation TEXT, salutee TEXT)'); + + // Add (another) greeting row + tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]); + + // Show all added greetings + var rs = tx.executeSql('SELECT * FROM Greeting'); + + var r = "" + for (var i = 0; i < rs.rows.length; i++) { + r += rs.rows.item(i).salutation + ", " + rs.rows.item(i).salutee + "\n" + } + text = r + } + ) + } + Component.onCompleted: findGreetings() + } +} +//![0] -- cgit v1.2.3 From fa4bb3d4e6902babfab0b1a89c9bf76d1c953252 Mon Sep 17 00:00:00 2001 From: Kavindra Palaraja Date: Sun, 8 Jan 2017 11:44:20 +0100 Subject: Mention that QVariantList is also a supported model type Also added a section with more info that asks the reader to refer to the QStringList example above. Task-number: QTBUG-47768 Change-Id: I4e99b81ac242f7df1ddc412f85c9c1b822080514 Reviewed-by: Robin Burchell --- .../doc/src/concepts/modelviewsdata/cppmodels.qdoc | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'src/quick') diff --git a/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc b/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc index a764402c2f..12a107491a 100644 --- a/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc +++ b/src/quick/doc/src/concepts/modelviewsdata/cppmodels.qdoc @@ -36,10 +36,10 @@ Models can be defined in C++ and then made available to QML. This is useful for exposing existing C++ data models or otherwise complex datasets to QML. -A C++ model class can be defined as a \l QStringList, a QObjectList or a -\l QAbstractItemModel. The first two are useful for exposing simpler datasets, -while QAbstractItemModel provides a more flexible solution for more complex -models. +A C++ model class can be defined as a \l QStringList, a \l QVariantList, a +QObjectList or a \l QAbstractItemModel. The first three are useful for exposing +simpler datasets, while QAbstractItemModel provides a more flexible solution for +more complex models. \section2 QStringList-based Model @@ -60,10 +60,20 @@ The complete source code for this example is available in \l {models/stringlistmodel}{examples/quick/models/stringlistmodel} within the Qt install directory. -\b{Note:} There is no way for the view to know that the contents of a QStringList -have changed. If the QStringList changes, it will be necessary to reset +\note There is no way for the view to know that the contents of a QStringList +have changed. If the QStringList changes, it will be necessary to reset the model by calling QQmlContext::setContextProperty() again. +\section2 QVariantList-based Model + +A model may be a single \l QVariantList, which provides the contents of the list +via the \e modelData role. + +The API works just like with \l QStringList, as shown in the previous section. + +\note There is no way for the view to know that the contents of a QVariantList +have changed. If the QVariantList changes, it will be necessary to reset +the model. \section2 QObjectList-based model -- cgit v1.2.3 From 65d3a7e15307844a9afcc8fd6cefc8c88079450c Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Thu, 26 Jan 2017 15:19:18 +0100 Subject: Doc: Fix documentation warnings src/qml/jsapi/qjsengine.cpp:524: warning: Undocumented parameter 'metaObject' in QJSEngine::newQMetaObject() src/qml/qml/qqmlengine.cpp:1023: warning: Undocumented parameter 'retCode' in QQmlEngine::exit() src/qml/doc/src/qmlfunctions.qdoc:182: warning: Undocumented parameter 'reason' in qmlRegisterUncreatableMetaObject() src/qml/qml/qqmllist.cpp:393: warning: Undocumented parameter 'at' in QQmlListProperty::QQmlListProperty() src/qml/qml/qqmllist.cpp:393: warning: Undocumented parameter 'count' in QQmlListProperty::QQmlListProperty() src/qml/qml/qqmllist.cpp:402: warning: Undocumented parameter 'at' in QQmlListProperty::QQmlListProperty() src/qml/qml/qqmllist.cpp:402: warning: Undocumented parameter 'count' in QQmlListProperty::QQmlListProperty() src/qml/qml/qqmllist.cpp:402: warning: Undocumented parameter 'append' in QQmlListProperty::QQmlListProperty() src/qml/qml/qqmllist.cpp:402: warning: Undocumented parameter 'clear' in QQmlListProperty::QQmlListProperty() src/quick/items/qquickwindow.cpp:4461: warning: No such parameter 'backend' in QQuickWindow::setSceneGraphBackend() Also do some minor language editing. Change-Id: I2e806d1a77e3c4264d709c27d2bfc4542a782716 Reviewed-by: Mitch Curtis --- src/quick/items/qquickwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index a58912e38f..5edfd619ec 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -4466,8 +4466,8 @@ QSGRendererInterface *QQuickWindow::rendererInterface() const \note The call to the function must happen before constructing the first QQuickWindow in the application. It cannot be changed afterwards. - If \a backend is invalid or an error occurs, the default backend (OpenGL or - software, depending on the Qt configuration) is used. + If the selected backend is invalid or an error occurs, the default backend + (OpenGL or software, depending on the Qt configuration) is used. \since 5.8 */ -- cgit v1.2.3 From 7e663871e63aaf601f8483f224c33cfbe5245f4e Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 30 Jan 2017 11:08:38 +0100 Subject: Quick: Check fbo msaa related extensions via QtGui GL_EXT_xxxx is not sufficient here. QOpenGLFunctions already has support for the ANGLE and some other variants of the framebuffer multisample and blit extensions, so use that instead of the manual checks. Change-Id: I2d8e0850d3b0b9a9cfd9e55aa38adad07a0ba45d Reviewed-by: Andy Nichols --- src/quick/items/context2d/qquickcontext2dtexture.cpp | 7 ++++--- src/quick/scenegraph/qsgdefaultlayer.cpp | 7 ++++--- src/quick/scenegraph/util/qsgdefaultpainternode.cpp | 6 +++--- 3 files changed, 11 insertions(+), 9 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/context2d/qquickcontext2dtexture.cpp b/src/quick/items/context2d/qquickcontext2dtexture.cpp index 38b5f054bf..d90f527486 100644 --- a/src/quick/items/context2d/qquickcontext2dtexture.cpp +++ b/src/quick/items/context2d/qquickcontext2dtexture.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #endif #include #include @@ -499,9 +500,9 @@ bool QQuickContext2DFBOTexture::doMultisampling() const static bool multisamplingSupported = false; if (!extensionsChecked) { - const QSet extensions = QOpenGLContext::currentContext()->extensions(); - multisamplingSupported = extensions.contains(QByteArrayLiteral("GL_EXT_framebuffer_multisample")) - && extensions.contains(QByteArrayLiteral("GL_EXT_framebuffer_blit")); + QOpenGLExtensions *e = static_cast(QOpenGLContext::currentContext()->functions()); + multisamplingSupported = e->hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample) + && e->hasOpenGLExtension(QOpenGLExtensions::FramebufferBlit); extensionsChecked = true; } diff --git a/src/quick/scenegraph/qsgdefaultlayer.cpp b/src/quick/scenegraph/qsgdefaultlayer.cpp index ad5b57ff83..78037a2fde 100644 --- a/src/quick/scenegraph/qsgdefaultlayer.cpp +++ b/src/quick/scenegraph/qsgdefaultlayer.cpp @@ -44,6 +44,7 @@ #include #include +#include #include @@ -320,9 +321,9 @@ void QSGDefaultLayer::grab() if (m_context->openglContext()->format().samples() <= 1) { m_multisampling = false; } else { - const QSet extensions = m_context->openglContext()->extensions(); - m_multisampling = extensions.contains(QByteArrayLiteral("GL_EXT_framebuffer_multisample")) - && extensions.contains(QByteArrayLiteral("GL_EXT_framebuffer_blit")); + QOpenGLExtensions *e = static_cast(funcs); + m_multisampling = e->hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample) + && e->hasOpenGLExtension(QOpenGLExtensions::FramebufferBlit); } m_multisamplingChecked = true; } diff --git a/src/quick/scenegraph/util/qsgdefaultpainternode.cpp b/src/quick/scenegraph/util/qsgdefaultpainternode.cpp index 389b9e0b4e..9ffd1b4b08 100644 --- a/src/quick/scenegraph/util/qsgdefaultpainternode.cpp +++ b/src/quick/scenegraph/util/qsgdefaultpainternode.cpp @@ -238,9 +238,9 @@ void QSGDefaultPainterNode::updateGeometry() void QSGDefaultPainterNode::updateRenderTarget() { if (!m_extensionsChecked) { - const QSet extensions = m_context->openglContext()->extensions(); - m_multisamplingSupported = extensions.contains(QByteArrayLiteral("GL_EXT_framebuffer_multisample")) - && extensions.contains(QByteArrayLiteral("GL_EXT_framebuffer_blit")); + QOpenGLExtensions *e = static_cast(QOpenGLContext::currentContext()->functions()); + m_multisamplingSupported = e->hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample) + && e->hasOpenGLExtension(QOpenGLExtensions::FramebufferBlit); m_extensionsChecked = true; } -- cgit v1.2.3 From 5dd9c684e0a9a36a3cde047f77b5da93907e96be Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 18 Jan 2017 09:30:47 +0100 Subject: Doc: Improve introduction to Qt Quick SceneGraph Renderer Mention that the new backends are introduced with Qt 5.8. Also remove some details that rather belong in subsections, in particular the mentioning that the Qt Quick API's originally were designed for OpenGL. It is unclear what consequences this has for the user. Limitations on backends should be rather spelled out in the respective subsections. Change-Id: I21239ea99b89b4c7771e3d79a38c6aa39007d0ea Reviewed-by: Laszlo Agocs Reviewed-by: Andy Nichols Reviewed-by: Leena Miettinen --- src/quick/doc/src/concepts/visualcanvas/adaptations.qdoc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/quick') diff --git a/src/quick/doc/src/concepts/visualcanvas/adaptations.qdoc b/src/quick/doc/src/concepts/visualcanvas/adaptations.qdoc index 9ce26e1bb8..c9ad9d8065 100644 --- a/src/quick/doc/src/concepts/visualcanvas/adaptations.qdoc +++ b/src/quick/doc/src/concepts/visualcanvas/adaptations.qdoc @@ -31,18 +31,14 @@ \section1 Scene Graph Adaptations in Qt Quick -Originally Qt Quick only had one available renderer for parsing the scene graph -and rendering the results to a render target. This renderer is now the default -OpenGL Renderer which supports rendering either using the OpenGL ES 2.0 or -OpenGL 2.0 (with framebuffer object extensions) APIs. The Qt Quick APIs have -originally been designed with the assumption that OpenGL is always available. -However, it is now possible to use other graphics API's to render Qt Quick -scenes using the scene graph APIs. +Originally Qt Quick always relied on OpenGL (OpenGL ES 2.0 or OpenGL 2.0) for parsing +the scene graph and rendering the results to a render target. From Qt 5.8 onwards +Qt Quick also supports rendering in software and with Direct3D 12. \section1 Switching between the adaptation used by the application -The default of the OpenGL, or - in Qt builds with disabled OpenGL support - the -software adaptation, can be overridden either by using an environment variable +The default rendering backend is still OpenGL, or - in Qt builds with disabled OpenGL support - +the software renderer. This can be overridden either by using an environment variable or a C++ API. The former consists of setting the \c{QT_QUICK_BACKEND} or the legacy \c{QMLSCENE_DEVICE} environment variable before launching applications. The latter is done by calling QQuickWindow::setSceneGraphBackend() early in the -- cgit v1.2.3 From 814d15c5255cf4a46419c21d5f193bb1a499f9f4 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 1 Feb 2017 12:06:26 +0100 Subject: fix memory leak in QQuickWindowPrivate::deliverTouchAsMouse MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A QTouchEvent is allocated with a reduced subset of TouchPoints for each Item to which we attempt to deliver it, and thrown away afterwards. (Ιt's not efficient to heap-allocate it, but we can't avoid doing it at all without changing behavior.) So now it's stored in a QScopedPointer. Change-Id: I48badb493610d0a715e582a2eedae95e2006eb2b Reviewed-by: Jan Arve Sæther --- src/quick/items/qquickwindow.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 5edfd619ec..e9108b7bda 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -628,8 +628,8 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve // FIXME: make this work for mouse events too and get rid of the asTouchEvent in here. Q_ASSERT(pointerEvent->asPointerTouchEvent()); - QTouchEvent *event = pointerEvent->asPointerTouchEvent()->touchEventForItem(item); - if (!event) + QScopedPointer event(pointerEvent->asPointerTouchEvent()->touchEventForItem(item)); + if (event.isNull()) return false; // For each point, check if it is accepted, if not, try the next point. @@ -646,7 +646,7 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve break; qCDebug(DBG_TOUCH_TARGET) << "TP (mouse)" << p.id() << "->" << item; - QScopedPointer mousePress(touchToMouseEvent(QEvent::MouseButtonPress, p, event, item, false)); + QScopedPointer mousePress(touchToMouseEvent(QEvent::MouseButtonPress, p, event.data(), item, false)); // Send a single press and see if that's accepted QCoreApplication::sendEvent(item, mousePress.data()); @@ -660,7 +660,7 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve pointerEventPoint->setGrabber(item); if (checkIfDoubleClicked(event->timestamp())) { - QScopedPointer mouseDoubleClick(touchToMouseEvent(QEvent::MouseButtonDblClick, p, event, item, false)); + QScopedPointer mouseDoubleClick(touchToMouseEvent(QEvent::MouseButtonDblClick, p, event.data(), item, false)); QCoreApplication::sendEvent(item, mouseDoubleClick.data()); event->setAccepted(mouseDoubleClick->isAccepted()); if (!mouseDoubleClick->isAccepted()) { @@ -677,7 +677,7 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve } else if (touchMouseDevice == device && p.id() == touchMouseId) { if (p.state() & Qt::TouchPointMoved) { if (QQuickItem *mouseGrabberItem = q->mouseGrabberItem()) { - QScopedPointer me(touchToMouseEvent(QEvent::MouseMove, p, event, mouseGrabberItem, false)); + QScopedPointer me(touchToMouseEvent(QEvent::MouseMove, p, event.data(), mouseGrabberItem, false)); QCoreApplication::sendEvent(item, me.data()); event->setAccepted(me->isAccepted()); if (me->isAccepted()) { @@ -688,7 +688,7 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve // no grabber, check if we care about mouse hover // FIXME: this should only happen once, not recursively... I'll ignore it just ignore hover now. // hover for touch??? - QScopedPointer me(touchToMouseEvent(QEvent::MouseMove, p, event, item, false)); + QScopedPointer me(touchToMouseEvent(QEvent::MouseMove, p, event.data(), item, false)); if (lastMousePosition.isNull()) lastMousePosition = me->windowPos(); QPointF last = lastMousePosition; @@ -706,7 +706,7 @@ bool QQuickWindowPrivate::deliverTouchAsMouse(QQuickItem *item, QQuickPointerEve } else if (p.state() & Qt::TouchPointReleased) { // currently handled point was released if (QQuickItem *mouseGrabberItem = q->mouseGrabberItem()) { - QScopedPointer me(touchToMouseEvent(QEvent::MouseButtonRelease, p, event, mouseGrabberItem, false)); + QScopedPointer me(touchToMouseEvent(QEvent::MouseButtonRelease, p, event.data(), mouseGrabberItem, false)); QCoreApplication::sendEvent(item, me.data()); if (item->acceptHoverEvents() && p.screenPos() != QGuiApplicationPrivate::lastCursorPosition) { -- cgit v1.2.3 From 29a278ed0222c70b4ac4d00ccf44b4cf0d66360c Mon Sep 17 00:00:00 2001 From: Joni Poikelin Date: Wed, 1 Feb 2017 08:56:34 +0200 Subject: Fix regression with UniformAnimator target property validation Task-number: QTBUG-58549 Change-Id: Iaa2a9cd8b86e8c2bb7e20b99fabad99d0bd51799 Reviewed-by: Laszlo Agocs --- src/quick/items/qquickshadereffect.cpp | 5 +++++ src/quick/items/qquickshadereffect_p.h | 2 ++ src/quick/util/qquickanimatorjob.cpp | 4 +++- 3 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp index 7926607e33..436d7b33ce 100644 --- a/src/quick/items/qquickshadereffect.cpp +++ b/src/quick/items/qquickshadereffect.cpp @@ -873,4 +873,9 @@ void QQuickShaderEffectPrivate::updatePolish() q->m_impl->maybeUpdateShaders(); } +bool QQuickShaderEffect::isOpenGLShaderEffect() const +{ + return m_glImpl != Q_NULLPTR; +} + QT_END_NAMESPACE diff --git a/src/quick/items/qquickshadereffect_p.h b/src/quick/items/qquickshadereffect_p.h index 7885daffbb..d269dc5e50 100644 --- a/src/quick/items/qquickshadereffect_p.h +++ b/src/quick/items/qquickshadereffect_p.h @@ -117,6 +117,8 @@ public: bool isComponentComplete() const; QString parseLog(); + bool isOpenGLShaderEffect() const; + Q_SIGNALS: void fragmentShaderChanged(); void vertexShaderChanged(); diff --git a/src/quick/util/qquickanimatorjob.cpp b/src/quick/util/qquickanimatorjob.cpp index 1176cf1ff7..33569c4784 100644 --- a/src/quick/util/qquickanimatorjob.cpp +++ b/src/quick/util/qquickanimatorjob.cpp @@ -46,6 +46,7 @@ #if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) # include # include +# include #endif #include @@ -558,7 +559,8 @@ QQuickUniformAnimatorJob::QQuickUniformAnimatorJob() void QQuickUniformAnimatorJob::setTarget(QQuickItem *target) { - if (qobject_cast(target) != 0) + QQuickShaderEffect* effect = qobject_cast(target); + if (effect && effect->isOpenGLShaderEffect()) m_target = target; } -- cgit v1.2.3 From bf19d3294f83fc061eddc719bc608bb19e500a5a Mon Sep 17 00:00:00 2001 From: Oleg Yadrov Date: Tue, 24 Jan 2017 16:39:28 -0800 Subject: MouseArea: fix bug preventing dragging from start MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The same bounded dragPos values were used for - moving the target item to new position; and - if dragging didn’t start yet, determining whether cursor moved over the threshold distance. It is right for moving the target item, but in the second case it led to that dragging did not start if the distance between item's left border and minimumX (right border and maximumX, top border and minimumY, bottom border and maximumY accordingly) was less than drag.threshold. Task-number: QTBUG-58347 Change-Id: If61a98bf734739323ef19dee6709560b754b2456 Reviewed-by: Andrew den Exter --- src/quick/items/qquickmousearea.cpp | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp index 3160495332..2fbca26408 100644 --- a/src/quick/items/qquickmousearea.cpp +++ b/src/quick/items/qquickmousearea.cpp @@ -734,23 +734,34 @@ void QQuickMouseArea::mouseMoveEvent(QMouseEvent *event) bool dragY = drag()->axis() & QQuickDrag::YAxis; QPointF dragPos = d->drag->target()->position(); + QPointF boundedDragPos = dragPos; if (dragX) { - dragPos.setX(qBound( + dragPos.setX(startPos.x() + curLocalPos.x() - startLocalPos.x()); + boundedDragPos.setX(qBound( d->drag->xmin(), - startPos.x() + curLocalPos.x() - startLocalPos.x(), + dragPos.x(), d->drag->xmax())); } if (dragY) { - dragPos.setY(qBound( + dragPos.setY(startPos.y() + curLocalPos.y() - startLocalPos.y()); + boundedDragPos.setY(qBound( d->drag->ymin(), - startPos.y() + curLocalPos.y() - startLocalPos.y(), + dragPos.y(), d->drag->ymax())); } + + QPointF targetPos = d->drag->target()->position(); + if (d->drag->active()) - d->drag->target()->setPosition(dragPos); + d->drag->target()->setPosition(boundedDragPos); + + bool dragOverThresholdX = QQuickWindowPrivate::dragOverThreshold(dragPos.x() - startPos.x(), + Qt::XAxis, event, d->drag->threshold()); + bool dragOverThresholdY = QQuickWindowPrivate::dragOverThreshold(dragPos.y() - startPos.y(), + Qt::YAxis, event, d->drag->threshold()); - if (!d->overThreshold && (QQuickWindowPrivate::dragOverThreshold(dragPos.x() - startPos.x(), Qt::XAxis, event, d->drag->threshold()) - || QQuickWindowPrivate::dragOverThreshold(dragPos.y() - startPos.y(), Qt::YAxis, event, d->drag->threshold()))) + if (!d->overThreshold && (((targetPos.x() != boundedDragPos.x()) && dragOverThresholdX) || + ((targetPos.y() != boundedDragPos.y()) && dragOverThresholdY))) { d->overThreshold = true; if (d->drag->smoothed()) -- cgit v1.2.3 From be96a21a3706d46f00a1f8609fcd19ee5760c121 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Sun, 5 Feb 2017 10:33:43 +0100 Subject: Implement QAccessibleQuickWindow::focusChild MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When we post a focus change notification, VoiceOver verifies what the application thinks is focused. Without this function, when moving the keyboard focus (e.g. by pressing tab) the VO focus will not follow. [ChangeLog][QtQuick][Accessibility] Fixed focus handling so that keyboard and VoiceOver's virtual focus are in sync (QTBUG-58340). Task-number: QTBUG-58340 Change-Id: I7d4871c13b36c3ab9241614ca8a06452461e3cd1 Reviewed-by: Timur Pocheptsov Reviewed-by: Jan Arve Sæther --- src/quick/accessible/qaccessiblequickview.cpp | 8 ++++++++ src/quick/accessible/qaccessiblequickview_p.h | 1 + 2 files changed, 9 insertions(+) (limited to 'src/quick') diff --git a/src/quick/accessible/qaccessiblequickview.cpp b/src/quick/accessible/qaccessiblequickview.cpp index 222690e4f2..b3d1b6fc0f 100644 --- a/src/quick/accessible/qaccessiblequickview.cpp +++ b/src/quick/accessible/qaccessiblequickview.cpp @@ -81,6 +81,14 @@ QAccessibleInterface *QAccessibleQuickWindow::child(int index) const return 0; } +QAccessibleInterface *QAccessibleQuickWindow::focusChild() const +{ + QObject *focusObject = window()->focusObject(); + if (focusObject) + return QAccessible::queryAccessibleInterface(focusObject); + return nullptr; +} + QAccessible::Role QAccessibleQuickWindow::role() const { return QAccessible::Window; // FIXME diff --git a/src/quick/accessible/qaccessiblequickview_p.h b/src/quick/accessible/qaccessiblequickview_p.h index 007a6fd990..fcd0bec85e 100644 --- a/src/quick/accessible/qaccessiblequickview_p.h +++ b/src/quick/accessible/qaccessiblequickview_p.h @@ -65,6 +65,7 @@ public: QAccessibleInterface *parent() const; QAccessibleInterface *child(int index) const; + QAccessibleInterface *focusChild() const override; QAccessible::Role role() const; QAccessible::State state() const; -- cgit v1.2.3 From ce15c3af57858b9b8b0621398121691b20c6f638 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 25 Jan 2017 15:49:34 +0100 Subject: QQuickMouseArea: only start pressAndHoldTimer for accepted events Most likely because of changes done to mouse event handling in 5.8, a QQuickMouseArea can now get a mousePressEvent call without a subsequent mouseReleaseEvent call if the press event was rejected. A regression seen from this is that QQuickMouseArea starts a pressAndHold timer upon receiving mouse press, which will never be 'cancelled' since the following mouse release is sent elsewhere. As a result, TextArea in QtQuickControls will e.g receive a pressAndHold signal each time the user touches the control, which again will cause weird behavior like selecting words and messing with focus on iOS. This patch will instead change this so that we only start the pressAndHold timer if QQuickMouseArea accepts the mouse press event. Change-Id: I43e2f02e2b4f75e7b6761e326e3fec54ea97683a Reviewed-by: Shawn Rutledge Reviewed-by: Frederik Gladhorn --- src/quick/items/qquickmousearea.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp index 2fbca26408..4dcefc700d 100644 --- a/src/quick/items/qquickmousearea.cpp +++ b/src/quick/items/qquickmousearea.cpp @@ -685,9 +685,10 @@ void QQuickMouseArea::mousePressEvent(QMouseEvent *event) #endif setHovered(true); d->startScene = event->windowPos(); - d->pressAndHoldTimer.start(QGuiApplication::styleHints()->mousePressAndHoldInterval(), this); setKeepMouseGrab(d->stealMouse); event->setAccepted(setPressed(event->button(), true, event->source())); + if (event->isAccepted()) + d->pressAndHoldTimer.start(QGuiApplication::styleHints()->mousePressAndHoldInterval(), this); } } -- cgit v1.2.3 From 6cfeabe92db25a10812a657f7f4fdadfb505204d Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 26 Jan 2017 16:44:55 +0100 Subject: Flickable: handle child mouse ungrab when hidden or disabled If Flickable got hidden while a child had mouse grab, it ignored the mouse ungrab event of the child mouse grabber, and got therefore stuck in pressed state. Consequently, item view transitions were not executed since the item view though it was being pressed. Task-number: QTBUG-58453 Change-Id: I76f9f3190c3a95a2fafdce036d69ea1dc8127434 Reviewed-by: Qt CI Bot Reviewed-by: Frederik Gladhorn --- src/quick/items/qquickflickable.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index 1e778306e0..537367b3a3 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -2307,8 +2307,11 @@ bool QQuickFlickable::filterMouseEvent(QQuickItem *receiver, QMouseEvent *event) bool QQuickFlickable::childMouseEventFilter(QQuickItem *i, QEvent *e) { Q_D(QQuickFlickable); - if (!isVisible() || !isEnabled() || !isInteractive()) + if (!isVisible() || !isEnabled() || !isInteractive()) { + d->cancelInteraction(); return QQuickItem::childMouseEventFilter(i, e); + } + switch (e->type()) { case QEvent::MouseButtonPress: case QEvent::MouseMove: -- cgit v1.2.3 From ade0ed7fa9ad06a1dc1312e7abad8baf20f7b756 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Mon, 6 Feb 2017 09:37:13 +0100 Subject: Improve QQuickAsyncImageProvider example Also link it from more places Change-Id: Ib5fbf89f4a039f885e918d57ee477e9788049d8d Reviewed-by: Robin Burchell --- src/quick/util/qquickimageprovider.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/quick') diff --git a/src/quick/util/qquickimageprovider.cpp b/src/quick/util/qquickimageprovider.cpp index 0c245d2b23..d2a8a5097c 100644 --- a/src/quick/util/qquickimageprovider.cpp +++ b/src/quick/util/qquickimageprovider.cpp @@ -158,6 +158,8 @@ QQuickTextureFactory *QQuickTextureFactory::textureFactoryForImage(const QImage If you are using QRunnable as base for your QQuickImageResponse ensure automatic deletion is disabled. + See the \l {imageresponseprovider}{Image Response Provider Example} for a complete implementation. + \sa QQuickImageProvider */ @@ -472,6 +474,8 @@ QQuickTextureFactory *QQuickImageProvider::requestTexture(const QString &id, QSi \inmodule QtQuick \brief The QQuickAsyncImageProvider class provides an interface for for asynchronous control of QML image requests. + See the \l {imageresponseprovider}{Image Response Provider Example} for a complete implementation. + \sa QQuickImageProvider */ QQuickAsyncImageProvider::QQuickAsyncImageProvider() -- cgit v1.2.3 From aaa8b16bbda4e18c6afce50d91d81bc5ee862f64 Mon Sep 17 00:00:00 2001 From: Frederik Schwarzer Date: Mon, 9 Jan 2017 16:42:59 +0100 Subject: Minor wording issues and typo fixes in docs Change-Id: I60af106607dca02fafc1df2d21d16053d64742b6 Reviewed-by: Leena Miettinen --- src/quick/doc/src/concepts/positioning/topic.qdoc | 2 +- src/quick/doc/src/concepts/visualcanvas/visualparent.qdoc | 2 +- src/quick/items/qquickitem.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/quick') diff --git a/src/quick/doc/src/concepts/positioning/topic.qdoc b/src/quick/doc/src/concepts/positioning/topic.qdoc index 92113ece54..b28acd1f89 100644 --- a/src/quick/doc/src/concepts/positioning/topic.qdoc +++ b/src/quick/doc/src/concepts/positioning/topic.qdoc @@ -112,7 +112,7 @@ them, and where possible, pristine Anchor layouts should be preferred. \section1 Anchors -Anchors allows an item to be placed either adjacent to or inside of another, +Anchors allow an item to be placed either adjacent to or inside of another, by attaching one or more of the item's anchor-points (boundaries) to an anchor-point of the other. These anchors will remain even if the dimensions or location of one of the items changes, allowing for highly dynamic diff --git a/src/quick/doc/src/concepts/visualcanvas/visualparent.qdoc b/src/quick/doc/src/concepts/visualcanvas/visualparent.qdoc index fd5bf51307..f971043b58 100644 --- a/src/quick/doc/src/concepts/visualcanvas/visualparent.qdoc +++ b/src/quick/doc/src/concepts/visualcanvas/visualparent.qdoc @@ -125,7 +125,7 @@ the blue rectangle and beneath any of the blue rectangle's children. Stacking order can be influenced with the \l Item::z property. Z values below 0 will stack below the parent, and if z values are assigned then siblings will stack in z-order (with creation order used to break ties). Z values only affect -stacking compared to siblings and the parent item. If you have an item who is obscured by a subtree rooted above its +stacking compared to siblings and the parent item. If you have an item which is obscured by a subtree rooted above its parent item, no z value on that item will increase its stacking order to stack above that subtree. To stack that item above the other subtree you'll have to alter z values farther up in the hierarchy, or re-arrange the visual item hierarchy. diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index cbfd776941..98dee17291 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -3751,10 +3751,10 @@ QQuickItem::UpdatePaintNodeData::UpdatePaintNodeData() /*! This function is called when an item should release graphics - resources which are not already managed by the nodes returend from + resources which are not already managed by the nodes returned from QQuickItem::updatePaintNode(). - This happens when the item is about to be removed from window it + This happens when the item is about to be removed from the window it was previously rendering to. The item is guaranteed to have a \l {QQuickItem::window()}{window} when the function is called. -- cgit v1.2.3 From 6a2cf39758249d790f642d677c7bc7cad2a70eae Mon Sep 17 00:00:00 2001 From: Frederik Schwarzer Date: Thu, 5 Jan 2017 17:15:48 +0100 Subject: Finish sentence properly in documentation Change-Id: I9bdae64a2d1b38c0b3f1b7f4cf460b3466d45dad Reviewed-by: Leena Miettinen --- src/quick/doc/src/concepts/layouts/qtquicklayouts-overview.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/quick') diff --git a/src/quick/doc/src/concepts/layouts/qtquicklayouts-overview.qdoc b/src/quick/doc/src/concepts/layouts/qtquicklayouts-overview.qdoc index 20a6d131f5..e5834eb5c8 100644 --- a/src/quick/doc/src/concepts/layouts/qtquicklayouts-overview.qdoc +++ b/src/quick/doc/src/concepts/layouts/qtquicklayouts-overview.qdoc @@ -64,7 +64,7 @@ In addition to the above features, GridLayout adds these features: \list \li \l{Layout::row}{Grid coordinates} can be specified with the \l{Layout::row}{Layout.row} and - \l{Layout::column}{Layout.column}. + \l{Layout::column}{Layout.column} properties. \li \l{GridLayout::flow}{Automatic grid coordinates} used together with the \l{GridLayout::flow}{flow}, \l{GridLayout::rows}{rows}, and \l{GridLayout::columns}{columns} properties. -- cgit v1.2.3 From 7454ad3ce1895eae7409df28752739cc912abcac Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Wed, 15 Feb 2017 12:50:38 +0100 Subject: Shaders: Fix crash when disconnecting shaders from item properties The disconnect was done with a signal index local to the item, instead of 'global' to the item and all its parents. The index also had to be a method index, not a signal index. Together this resulted in a failing disconnect, which would keep SlotObjects alive with outdated data. Any subsequent use would result in a crash. Task-number: QTBUG-58336 Change-Id: I26b1868b2f8c61a4ffab1c72c85178632ca87599 Reviewed-by: Simon Hausmann --- src/quick/items/qquickopenglshadereffect.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickopenglshadereffect.cpp b/src/quick/items/qquickopenglshadereffect.cpp index b974641cca..c7b851d33e 100644 --- a/src/quick/items/qquickopenglshadereffect.cpp +++ b/src/quick/items/qquickopenglshadereffect.cpp @@ -256,10 +256,14 @@ void QQuickOpenGLShaderEffectCommon::connectPropertySignals(QQuickItem *item, qWarning("QQuickOpenGLShaderEffect: property '%s' does not have notification method!", d.name.constData()); } else { auto *mapper = signalMappers[shaderType].at(i); - mapper->setSignalIndex(pd->notifyIndex()); + mapper->setSignalIndex(itemMetaObject->property(d.propertyIndex).notifySignal().methodIndex()); Q_ASSERT(item->metaObject() == itemMetaObject); - QObjectPrivate::connectImpl(item, mapper->signalIndex(), item, nullptr, mapper, - Qt::AutoConnection, nullptr, itemMetaObject); + bool ok = QObjectPrivate::connectImpl(item, pd->notifyIndex(), item, nullptr, mapper, + Qt::AutoConnection, nullptr, itemMetaObject); + if (!ok) + qWarning() << "Failed to connect to property" << itemMetaObject->property(d.propertyIndex).name() + << "(" << d.propertyIndex << ", signal index" << pd->notifyIndex() + << ") of item" << item; } } else { // If the source is set via a dynamic property, like the layer is, then we need this -- cgit v1.2.3 From c934c5a2d2b32e7657ca1b79b1a70f96e1019f8a Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Mon, 20 Feb 2017 13:39:03 +0100 Subject: Fix build without features.cursor Change-Id: I20821e5fd4d2154aa49ef90015d512dd09c134f3 Reviewed-by: Simon Hausmann --- src/quick/items/qquickitem.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 98dee17291..021ca9b64b 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -2855,14 +2855,15 @@ void QQuickItemPrivate::addChild(QQuickItem *child) childItems.append(child); -#if QT_CONFIG(cursor) QQuickItemPrivate *childPrivate = QQuickItemPrivate::get(child); +#if QT_CONFIG(cursor) // if the added child has a cursor and we do not currently have any children // with cursors, bubble the notification up if (childPrivate->subtreeCursorEnabled && !subtreeCursorEnabled) setHasCursorInChild(true); #endif + if (childPrivate->subtreeHoverEnabled && !subtreeHoverEnabled) setHasHoverInChild(true); @@ -2883,13 +2884,14 @@ void QQuickItemPrivate::removeChild(QQuickItem *child) childItems.removeOne(child); Q_ASSERT(!childItems.contains(child)); -#if QT_CONFIG(cursor) QQuickItemPrivate *childPrivate = QQuickItemPrivate::get(child); +#if QT_CONFIG(cursor) // turn it off, if nothing else is using it if (childPrivate->subtreeCursorEnabled && subtreeCursorEnabled) setHasCursorInChild(false); #endif + if (childPrivate->subtreeHoverEnabled && subtreeHoverEnabled) setHasHoverInChild(false); -- cgit v1.2.3 From 4f3cadfe6c966ab8b7c50bc69343589589f7291c Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Sat, 25 Feb 2017 13:49:36 +0100 Subject: Fix build for -no-feature-quick-shadereffect Change-Id: I334603209818a8030ddb5b5b316cab596c328bf1 Reviewed-by: Lars Knoll --- src/quick/items/context2d/qquickcanvasitem.cpp | 1 + src/quick/items/context2d/qquickcontext2d.cpp | 2 ++ src/quick/items/qquickpainteditem_p.h | 1 + 3 files changed, 4 insertions(+) (limited to 'src/quick') diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp index 28e9173bf7..9dd72a40e3 100644 --- a/src/quick/items/context2d/qquickcanvasitem.cpp +++ b/src/quick/items/context2d/qquickcanvasitem.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include #include diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index bcaedd67b4..05bb3681d7 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -42,7 +42,9 @@ #include "qquickcanvasitem_p.h" #include #include +#if QT_CONFIG(quick_shadereffect) #include +#endif #include #include diff --git a/src/quick/items/qquickpainteditem_p.h b/src/quick/items/qquickpainteditem_p.h index 742e786335..3d2ec631fa 100644 --- a/src/quick/items/qquickpainteditem_p.h +++ b/src/quick/items/qquickpainteditem_p.h @@ -51,6 +51,7 @@ // We mean it. // +#include "qquickpainteditem.h" #include "qquickitem_p.h" #include -- cgit v1.2.3 From 5cd4c2ced4b153f365ececf3a7c0a4536fed9fac Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Fri, 24 Feb 2017 16:43:51 +0100 Subject: Fix build for -no-feature-quick-path Change-Id: Id57c9bc4421fc252ab02e2a0cfe00d08aef0176d Reviewed-by: Simon Hausmann Reviewed-by: Oswald Buddenhagen Reviewed-by: Ulf Hermann Reviewed-by: Laszlo Agocs --- src/quick/configure.json | 1 + 1 file changed, 1 insertion(+) (limited to 'src/quick') diff --git a/src/quick/configure.json b/src/quick/configure.json index 4ed11e8318..e06cae8641 100644 --- a/src/quick/configure.json +++ b/src/quick/configure.json @@ -51,6 +51,7 @@ "quick-canvas": { "label": "Canvas item", "purpose": "Provides the Qt Quick Canvas Item", + "condition": "features.quick-path", "output": [ "privateFeature" ] -- cgit v1.2.3 From 16389a1f247f14965ed0286e4fdab6bc2b1621bc Mon Sep 17 00:00:00 2001 From: Michael Dippold Date: Wed, 22 Feb 2017 20:58:16 -0800 Subject: Ensure mouse ungrab is called when touch is also true Currently when removeGrabber is called with both mouse true and touch true, the touch logic blocks the ungrab mouse from being triggered as q->mouseGrabberItem() is then null. Task-number: QTBUG-57797 Task-number: QTBUG-59098 Change-Id: Icb4d00cf876c9fd0930b50f927f68dfba172dc29 Reviewed-by: Shawn Rutledge --- src/quick/items/qquickwindow.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index f90384b3b6..4dc8cd0a37 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -811,6 +811,10 @@ void QQuickWindowPrivate::grabTouchPoints(QQuickItem *grabber, const QVectormouseGrabberItem() == grabber) { + qCDebug(DBG_MOUSE_TARGET) << "removeGrabber" << q->mouseGrabberItem() << "-> null"; + setMouseGrabber(nullptr); + } if (Q_LIKELY(touch)) { const auto touchDevices = QQuickPointerDevice::touchDevices(); for (auto device : touchDevices) { @@ -824,10 +828,6 @@ void QQuickWindowPrivate::removeGrabber(QQuickItem *grabber, bool mouse, bool to } } } - if (Q_LIKELY(mouse) && q->mouseGrabberItem() == grabber) { - qCDebug(DBG_MOUSE_TARGET) << "removeGrabber" << q->mouseGrabberItem() << "-> null"; - setMouseGrabber(nullptr); - } } /*! -- cgit v1.2.3 From 55fec6b2db17db43fc7d03ef5d482cc67b16543b Mon Sep 17 00:00:00 2001 From: Andy Nichols Date: Mon, 27 Feb 2017 16:45:44 +0100 Subject: Software: Flush whole window on Expose event The software render loop updates the window content via either an expose event or an update event. An expose event should always flush the entire backingstore, but previously only the newly updated region would be flushed. The first time a window is exposed this is fine because the whole scene would be rendered, but when hidden and shown again, the software renderer might show that nothing has changed, and nothing would be flushed. A new flag has been added that forces a full window flush for an expose event. Task-number: QTBUG-59177 Change-Id: I3700bbcc76bc97be4eb0c822e2945ebef339f11a Reviewed-by: Laszlo Agocs --- .../scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp | 9 ++++++--- .../scenegraph/adaptations/software/qsgsoftwarerenderloop_p.h | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src/quick') diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp index 6856d34616..b3b8274a73 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp @@ -101,7 +101,7 @@ void QSGSoftwareRenderLoop::windowDestroyed(QQuickWindow *window) } } -void QSGSoftwareRenderLoop::renderWindow(QQuickWindow *window) +void QSGSoftwareRenderLoop::renderWindow(QQuickWindow *window, bool isNewExpose) { QQuickWindowPrivate *cd = QQuickWindowPrivate::get(window); if (!m_windows.contains(window)) @@ -174,7 +174,10 @@ void QSGSoftwareRenderLoop::renderWindow(QQuickWindow *window) if (alsoSwap && window->isVisible()) { //Flush backingstore to window - m_backingStores[window]->flush(softwareRenderer->flushRegion()); + if (!isNewExpose) + m_backingStores[window]->flush(softwareRenderer->flushRegion()); + else + m_backingStores[window]->flush(QRegion(QRect(QPoint(0,0), window->size()))); cd->fireFrameSwapped(); } @@ -206,7 +209,7 @@ void QSGSoftwareRenderLoop::exposureChanged(QQuickWindow *window) { if (window->isExposed()) { m_windows[window].updatePending = true; - renderWindow(window); + renderWindow(window, true); } } diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop_p.h b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop_p.h index 02dcf4eefa..c724d18298 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop_p.h +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop_p.h @@ -69,7 +69,7 @@ public: void windowDestroyed(QQuickWindow *window) override; - void renderWindow(QQuickWindow *window); + void renderWindow(QQuickWindow *window, bool isNewExpose = false); void exposureChanged(QQuickWindow *window) override; QImage grab(QQuickWindow *window) override; -- cgit v1.2.3 From 015dff255ff0f40c553b1dee43c6cff013df64eb Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Wed, 1 Mar 2017 14:12:57 +0100 Subject: Privately export QQuickPositionerAttached This was missed in 2556bfda. Change-Id: I088d3e36a64b4459d2376ae38796e743c783260d Reviewed-by: J-P Nurmi --- src/quick/items/qquickpositioners_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickpositioners_p.h b/src/quick/items/qquickpositioners_p.h index 8dc0d90a2f..cfe163b4c1 100644 --- a/src/quick/items/qquickpositioners_p.h +++ b/src/quick/items/qquickpositioners_p.h @@ -67,7 +67,7 @@ QT_BEGIN_NAMESPACE class QQuickBasePositionerPrivate; -class QQuickPositionerAttached : public QObject +class Q_QUICK_PRIVATE_EXPORT QQuickPositionerAttached : public QObject { Q_OBJECT -- cgit v1.2.3 From 71a2dbed467be0041b6793dda868655b2632e830 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Thu, 5 Jan 2017 16:16:43 +0100 Subject: When stealing a touchpoint as synth. mouse, ungrab touch If you use MultiPointTouchArea to make a button component, or if you do something similar by subclassing QQuickItem and handling touch events, and you place such a component inside a Flickable, when the user presses on the button and then drags far enough that the Flickable steals the grab, the MPTA or custom item did not receive the touchUngrabEvent() callback. Now it does, so now the button will go back to released state as a result of having the grab stolen. The situation here is special in that it's the only place where a touch event is transformed to be treated as mouse in the future, usually it's either treated as touch or mouse from the start. When this happens, it's not enough to call setMouseGrabber because that doesn't send touch cancel to the previous grabber. Instead we need to explicitly call touchUngrabEvent to notify the touch handling item. The explicit setting of the grabber which was there previously is not needed, since grabMouse will update the grab based on touchMouseId. tst_QQuickMultiPointTouchArea::inFlickable2 was already testing the pressed state of the touchpoint when the grab is stolen, but it was changed in 468626e99a90d6ac21cb311cde05c658ccb3b781; now that can be restored, and we can also un-blacklist inFlickable, which was deemed unstable in 6d163779711d4601931ae0f82910794fb2498136 [ChangeLog][QtQuick] MultiPointTouchArea, and any custom Item, will now properly receive touchUngrabEvent() when the touch grab is stolen by a filtering parent Item, such as a Flickable. Task-number: QTBUG-57910 Change-Id: I4e1b23ed099f01e7eca2e8a0e7ab4c652ef00cfa Reviewed-by: Frederik Gladhorn Reviewed-by: Shawn Rutledge --- src/quick/items/qquickwindow.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 4dc8cd0a37..340683f6c3 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -2593,9 +2593,14 @@ bool QQuickWindowPrivate::sendFilteredTouchEvent(QQuickItem *target, QQuickItem qCDebug(DBG_TOUCH) << " - second chance intercepted on childMouseEventFilter by " << target; if (t != QEvent::MouseButtonRelease) { qCDebug(DBG_TOUCH_TARGET) << "TP" << tp.id() << "->" << target; - touchMouseId = tp.id(); touchMouseDevice = event->device(); - touchMouseDevice->pointerEvent()->pointById(tp.id())->setGrabber(target); + if (touchMouseId == -1) { + // the point was grabbed as a pure touch point before, now it will be treated as mouse + // but the old receiver still needs to be informed + if (auto oldGrabber = touchMouseDevice->pointerEvent()->pointById(tp.id())->grabber()) + oldGrabber->touchUngrabEvent(); + } + touchMouseId = tp.id(); target->grabMouse(); } filtered = true; -- cgit v1.2.3 From 05a88efb266ec3b7b16d6db0d971c21ae7f45c9d Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 27 Feb 2017 15:17:35 +0100 Subject: QQuickAnimatorProxyJob: make sure to stop when detached from a window Qt Quick Controls 2 StackView auto tests exposed an issue that animator proxy jobs keep ticking after being unassociated from a window. Change-Id: Ib9b3a0e02ac4cc3f3e98ddf05c8b01f0bbd614d3 Reviewed-by: Gunnar Sletta --- src/quick/util/qquickanimatorjob.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/quick') diff --git a/src/quick/util/qquickanimatorjob.cpp b/src/quick/util/qquickanimatorjob.cpp index 4aacb09c97..dced8b49a9 100644 --- a/src/quick/util/qquickanimatorjob.cpp +++ b/src/quick/util/qquickanimatorjob.cpp @@ -140,6 +140,11 @@ QObject *QQuickAnimatorProxyJob::findAnimationContext(QQuickAbstractAnimation *a void QQuickAnimatorProxyJob::updateCurrentTime(int) { + // A proxy which is being ticked should be associated with a window, (see + // setWindow() below). If we get here when there is no more controller we + // have a problem. + Q_ASSERT(m_controller); + // We do a simple check here to see if the animator has run and stopped on // the render thread. isPendingStart() will perform a check against jobs // that have been scheduled for start, but that will not yet have entered @@ -167,9 +172,9 @@ void QQuickAnimatorProxyJob::updateState(QAbstractAnimationJob::State newState, } } else if (newState == Stopped) { - syncBackCurrentValues(); m_internalState = State_Stopped; if (m_controller) { + syncBackCurrentValues(); m_controller->cancel(m_job); } } @@ -193,6 +198,7 @@ void QQuickAnimatorProxyJob::setWindow(QQuickWindow *window) if (m_job && m_controller) m_controller->cancel(m_job); m_controller = nullptr; + stop(); } else if (!m_controller && m_job) { m_controller = QQuickWindowPrivate::get(window)->animationController; -- cgit v1.2.3 From 7fe0d1a06830518e8ce6752e45a0a01b1b97fa73 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Tue, 7 Mar 2017 08:58:10 +0100 Subject: Revert "QQuickAnimatorProxyJob: make sure to stop when detached from a window" This reverts commit 05a88efb266ec3b7b16d6db0d971c21ae7f45c9d. It caused some test failures in qtquickcontrols and qtquickcontrols2. Task-number: QTBUG-59326 Task-number: QTBUG-59327 Change-Id: I9a26a4518bf7c106372916761aae69ba65f6df9e Reviewed-by: J-P Nurmi --- src/quick/util/qquickanimatorjob.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src/quick') diff --git a/src/quick/util/qquickanimatorjob.cpp b/src/quick/util/qquickanimatorjob.cpp index dced8b49a9..4aacb09c97 100644 --- a/src/quick/util/qquickanimatorjob.cpp +++ b/src/quick/util/qquickanimatorjob.cpp @@ -140,11 +140,6 @@ QObject *QQuickAnimatorProxyJob::findAnimationContext(QQuickAbstractAnimation *a void QQuickAnimatorProxyJob::updateCurrentTime(int) { - // A proxy which is being ticked should be associated with a window, (see - // setWindow() below). If we get here when there is no more controller we - // have a problem. - Q_ASSERT(m_controller); - // We do a simple check here to see if the animator has run and stopped on // the render thread. isPendingStart() will perform a check against jobs // that have been scheduled for start, but that will not yet have entered @@ -172,9 +167,9 @@ void QQuickAnimatorProxyJob::updateState(QAbstractAnimationJob::State newState, } } else if (newState == Stopped) { + syncBackCurrentValues(); m_internalState = State_Stopped; if (m_controller) { - syncBackCurrentValues(); m_controller->cancel(m_job); } } @@ -198,7 +193,6 @@ void QQuickAnimatorProxyJob::setWindow(QQuickWindow *window) if (m_job && m_controller) m_controller->cancel(m_job); m_controller = nullptr; - stop(); } else if (!m_controller && m_job) { m_controller = QQuickWindowPrivate::get(window)->animationController; -- cgit v1.2.3 From 25555238cde42daf5a73669234e737c90ef9ea5f Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 21 Jan 2016 11:40:18 +0100 Subject: Fix copied QDragMoveEvent drop action to propagate to original event Trying to set the drop action and the accepted state in a overridden dragMoveEvent handler, does not get propagated to the original QDragMoveEvent, because the event passed to the handler is a copy. This does not allow canceling the drop action in the move handler, or change the proposed action to a different one. Changing these values in the move handler is important to allow modifying the cursor when moving / hovering above a possible drop item, depending on user conditions. Fix consists in copying the drop action and accepted values to the original event, as well as removing the hard-coded setAccepted (true) call. Task-number: QTBUG-58260 Change-Id: I7a4bd4e68ee1023a36a63d3e835c282077e4187c Reviewed-by: Shawn Rutledge --- src/quick/items/qquickwindow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 340683f6c3..e6245f90f3 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -2397,7 +2397,6 @@ void QQuickWindowPrivate::deliverDragEvent(QQuickDragGrabber *grabber, QEvent *e } else for (; grabItem != grabber->end(); grabItem = grabber->release(grabItem)) { QDragMoveEvent *moveEvent = static_cast(event); if (deliverDragEvent(grabber, **grabItem, moveEvent)) { - moveEvent->setAccepted(true); for (++grabItem; grabItem != grabber->end();) { QPointF p = (**grabItem)->mapFromScene(moveEvent->pos()); if ((**grabItem)->contains(p)) { @@ -2472,7 +2471,10 @@ bool QQuickWindowPrivate::deliverDragEvent(QQuickDragGrabber *grabber, QQuickIte event->keyboardModifiers(), event->type()); QQuickDropEventEx::copyActions(&translatedEvent, *event); + translatedEvent.setAccepted(event->isAccepted()); QCoreApplication::sendEvent(item, &translatedEvent); + event->setAccepted(translatedEvent.isAccepted()); + event->setDropAction(translatedEvent.dropAction()); if (event->type() == QEvent::DragEnter) { if (translatedEvent.isAccepted()) { grabber->grab(item); -- cgit v1.2.3 From 42e098fa0ad318a6b6fafadbadce21b974c29c4d Mon Sep 17 00:00:00 2001 From: Oleg Yadrov Date: Mon, 27 Feb 2017 13:15:52 -0800 Subject: QtQuick scene graph: fix text native rendering Only 65536 vertices (65536 / 4 = 16384 characters) can be drawn in one draw call. This is why QSGDistanceFieldGlyphNode (renderType: Text.QtRendering) creates subnodes if number of characters exceeds that limit. QSGDefaultGlyphNode (renderType: Text.NativeRendering) missed that logic for some reason. Task-number: QTBUG-58852 Change-Id: I88b3fcdb8e56bc92622d3347cd638634d43df138 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/quick/scenegraph/qsgdefaultglyphnode.cpp | 128 +++++++++++++++++++++++++++ src/quick/scenegraph/qsgdefaultglyphnode_p.h | 23 +++++ 2 files changed, 151 insertions(+) (limited to 'src/quick') diff --git a/src/quick/scenegraph/qsgdefaultglyphnode.cpp b/src/quick/scenegraph/qsgdefaultglyphnode.cpp index b856d99bc1..0d42102f36 100644 --- a/src/quick/scenegraph/qsgdefaultglyphnode.cpp +++ b/src/quick/scenegraph/qsgdefaultglyphnode.cpp @@ -42,11 +42,33 @@ QT_BEGIN_NAMESPACE +QSGDefaultGlyphNode::QSGDefaultGlyphNode() + : m_glyphNodeType(RootGlyphNode) + , m_dirtyGeometry(false) +{ + setFlag(UsePreprocess); +} + +QSGDefaultGlyphNode::~QSGDefaultGlyphNode() +{ + if (m_glyphNodeType == SubGlyphNode) + return; + + qDeleteAll(m_nodesToDelete); + m_nodesToDelete.clear(); +} + void QSGDefaultGlyphNode::setMaterialColor(const QColor &color) { static_cast(m_material)->setColor(color); } +void QSGDefaultGlyphNode::setGlyphs(const QPointF &position, const QGlyphRun &glyphs) +{ + QSGBasicGlyphNode::setGlyphs(position, glyphs); + m_dirtyGeometry = true; +} + void QSGDefaultGlyphNode::update() { QRawFont font = m_glyphs.rawFont(); @@ -84,4 +106,110 @@ void QSGDefaultGlyphNode::update() markDirty(DirtyGeometry); } +void QSGDefaultGlyphNode::preprocess() +{ + qDeleteAll(m_nodesToDelete); + m_nodesToDelete.clear(); + + if (m_dirtyGeometry) + updateGeometry(); +} + +void QSGDefaultGlyphNode::updateGeometry() +{ + // Remove previously created sub glyph nodes + // We assume all the children are sub glyph nodes + QSGNode *subnode = firstChild(); + while (subnode) { + // We can't delete the node now as it might be in the preprocess list + // It will be deleted in the next preprocess + m_nodesToDelete.append(subnode); + subnode = subnode->nextSibling(); + } + removeAllChildNodes(); + + GlyphInfo glyphInfo; + + const QVector indexes = m_glyphs.glyphIndexes(); + const QVector positions = m_glyphs.positions(); + + const int maxGlyphs = (USHRT_MAX + 1) / 4; // 16384 + const int maxVertices = maxGlyphs * 4; // 65536 + const int maxIndexes = maxGlyphs * 6; // 98304 + + for (int i = 0; i < indexes.size(); ++i) { + const int glyphIndex = indexes.at(i); + const QPointF position = positions.at(i); + + // As we use UNSIGNED_SHORT indexing in the geometry, we overload the + // "glyphsInOtherNodes" concept as overflow for if there are more than + // 65536 (16384 * 4) vertices to render which would otherwise exceed + // the maximum index size. This will cause sub-nodes to be recursively + // created to handle any number of glyphs. + if (i >= maxGlyphs) { + glyphInfo.indexes.append(glyphIndex); + glyphInfo.positions.append(position); + continue; + } + } + + if (!glyphInfo.indexes.isEmpty()) { + QGlyphRun subNodeGlyphRun(m_glyphs); + subNodeGlyphRun.setGlyphIndexes(glyphInfo.indexes); + subNodeGlyphRun.setPositions(glyphInfo.positions); + + QSGDefaultGlyphNode *subNode = new QSGDefaultGlyphNode(); + subNode->setGlyphNodeType(SubGlyphNode); + subNode->setColor(m_color); + subNode->setStyle(m_style); + subNode->setStyleColor(m_styleColor); + subNode->setGlyphs(m_position, subNodeGlyphRun); + subNode->update(); + subNode->updateGeometry(); // we have to explicitly call this now as preprocess won't be called before it's rendered + appendChildNode(subNode); + + QSGGeometry *g = geometry(); + + QSGGeometry::TexturedPoint2D *vertexData = g->vertexDataAsTexturedPoint2D(); + quint16 *indexData = g->indexDataAsUShort(); + + QVector tempVertexData(maxVertices); + QVector tempIndexData(maxIndexes); + + for (int i = 0; i < maxGlyphs; i++) { + tempVertexData[i * 4 + 0] = vertexData[i * 4 + 0]; + tempVertexData[i * 4 + 1] = vertexData[i * 4 + 1]; + tempVertexData[i * 4 + 2] = vertexData[i * 4 + 2]; + tempVertexData[i * 4 + 3] = vertexData[i * 4 + 3]; + + tempIndexData[i * 6 + 0] = indexData[i * 6 + 0]; + tempIndexData[i * 6 + 1] = indexData[i * 6 + 1]; + tempIndexData[i * 6 + 2] = indexData[i * 6 + 2]; + tempIndexData[i * 6 + 3] = indexData[i * 6 + 3]; + tempIndexData[i * 6 + 4] = indexData[i * 6 + 4]; + tempIndexData[i * 6 + 5] = indexData[i * 6 + 5]; + } + + g->allocate(maxVertices, maxIndexes); + vertexData = g->vertexDataAsTexturedPoint2D(); + indexData = g->indexDataAsUShort(); + + for (int i = 0; i < maxGlyphs; i++) { + vertexData[i * 4 + 0] = tempVertexData[i * 4 + 0]; + vertexData[i * 4 + 1] = tempVertexData[i * 4 + 1]; + vertexData[i * 4 + 2] = tempVertexData[i * 4 + 2]; + vertexData[i * 4 + 3] = tempVertexData[i * 4 + 3]; + + indexData[i * 6 + 0] = tempIndexData[i * 6 + 0]; + indexData[i * 6 + 1] = tempIndexData[i * 6 + 1]; + indexData[i * 6 + 2] = tempIndexData[i * 6 + 2]; + indexData[i * 6 + 3] = tempIndexData[i * 6 + 3]; + indexData[i * 6 + 4] = tempIndexData[i * 6 + 4]; + indexData[i * 6 + 5] = tempIndexData[i * 6 + 5]; + } + } + + m_dirtyGeometry = false; +} + QT_END_NAMESPACE diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.h b/src/quick/scenegraph/qsgdefaultglyphnode_p.h index 0eb7a4e4bd..37a89c70b9 100644 --- a/src/quick/scenegraph/qsgdefaultglyphnode_p.h +++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.h @@ -59,8 +59,31 @@ QT_BEGIN_NAMESPACE class QSGDefaultGlyphNode : public QSGBasicGlyphNode { public: + QSGDefaultGlyphNode(); + ~QSGDefaultGlyphNode(); void setMaterialColor(const QColor &color) override; + void setGlyphs(const QPointF &position, const QGlyphRun &glyphs) override; void update() override; + void preprocess() override; + void updateGeometry(); + +private: + enum DefaultGlyphNodeType { + RootGlyphNode, + SubGlyphNode + }; + + void setGlyphNodeType(DefaultGlyphNodeType type) { m_glyphNodeType = type; } + + DefaultGlyphNodeType m_glyphNodeType; + QLinkedList m_nodesToDelete; + + struct GlyphInfo { + QVector indexes; + QVector positions; + }; + + uint m_dirtyGeometry: 1; }; QT_END_NAMESPACE -- cgit v1.2.3 From 182469fc85257fccfa8024e132ad40a50b03c0f5 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 9 Mar 2017 13:59:40 +0100 Subject: Build fix for -no-feature-quick-shadereffect Change-Id: Ie1f601c6ae4c6c5d8d23b14a6670979d9c24e209 Reviewed-by: Simon Hausmann --- src/quick/items/context2d/qquickcanvasitem.cpp | 1 + src/quick/items/context2d/qquickcontext2d.cpp | 2 ++ src/quick/items/qquickpainteditem_p.h | 1 + src/quick/util/qquickanimatorjob.cpp | 3 ++- 4 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src/quick') diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp index 1167f408f5..a81ab619ac 100644 --- a/src/quick/items/context2d/qquickcanvasitem.cpp +++ b/src/quick/items/context2d/qquickcanvasitem.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include #include diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index e25cc5ccbe..0eeba5d6cd 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -42,7 +42,9 @@ #include "qquickcanvasitem_p.h" #include #include +#if QT_CONFIG(quick_shadereffect) #include +#endif #include #include diff --git a/src/quick/items/qquickpainteditem_p.h b/src/quick/items/qquickpainteditem_p.h index 742e786335..229fbf1007 100644 --- a/src/quick/items/qquickpainteditem_p.h +++ b/src/quick/items/qquickpainteditem_p.h @@ -52,6 +52,7 @@ // #include "qquickitem_p.h" +#include "qquickpainteditem.h" #include QT_BEGIN_NAMESPACE diff --git a/src/quick/util/qquickanimatorjob.cpp b/src/quick/util/qquickanimatorjob.cpp index 4aacb09c97..89007cff1f 100644 --- a/src/quick/util/qquickanimatorjob.cpp +++ b/src/quick/util/qquickanimatorjob.cpp @@ -345,12 +345,13 @@ void QQuickTransformAnimatorJob::postSync() } QQuickItemPrivate *d = QQuickItemPrivate::get(m_target); +#if QT_CONFIG(quick_shadereffect) if (d->extra.isAllocated() && d->extra->layer && d->extra->layer->enabled()) { d = QQuickItemPrivate::get(d->extra->layer->m_effectSource); } - +#endif m_helper->node = d->itemNode(); } -- cgit v1.2.3 From 920e0ddaf987f160cd70deb29d14769092929403 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 9 Mar 2017 14:20:42 +0100 Subject: Build fix for -no-feature-quick-path Change-Id: Ib52d45a12b367fa08982535a69c14881beec597e Reviewed-by: Lars Knoll --- src/quick/items/context2d/qquickcontext2d.cpp | 10 ++++++++-- src/quick/items/qquickitemsmodule.cpp | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index 0eeba5d6cd..ce890771d9 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -49,8 +49,9 @@ #include #include +#if QT_CONFIG(quick_path) #include - +#endif #include #include @@ -569,9 +570,10 @@ struct QQuickJSContext2D : public QV4::Object static void method_set_shadowOffsetY(const QV4::BuiltinFunction *, QV4::Scope &scope, QV4::CallData *callData); // should these two be on the proto? +#if QT_CONFIG(quick_path) static void method_get_path(const QV4::BuiltinFunction *, QV4::Scope &scope, QV4::CallData *callData); static void method_set_path(const QV4::BuiltinFunction *, QV4::Scope &scope, QV4::CallData *callData); - +#endif static void method_get_font(const QV4::BuiltinFunction *, QV4::Scope &scope, QV4::CallData *callData); static void method_set_font(const QV4::BuiltinFunction *, QV4::Scope &scope, QV4::CallData *callData); static void method_get_textAlign(const QV4::BuiltinFunction *, QV4::Scope &scope, QV4::CallData *callData); @@ -2034,6 +2036,7 @@ void QQuickJSContext2D::method_set_shadowOffsetY(const QV4::BuiltinFunction *, Q RETURN_UNDEFINED(); } +#if QT_CONFIG(quick_path) void QQuickJSContext2D::method_get_path(const QV4::BuiltinFunction *, QV4::Scope &scope, QV4::CallData *callData) { QV4::Scoped r(scope, callData->thisObject); @@ -2060,6 +2063,7 @@ void QQuickJSContext2D::method_set_path(const QV4::BuiltinFunction *, QV4::Scope r->d()->context->m_v4path.set(scope.engine, value); RETURN_UNDEFINED(); } +#endif // QT_CONFIG(quick_path) //rects /*! @@ -4207,7 +4211,9 @@ QQuickContext2DEngineData::QQuickContext2DEngineData(QV4::ExecutionEngine *v4) proto->defineAccessorProperty(QStringLiteral("fillStyle"), QQuickJSContext2D::method_get_fillStyle, QQuickJSContext2D::method_set_fillStyle); proto->defineAccessorProperty(QStringLiteral("shadowColor"), QQuickJSContext2D::method_get_shadowColor, QQuickJSContext2D::method_set_shadowColor); proto->defineAccessorProperty(QStringLiteral("textBaseline"), QQuickJSContext2D::method_get_textBaseline, QQuickJSContext2D::method_set_textBaseline); +#if QT_CONFIG(quick_path) proto->defineAccessorProperty(QStringLiteral("path"), QQuickJSContext2D::method_get_path, QQuickJSContext2D::method_set_path); +#endif proto->defineAccessorProperty(QStringLiteral("lineJoin"), QQuickJSContext2D::method_get_lineJoin, QQuickJSContext2D::method_set_lineJoin); proto->defineAccessorProperty(QStringLiteral("lineWidth"), QQuickJSContext2D::method_get_lineWidth, QQuickJSContext2D::method_set_lineWidth); proto->defineAccessorProperty(QStringLiteral("textAlign"), QQuickJSContext2D::method_get_textAlign, QQuickJSContext2D::method_set_textAlign); diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp index a8824de9c8..5f6d44b54d 100644 --- a/src/quick/items/qquickitemsmodule.cpp +++ b/src/quick/items/qquickitemsmodule.cpp @@ -273,7 +273,7 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) qmlRegisterType(); qmlRegisterType(uri, major, minor,"AnchorAnimation"); qmlRegisterType(uri, major, minor,"ParentAnimation"); -#if QT_CONFIG(quick_canvas) +#if QT_CONFIG(quick_path) qmlRegisterType("QtQuick",2,0,"PathAnimation"); qmlRegisterType("QtQuick",2,0,"PathInterpolator"); #endif -- cgit v1.2.3 From 9180241819a9ea5e517977efc5bb031521a56cc6 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 9 Mar 2017 14:50:19 +0100 Subject: Add features.quick-particles Change-Id: I78b30d254ed64acadcb2acc278ad1dfde55216ac Reviewed-by: Lars Knoll --- src/quick/configure.json | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/quick') diff --git a/src/quick/configure.json b/src/quick/configure.json index 4ed11e8318..eabc8c4824 100644 --- a/src/quick/configure.json +++ b/src/quick/configure.json @@ -97,6 +97,14 @@ "privateFeature" ] }, + "quick-particles": { + "label": "Particle support", + "purpose": "Provides a particle system for Qt Quick", + "condition": "features.quick-shadereffect && features.quick-sprite && features.opengl", + "output": [ + "privateFeature" + ] + }, "quick-path": { "label": "Path support", "purpose": "Provides Path elements in Qt Quick", -- cgit v1.2.3 From 8675bb6b5a4721aa4d94dcb3cb98dbed061c164f Mon Sep 17 00:00:00 2001 From: Christoph Sterz Date: Fri, 18 Dec 2015 13:18:46 +0100 Subject: Doc: Removed non-working reimplementation suggestions QSGSimpleMaterialShader::uniformMatrixName() and QSGSimpleMaterialShader::uniformOpacityName() cannot be reimplemented since they are non-virtual. Removed the suggestion, so nobody is tempted to do so. Added a Remark in the header to fix towards intended behavior in Qt6. Change-Id: Id23c8d54728095f143f1d0e0520590303cff91a0 Reviewed-by: Giuseppe D'Angelo Reviewed-by: Leena Miettinen Reviewed-by: Jan Arne Petersen Reviewed-by: Gunnar Sletta --- src/quick/scenegraph/util/qsgsimplematerial.cpp | 12 ++++-------- src/quick/scenegraph/util/qsgsimplematerial.h | 1 + 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'src/quick') diff --git a/src/quick/scenegraph/util/qsgsimplematerial.cpp b/src/quick/scenegraph/util/qsgsimplematerial.cpp index 7214a255df..f29c58ad9e 100644 --- a/src/quick/scenegraph/util/qsgsimplematerial.cpp +++ b/src/quick/scenegraph/util/qsgsimplematerial.cpp @@ -194,19 +194,15 @@ /*! \fn const char *QSGSimpleMaterialShader::uniformMatrixName() const - Reimplement this function to give a different name to the uniform for - item transformation. The default value is \c qt_Matrix. - + Returns the name for the transform matrix uniform of this item. + The default value is \c qt_Matrix. */ /*! \fn const char *QSGSimpleMaterialShader::uniformOpacityName() const - Reimplement this function to give a different name to the uniform for - item opacity. The default value is \c qt_Opacity. - - If the shader program does not implement the item opacity, the - implemented function should return a null pointer. + Returns the name for the opacity uniform of this item. + The default value is \c qt_Opacity. */ /*! diff --git a/src/quick/scenegraph/util/qsgsimplematerial.h b/src/quick/scenegraph/util/qsgsimplematerial.h index 8f42599832..80593c755b 100644 --- a/src/quick/scenegraph/util/qsgsimplematerial.h +++ b/src/quick/scenegraph/util/qsgsimplematerial.h @@ -71,6 +71,7 @@ public: resolveUniforms(); } + // ### Qt 6: make both virtual and fix docs const char *uniformMatrixName() const { return "qt_Matrix"; } const char *uniformOpacityName() const { return "qt_Opacity"; } -- cgit v1.2.3 From 212ccd59627deb8c06227dbf0f3f3329006c326e Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Mon, 13 Mar 2017 16:33:18 +0100 Subject: QSGDistanceFieldGlyphNode: Remove per-node QLinkedList of nodes to delete We avoided deleting these nodes directly due to preprocess, but this is a bit of a hack. QSGRenderer::preprocess already contains some work to allow for modification of nodes at preprocess time, but it didn't allow for detecting dead nodes. By marking a pointer as not to be touched if it is removed during preprocess, we can remove the per-node QLinkedList and delete directly, while at the same time, still not touching deleted nodes later on in preprocess. Change-Id: I99a1ea65d3fe0b73db73e4a1d10d999d56edcdc4 Reviewed-by: Gunnar Sletta --- src/quick/scenegraph/coreapi/qsgrenderer.cpp | 20 +++++++++++++++++++- src/quick/scenegraph/coreapi/qsgrenderer_p.h | 2 ++ src/quick/scenegraph/qsgdistancefieldglyphnode.cpp | 15 ++++----------- src/quick/scenegraph/qsgdistancefieldglyphnode_p.h | 1 - 4 files changed, 25 insertions(+), 13 deletions(-) (limited to 'src/quick') diff --git a/src/quick/scenegraph/coreapi/qsgrenderer.cpp b/src/quick/scenegraph/coreapi/qsgrenderer.cpp index 9207fdbc55..bb2671f6c3 100644 --- a/src/quick/scenegraph/coreapi/qsgrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgrenderer.cpp @@ -134,6 +134,7 @@ QSGRenderer::QSGRenderer(QSGRenderContext *context) , m_bindable(0) , m_changed_emitted(false) , m_is_rendering(false) + , m_is_preprocessing(false) { } @@ -287,6 +288,8 @@ void QSGRenderer::nodeChanged(QSGNode *node, QSGNode::DirtyState state) void QSGRenderer::preprocess() { + m_is_preprocessing = true; + QSGRootNode *root = rootNode(); Q_ASSERT(root); @@ -298,6 +301,11 @@ void QSGRenderer::preprocess() for (QSet::const_iterator it = items.constBegin(); it != items.constEnd(); ++it) { QSGNode *n = *it; + + // If we are currently preprocessing, check this node hasn't been + // deleted or something. we don't want a use-after-free! + if (m_nodes_dont_preprocess.contains(n)) // skip + continue; if (!nodeUpdater()->isNodeBlocked(n, root)) { n->preprocess(); } @@ -315,8 +323,13 @@ void QSGRenderer::preprocess() updatePassTime = frameTimer.nsecsElapsed(); Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRendererFrame, QQuickProfiler::SceneGraphRendererUpdate); + + m_is_preprocessing = false; + m_nodes_dont_preprocess.clear(); } + + void QSGRenderer::addNodesToPreprocess(QSGNode *node) { for (QSGNode *c = node->firstChild(); c; c = c->nextSibling()) @@ -329,8 +342,13 @@ void QSGRenderer::removeNodesToPreprocess(QSGNode *node) { for (QSGNode *c = node->firstChild(); c; c = c->nextSibling()) removeNodesToPreprocess(c); - if (node->flags() & QSGNode::UsePreprocess) + if (node->flags() & QSGNode::UsePreprocess) { m_nodes_to_preprocess.remove(node); + + // If preprocessing *now*, mark the node as gone. + if (m_is_preprocessing) + m_nodes_dont_preprocess.insert(node); + } } diff --git a/src/quick/scenegraph/coreapi/qsgrenderer_p.h b/src/quick/scenegraph/coreapi/qsgrenderer_p.h index 4589685765..1ea2775e6f 100644 --- a/src/quick/scenegraph/coreapi/qsgrenderer_p.h +++ b/src/quick/scenegraph/coreapi/qsgrenderer_p.h @@ -118,11 +118,13 @@ private: QSGNodeUpdater *m_node_updater; QSet m_nodes_to_preprocess; + QSet m_nodes_dont_preprocess; const QSGBindable *m_bindable; uint m_changed_emitted : 1; uint m_is_rendering : 1; + uint m_is_preprocessing : 1; }; class Q_QUICK_PRIVATE_EXPORT QSGBindable diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp b/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp index 456a197ba1..11c5444cd2 100644 --- a/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp +++ b/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp @@ -76,9 +76,6 @@ QSGDistanceFieldGlyphNode::~QSGDistanceFieldGlyphNode() m_glyph_cache->unregisterGlyphNode(this); m_glyph_cache->unregisterOwnerElement(ownerElement()); } - - while (m_nodesToDelete.count()) - delete m_nodesToDelete.takeLast(); } void QSGDistanceFieldGlyphNode::setColor(const QColor &color) @@ -158,9 +155,6 @@ void QSGDistanceFieldGlyphNode::preprocess() { Q_ASSERT(m_glyph_cache); - while (m_nodesToDelete.count()) - delete m_nodesToDelete.takeLast(); - m_glyph_cache->processPendingGlyphs(); m_glyph_cache->update(); @@ -188,13 +182,12 @@ void QSGDistanceFieldGlyphNode::updateGeometry() // Remove previously created sub glyph nodes // We assume all the children are sub glyph nodes QSGNode *subnode = firstChild(); + QSGNode *nextNode = 0; while (subnode) { - // We can't delete the node now as it might be in the preprocess list - // It will be deleted in the next preprocess - m_nodesToDelete.append(subnode); - subnode = subnode->nextSibling(); + nextNode = subnode->nextSibling(); + delete subnode; + subnode = nextNode; } - removeAllChildNodes(); QSGGeometry *g = geometry(); diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h index c0c6bda718..04446c7b2c 100644 --- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h +++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h @@ -107,7 +107,6 @@ private: AntialiasingMode m_antialiasingMode; QRectF m_boundingRect; const QSGDistanceFieldGlyphCache::Texture *m_texture; - QLinkedList m_nodesToDelete; struct GlyphInfo { QVector indexes; -- cgit v1.2.3 From e7a6544225a5ab3749230fc6783a5145e02dbe32 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 23 Feb 2017 16:26:53 +0100 Subject: Use qRadiansToDegrees() more widely It documents the meaning of the computation more clearly. Task-number: QTBUG-58083 Change-Id: Ie2d486d1e1919569de5a1565e783703b9b3bc813 Reviewed-by: Robin Burchell --- src/quick/items/context2d/qquickcontext2d.cpp | 12 +++++------- src/quick/items/qquickitemanimation.cpp | 2 +- src/quick/items/qquickstateoperations.cpp | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index cf34523693..66afd3828b 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -128,8 +128,6 @@ QT_BEGIN_NAMESPACE Q_CORE_EXPORT double qstrtod(const char *s00, char const **se, bool *ok); -#define DEGREES(t) ((t) * 180.0 / M_PI) - #define CHECK_CONTEXT(r) if (!r || !r->d()->context || !r->d()->context->bufferValid()) \ THROW_GENERIC_ERROR("Not a Context2D object"); @@ -1641,7 +1639,7 @@ void QQuickJSContext2DPrototype::method_createConicalGradient(const QV4::Builtin if (callData->argc >= 3) { qreal x = callData->args[0].toNumber(); qreal y = callData->args[1].toNumber(); - qreal angle = DEGREES(callData->args[2].toNumber()); + qreal angle = qRadiansToDegrees(callData->args[2].toNumber()); if (!qt_is_finite(x) || !qt_is_finite(y)) { THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "createConicalGradient(): Incorrect arguments"); } @@ -3366,7 +3364,7 @@ void QQuickContext2D::rotate(qreal angle) return; QTransform newTransform =state.matrix; - newTransform.rotate(DEGREES(angle)); + newTransform.rotate(qRadiansToDegrees(angle)); if (!newTransform.isInvertible()) { state.invertibleCTM = false; @@ -3375,7 +3373,7 @@ void QQuickContext2D::rotate(qreal angle) state.matrix = newTransform; buffer()->updateMatrix(state.matrix); - m_path = QTransform().rotate(-DEGREES(angle)).map(m_path); + m_path = QTransform().rotate(-qRadiansToDegrees(angle)).map(m_path); } void QQuickContext2D::shear(qreal h, qreal v) @@ -3772,8 +3770,8 @@ void QQuickContext2D::arc(qreal xc, qreal yc, qreal radius, qreal sar, qreal ear antiClockWise = !antiClockWise; //end hack - float sa = DEGREES(sar); - float ea = DEGREES(ear); + float sa = qRadiansToDegrees(sar); + float ea = qRadiansToDegrees(ear); double span = 0; diff --git a/src/quick/items/qquickitemanimation.cpp b/src/quick/items/qquickitemanimation.cpp index 9873622f41..874130b137 100644 --- a/src/quick/items/qquickitemanimation.cpp +++ b/src/quick/items/qquickitemanimation.cpp @@ -327,7 +327,7 @@ QAbstractAnimationJob* QQuickParentAnimation::transition(QQuickStateActions &act } if (scale != 0) - rotation = qAtan2(transform.m12()/scale, transform.m11()/scale) * 180/M_PI; + rotation = qRadiansToDegrees(qAtan2(transform.m12() / scale, transform.m11() / scale)); else { qmlWarning(this) << QQuickParentAnimation::tr("Unable to preserve appearance under scale of 0"); ok = false; diff --git a/src/quick/items/qquickstateoperations.cpp b/src/quick/items/qquickstateoperations.cpp index b40a9e2843..a4ce13a199 100644 --- a/src/quick/items/qquickstateoperations.cpp +++ b/src/quick/items/qquickstateoperations.cpp @@ -101,7 +101,7 @@ void QQuickParentChangePrivate::doChange(QQuickItem *targetParent, QQuickItem *s } if (scale != 0) - rotation = qAtan2(transform.m12()/scale, transform.m11()/scale) * 180/M_PI; + rotation = qRadiansToDegrees(qAtan2(transform.m12() / scale, transform.m11() / scale)); else { qmlWarning(q) << QQuickParentChange::tr("Unable to preserve appearance under scale of 0"); ok = false; -- cgit v1.2.3 From aa570a7720dc508f83c32aee81ac1d6ea21d6757 Mon Sep 17 00:00:00 2001 From: Nikita Krupenko Date: Sat, 11 Jun 2016 20:03:45 +0300 Subject: Flickable: fix doc statement about content anchoring Task-number: QTBUG-54101 Change-Id: I3b0a0225efb77003c1c80c1d5b94ab572f3cc785 Reviewed-by: Shawn Rutledge --- src/quick/items/qquickflickable.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index d97c731157..6a2946bdcc 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -642,8 +642,10 @@ is finished. \section1 Limitations - \note Due to an implementation detail, items placed inside a Flickable cannot anchor to it by - \c id. Use \c parent instead. + \note Due to an implementation detail, items placed inside a Flickable + cannot anchor to the Flickable. Instead, use \l {Item::}{parent}, which + refers to the Flickable's \l contentItem. The size of the content item is + determined by \l contentWidth and \l contentHeight. */ /*! -- cgit v1.2.3 From 13fc05fde8cde6a81d3cf3161fa34cf9d3652eb2 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 7 Mar 2017 19:52:34 +0100 Subject: Document and demo that fboId can be 0 ...in QQuickWindow::setRenderTarget(). The rendercontrol example is extended with a --onscreen command line argument that can be used to request rendering to the default framebuffer of the window. Change-Id: I7a500d1585dee8334b902fb1dddcb1cb21a2e038 Task-number: QTBUG-59340 Reviewed-by: Gunnar Sletta --- src/quick/items/qquickwindow.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/quick') diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index e6245f90f3..80abf82e58 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -3399,6 +3399,11 @@ void QQuickWindow::setRenderTarget(QOpenGLFramebufferObject *fbo) The specified FBO must be created in the context of the window or one that shares with it. + \note \a fboId can also be set to 0. In this case rendering will target the + default framebuffer of whichever surface is current when the scenegraph + renders. \a size must still be valid, specifying the dimensions of the + surface. + \note This function only has an effect when using the default OpenGL scene graph adaptation. -- cgit v1.2.3 From 09479fac4c08c9e2c159df4f87fa61dbc3836816 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Fri, 17 Mar 2017 15:39:53 +0100 Subject: QQuickImageProvider: Improve documentation about cancel() and finished() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Makes it a little more obvious how best to use this. We could do with including some snippets showing how to ideally implement cancel() I think, but this is a good start. Change-Id: I88d63a451239f91aa3619ccb74e306a2052a6e70 Task-number: QTBUG-59485 Reviewed-by: Albert Astals Cid Reviewed-by: Pasi Petäjäjärvi --- src/quick/util/qquickimageprovider.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/quick') diff --git a/src/quick/util/qquickimageprovider.cpp b/src/quick/util/qquickimageprovider.cpp index a026abe762..0ceed7f681 100644 --- a/src/quick/util/qquickimageprovider.cpp +++ b/src/quick/util/qquickimageprovider.cpp @@ -183,7 +183,12 @@ QString QQuickImageResponse::errorString() const It may be reimplemented to cancel a request in the provider side, however, it is not mandatory. - A cancelled QQuickImageResponse still needs to emit finished(). + A cancelled QQuickImageResponse still needs to emit finished() so that the + engine may clean up the QQuickImageResponse. + + \note finished() should not be emitted until the response is complete, + regardless of whether or not cancel() was called. If it is called prematurely, + the engine may destroy the response while it is still active, leading to a crash. */ void QQuickImageResponse::cancel() { @@ -192,7 +197,12 @@ void QQuickImageResponse::cancel() /*! \fn void QQuickImageResponse::finished() - Signals that the job execution has finished (be it successfully, because an error happened or because it was cancelled). + Signals that the job execution has finished (be it successfully, because an + error happened or because it was cancelled). + + \note Emission of this signal must be the final action the response performs: + once the signal is received, the response will subsequently be destroyed by + the engine. */ /*! -- cgit v1.2.3 From 6825b37a48de6a69def38897b03ff7f9974226dd Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 17 Mar 2017 13:19:50 +0100 Subject: Expose QQuickItem::size() and document QQuickItem::setSize() [ChangeLog][QtQuick][QQuickItem] Add QQuickItem::size() and document QQuickItem::setSize(). Change-Id: I6f4d531e046758eb062111d656cc2e0be1624da3 Reviewed-by: Shawn Rutledge --- src/quick/items/qquickitem.cpp | 23 +++++++++++++++++++++-- src/quick/items/qquickitem.h | 1 + 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index aa2662489d..539a374dd9 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -6746,8 +6746,27 @@ bool QQuickItem::heightValid() const } /*! - \internal - */ + \since 5.10 + + Returns the size of the item. + + \sa setSize, width, height + */ + +QSizeF QQuickItem::size() const +{ + Q_D(const QQuickItem); + return QSizeF(d->width, d->height); +} + + +/*! + \since 5.10 + + Sets the size of the item to \a size. + + \sa size, setWidth, setHeight + */ void QQuickItem::setSize(const QSizeF &size) { Q_D(QQuickItem); diff --git a/src/quick/items/qquickitem.h b/src/quick/items/qquickitem.h index c9494d91bd..f58946d01d 100644 --- a/src/quick/items/qquickitem.h +++ b/src/quick/items/qquickitem.h @@ -237,6 +237,7 @@ public: void setImplicitHeight(qreal); qreal implicitHeight() const; + QSizeF size() const; void setSize(const QSizeF &size); TransformOrigin transformOrigin() const; -- cgit v1.2.3 From ddb1b8f226693730e3bdb85a0fe78c7ed3c43a79 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Sun, 19 Mar 2017 18:47:31 +0100 Subject: QQuickEvents: Fix documentation of types for MouseEvent and WheelEvent x/y These types are qreal, not int. Change-Id: I26569c40825ce098ea095b3d9dc9b84eb3870c02 Reviewed-by: Mitch Curtis Reviewed-by: Shawn Rutledge --- src/quick/items/qquickevents.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp index b6c45c40a8..f1f82f9e0e 100644 --- a/src/quick/items/qquickevents.cpp +++ b/src/quick/items/qquickevents.cpp @@ -193,8 +193,8 @@ Item { */ /*! - \qmlproperty int QtQuick::MouseEvent::x - \qmlproperty int QtQuick::MouseEvent::y + \qmlproperty real QtQuick::MouseEvent::x + \qmlproperty real QtQuick::MouseEvent::y These properties hold the coordinates of the position supplied by the mouse event. */ @@ -340,8 +340,8 @@ Item { */ /*! - \qmlproperty int QtQuick::WheelEvent::x - \qmlproperty int QtQuick::WheelEvent::y + \qmlproperty real QtQuick::WheelEvent::x + \qmlproperty real QtQuick::WheelEvent::y These properties hold the coordinates of the position supplied by the wheel event. */ -- cgit v1.2.3 From b5903ba46e065b096d7bcc12b11cde32b1c0f0c7 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Mon, 13 Mar 2017 18:19:33 +0100 Subject: QSGDistanceFieldUtil: Remove a layer of indirection These mysterious setters appear to be unused (and always were, as far as I can see). How useful they are is not entirely clear (as opposed to a patch to the source for instance, and as it's private API anyway, you'd be touching internals to use this. Additionally, removing the indirection makes the code a bit cleaner and more self-contained in my opinion. This removal leaves the value of QSGDistanceFieldGlyphCacheManager in some question to me, given that it's basically a glorified wrapper around QHash. Change-Id: I6d18eb40d8cd00ebe389b4ed53448f3401962ae6 Reviewed-by: Gunnar Sletta Reviewed-by: Yoann Lopes --- .../scenegraph/qsgdistancefieldglyphnode_p.cpp | 41 ++++++++++++++++------ src/quick/scenegraph/util/qsgdistancefieldutil.cpp | 26 -------------- src/quick/scenegraph/util/qsgdistancefieldutil_p.h | 12 ------- 3 files changed, 30 insertions(+), 49 deletions(-) (limited to 'src/quick') diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp index fc66f2f2cc..153f0a45c5 100644 --- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp +++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp @@ -58,7 +58,7 @@ public: protected: void initialize() override; - void updateAlphaRange(ThresholdFunc thresholdFunc, AntialiasingSpreadFunc spreadFunc); + void updateAlphaRange(); void updateColor(const QVector4D &c); void updateTextureScale(const QVector2D &ts); @@ -98,7 +98,31 @@ QSGDistanceFieldTextMaterialShader::QSGDistanceFieldTextMaterialShader() setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/scenegraph/shaders/distancefieldtext.frag")); } -void QSGDistanceFieldTextMaterialShader::updateAlphaRange(ThresholdFunc thresholdFunc, AntialiasingSpreadFunc spreadFunc) +static float qt_sg_envFloat(const char *name, float defaultValue) +{ + if (Q_LIKELY(!qEnvironmentVariableIsSet(name))) + return defaultValue; + bool ok = false; + const float value = qgetenv(name).toFloat(&ok); + return ok ? value : defaultValue; +} + +static float thresholdFunc(float glyphScale) +{ + static const float base = qt_sg_envFloat("QT_DF_BASE", 0.5f); + static const float baseDev = qt_sg_envFloat("QT_DF_BASEDEVIATION", 0.065f); + static const float devScaleMin = qt_sg_envFloat("QT_DF_SCALEFORMAXDEV", 0.15f); + static const float devScaleMax = qt_sg_envFloat("QT_DF_SCALEFORNODEV", 0.3f); + return base - ((qBound(devScaleMin, glyphScale, devScaleMax) - devScaleMin) / (devScaleMax - devScaleMin) * -baseDev + baseDev); +} + +static float spreadFunc(float glyphScale) +{ + static const float range = qt_sg_envFloat("QT_DF_RANGE", 0.06f); + return range / glyphScale; +} + +void QSGDistanceFieldTextMaterialShader::updateAlphaRange() { float combinedScale = m_fontScale * m_matrixScale; float base = thresholdFunc(combinedScale); @@ -169,8 +193,7 @@ void QSGDistanceFieldTextMaterialShader::updateState(const RenderState &state, Q updateRange = true; } if (updateRange) { - updateAlphaRange(material->glyphCache()->manager()->thresholdFunc(), - material->glyphCache()->manager()->antialiasingSpreadFunc()); + updateAlphaRange(); } Q_ASSERT(material->glyphCache()); @@ -334,7 +357,7 @@ public: protected: void initialize() override; - void updateOutlineAlphaRange(ThresholdFunc thresholdFunc, AntialiasingSpreadFunc spreadFunc, int dfRadius); + void updateOutlineAlphaRange(int dfRadius); int m_outlineAlphaMax0_id; int m_outlineAlphaMax1_id; @@ -355,9 +378,7 @@ void DistanceFieldOutlineTextMaterialShader::initialize() m_outlineAlphaMax1_id = program()->uniformLocation("outlineAlphaMax1"); } -void DistanceFieldOutlineTextMaterialShader::updateOutlineAlphaRange(ThresholdFunc thresholdFunc, - AntialiasingSpreadFunc spreadFunc, - int dfRadius) +void DistanceFieldOutlineTextMaterialShader::updateOutlineAlphaRange(int dfRadius) { float combinedScale = m_fontScale * m_matrixScale; float base = thresholdFunc(combinedScale); @@ -381,9 +402,7 @@ void DistanceFieldOutlineTextMaterialShader::updateState(const RenderState &stat if (oldMaterial == 0 || material->fontScale() != oldMaterial->fontScale() || state.isMatrixDirty()) - updateOutlineAlphaRange(material->glyphCache()->manager()->thresholdFunc(), - material->glyphCache()->manager()->antialiasingSpreadFunc(), - material->glyphCache()->distanceFieldRadius()); + updateOutlineAlphaRange(material->glyphCache()->distanceFieldRadius()); } diff --git a/src/quick/scenegraph/util/qsgdistancefieldutil.cpp b/src/quick/scenegraph/util/qsgdistancefieldutil.cpp index 9ca9cdb107..97a5853bd6 100644 --- a/src/quick/scenegraph/util/qsgdistancefieldutil.cpp +++ b/src/quick/scenegraph/util/qsgdistancefieldutil.cpp @@ -47,33 +47,7 @@ QT_BEGIN_NAMESPACE -static float qt_sg_envFloat(const char *name, float defaultValue) -{ - if (Q_LIKELY(!qEnvironmentVariableIsSet(name))) - return defaultValue; - bool ok = false; - const float value = qgetenv(name).toFloat(&ok); - return ok ? value : defaultValue; -} - -static float defaultThresholdFunc(float glyphScale) -{ - static const float base = qt_sg_envFloat("QT_DF_BASE", 0.5f); - static const float baseDev = qt_sg_envFloat("QT_DF_BASEDEVIATION", 0.065f); - static const float devScaleMin = qt_sg_envFloat("QT_DF_SCALEFORMAXDEV", 0.15f); - static const float devScaleMax = qt_sg_envFloat("QT_DF_SCALEFORNODEV", 0.3f); - return base - ((qBound(devScaleMin, glyphScale, devScaleMax) - devScaleMin) / (devScaleMax - devScaleMin) * -baseDev + baseDev); -} - -static float defaultAntialiasingSpreadFunc(float glyphScale) -{ - static const float range = qt_sg_envFloat("QT_DF_RANGE", 0.06f); - return range / glyphScale; -} - QSGDistanceFieldGlyphCacheManager::QSGDistanceFieldGlyphCacheManager() - : m_threshold_func(defaultThresholdFunc) - , m_antialiasingSpread_func(defaultAntialiasingSpreadFunc) { } diff --git a/src/quick/scenegraph/util/qsgdistancefieldutil_p.h b/src/quick/scenegraph/util/qsgdistancefieldutil_p.h index ad366cb4d4..78e7ce15cd 100644 --- a/src/quick/scenegraph/util/qsgdistancefieldutil_p.h +++ b/src/quick/scenegraph/util/qsgdistancefieldutil_p.h @@ -57,9 +57,6 @@ QT_BEGIN_NAMESPACE -typedef float (*ThresholdFunc)(float glyphScale); -typedef float (*AntialiasingSpreadFunc)(float glyphScale); - class QOpenGLShaderProgram; class QSGDistanceFieldGlyphCache; class QSGContext; @@ -73,17 +70,8 @@ public: QSGDistanceFieldGlyphCache *cache(const QRawFont &font); void insertCache(const QRawFont &font, QSGDistanceFieldGlyphCache *cache); - ThresholdFunc thresholdFunc() const { return m_threshold_func; } - void setThresholdFunc(ThresholdFunc func) { m_threshold_func = func; } - - AntialiasingSpreadFunc antialiasingSpreadFunc() const { return m_antialiasingSpread_func; } - void setAntialiasingSpreadFunc(AntialiasingSpreadFunc func) { m_antialiasingSpread_func = func; } - private: QHash m_caches; - - ThresholdFunc m_threshold_func; - AntialiasingSpreadFunc m_antialiasingSpread_func; }; QT_END_NAMESPACE -- cgit v1.2.3 From 59d8fa914d5d72a7973b91e67235e6fdf9686d7d Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Mon, 13 Mar 2017 18:33:58 +0100 Subject: Remove QSGDistanceFieldGlyphCacheManager After the previous cleanups, it became clear that this didn't serve much of a purpose, so let's remove it and simplify the implementation as a result. Change-Id: Iae2ff9c46762f0c7bdf4225a2c4df93bc8253902 Reviewed-by: Yoann Lopes --- src/quick/scenegraph/qsgadaptationlayer.cpp | 6 +- src/quick/scenegraph/qsgadaptationlayer_p.h | 7 +- src/quick/scenegraph/qsgcontext.cpp | 1 - src/quick/scenegraph/qsgcontext_p.h | 3 +- src/quick/scenegraph/qsgdefaultcontext.cpp | 1 - .../qsgdefaultdistancefieldglyphcache.cpp | 5 +- .../qsgdefaultdistancefieldglyphcache_p.h | 2 +- src/quick/scenegraph/qsgdefaultrendercontext.cpp | 14 ++-- src/quick/scenegraph/qsgdistancefieldglyphnode.cpp | 1 - .../scenegraph/qsgdistancefieldglyphnode_p.cpp | 1 - src/quick/scenegraph/qsgdistancefieldglyphnode_p.h | 1 - src/quick/scenegraph/scenegraph.pri | 2 - src/quick/scenegraph/util/qsgdistancefieldutil.cpp | 69 ------------------- src/quick/scenegraph/util/qsgdistancefieldutil_p.h | 79 ---------------------- 14 files changed, 12 insertions(+), 180 deletions(-) delete mode 100644 src/quick/scenegraph/util/qsgdistancefieldutil.cpp delete mode 100644 src/quick/scenegraph/util/qsgdistancefieldutil_p.h (limited to 'src/quick') diff --git a/src/quick/scenegraph/qsgadaptationlayer.cpp b/src/quick/scenegraph/qsgadaptationlayer.cpp index 412023564f..f90706affe 100644 --- a/src/quick/scenegraph/qsgadaptationlayer.cpp +++ b/src/quick/scenegraph/qsgadaptationlayer.cpp @@ -40,7 +40,6 @@ #include "qsgadaptationlayer_p.h" #include -#include #include #include #include @@ -57,9 +56,8 @@ static QElapsedTimer qsg_render_timer; QSGDistanceFieldGlyphCache::Texture QSGDistanceFieldGlyphCache::s_emptyTexture; -QSGDistanceFieldGlyphCache::QSGDistanceFieldGlyphCache(QSGDistanceFieldGlyphCacheManager *man, QOpenGLContext *c, const QRawFont &font) - : m_manager(man) - , m_pendingGlyphs(64) +QSGDistanceFieldGlyphCache::QSGDistanceFieldGlyphCache(QOpenGLContext *c, const QRawFont &font) + : m_pendingGlyphs(64) { Q_ASSERT(font.isValid()); diff --git a/src/quick/scenegraph/qsgadaptationlayer_p.h b/src/quick/scenegraph/qsgadaptationlayer_p.h index a8e35b1ac1..ba146b884f 100644 --- a/src/quick/scenegraph/qsgadaptationlayer_p.h +++ b/src/quick/scenegraph/qsgadaptationlayer_p.h @@ -73,7 +73,6 @@ QT_BEGIN_NAMESPACE class QSGNode; class QImage; class TextureReference; -class QSGDistanceFieldGlyphCacheManager; class QSGDistanceFieldGlyphNode; class QOpenGLContext; class QSGInternalImageNode; @@ -409,7 +408,7 @@ public: class Q_QUICK_PRIVATE_EXPORT QSGDistanceFieldGlyphCache { public: - QSGDistanceFieldGlyphCache(QSGDistanceFieldGlyphCacheManager *man, QOpenGLContext *c, const QRawFont &font); + QSGDistanceFieldGlyphCache(QOpenGLContext *c, const QRawFont &font); virtual ~QSGDistanceFieldGlyphCache(); struct Metrics { @@ -443,8 +442,6 @@ public: bool operator == (const Texture &other) const { return textureId == other.textureId; } }; - const QSGDistanceFieldGlyphCacheManager *manager() const { return m_manager; } - const QRawFont &referenceFont() const { return m_referenceFont; } qreal fontScale(qreal pixelSize) const @@ -514,8 +511,6 @@ protected: inline bool isCoreProfile() const { return m_coreProfile; } private: - QSGDistanceFieldGlyphCacheManager *m_manager; - QRawFont m_referenceFont; int m_glyphCount; diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index d52f69c7a3..ff2379ecb5 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -333,7 +333,6 @@ QSGRendererInterface *QSGContext::rendererInterface(QSGRenderContext *renderCont QSGRenderContext::QSGRenderContext(QSGContext *context) : m_sg(context) - , m_distanceFieldCacheManager(0) { } diff --git a/src/quick/scenegraph/qsgcontext_p.h b/src/quick/scenegraph/qsgcontext_p.h index 2f5d5790ee..bd10453131 100644 --- a/src/quick/scenegraph/qsgcontext_p.h +++ b/src/quick/scenegraph/qsgcontext_p.h @@ -78,7 +78,6 @@ class QSGMaterial; class QSGRenderLoop; class QSGLayer; class QQuickTextureFactory; -class QSGDistanceFieldGlyphCacheManager; class QSGContext; class QQuickPaintedItem; class QSGRendererInterface; @@ -194,7 +193,7 @@ protected: QMutex m_mutex; QHash m_textures; QSet m_texturesToDelete; - QSGDistanceFieldGlyphCacheManager *m_distanceFieldCacheManager; + QHash m_glyphCaches; QSet m_fontEnginesToClean; }; diff --git a/src/quick/scenegraph/qsgdefaultcontext.cpp b/src/quick/scenegraph/qsgdefaultcontext.cpp index d31a7025e5..be5fec9dab 100644 --- a/src/quick/scenegraph/qsgdefaultcontext.cpp +++ b/src/quick/scenegraph/qsgdefaultcontext.cpp @@ -39,7 +39,6 @@ #include "qsgdefaultcontext_p.h" -#include #include #include #include diff --git a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp index f0a336e229..ba25172d2f 100644 --- a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp +++ b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp @@ -42,7 +42,6 @@ #include #include #include -#include #include #include #include @@ -60,8 +59,8 @@ DEFINE_BOOL_CONFIG_OPTION(qsgPreferFullSizeGlyphCacheTextures, QSG_PREFER_FULLSI # define QSG_DEFAULT_DISTANCEFIELD_GLYPH_CACHE_PADDING 2 #endif -QSGDefaultDistanceFieldGlyphCache::QSGDefaultDistanceFieldGlyphCache(QSGDistanceFieldGlyphCacheManager *man, QOpenGLContext *c, const QRawFont &font) - : QSGDistanceFieldGlyphCache(man, c, font) +QSGDefaultDistanceFieldGlyphCache::QSGDefaultDistanceFieldGlyphCache(QOpenGLContext *c, const QRawFont &font) + : QSGDistanceFieldGlyphCache(c, font) , m_maxTextureSize(0) , m_maxTextureCount(3) , m_blitProgram(0) diff --git a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h index 57dc4a5d07..fe365495c2 100644 --- a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h +++ b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h @@ -69,7 +69,7 @@ class QOpenGLFunctions_3_2_Core; class Q_QUICK_PRIVATE_EXPORT QSGDefaultDistanceFieldGlyphCache : public QSGDistanceFieldGlyphCache { public: - QSGDefaultDistanceFieldGlyphCache(QSGDistanceFieldGlyphCacheManager *man, QOpenGLContext *c, const QRawFont &font); + QSGDefaultDistanceFieldGlyphCache(QOpenGLContext *c, const QRawFont &font); virtual ~QSGDefaultDistanceFieldGlyphCache(); void requestGlyphs(const QSet &glyphs) override; diff --git a/src/quick/scenegraph/qsgdefaultrendercontext.cpp b/src/quick/scenegraph/qsgdefaultrendercontext.cpp index 2c5b4ff5c8..7542068a53 100644 --- a/src/quick/scenegraph/qsgdefaultrendercontext.cpp +++ b/src/quick/scenegraph/qsgdefaultrendercontext.cpp @@ -45,7 +45,6 @@ #include #include #include -#include QT_BEGIN_NAMESPACE @@ -159,8 +158,8 @@ void QSGDefaultRenderContext::invalidate() delete m_depthStencilManager; m_depthStencilManager = 0; - delete m_distanceFieldCacheManager; - m_distanceFieldCacheManager = 0; + qDeleteAll(m_glyphCaches); + m_glyphCaches.clear(); if (m_gl->property(QSG_RENDERCONTEXT_PROPERTY) == QVariant::fromValue(this)) m_gl->setProperty(QSG_RENDERCONTEXT_PROPERTY, QVariant()); @@ -294,13 +293,10 @@ QT_END_NAMESPACE QSGDistanceFieldGlyphCache *QSGDefaultRenderContext::distanceFieldGlyphCache(const QRawFont &font) { - if (!m_distanceFieldCacheManager) - m_distanceFieldCacheManager = new QSGDistanceFieldGlyphCacheManager; - - QSGDistanceFieldGlyphCache *cache = m_distanceFieldCacheManager->cache(font); + QSGDistanceFieldGlyphCache *cache = m_glyphCaches.value(font, 0); if (!cache) { - cache = new QSGDefaultDistanceFieldGlyphCache(m_distanceFieldCacheManager, openglContext(), font); - m_distanceFieldCacheManager->insertCache(font, cache); + cache = new QSGDefaultDistanceFieldGlyphCache(openglContext(), font); + m_glyphCaches.insert(font, cache); } return cache; diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp b/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp index 11c5444cd2..32eda2d142 100644 --- a/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp +++ b/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp @@ -39,7 +39,6 @@ #include "qsgdistancefieldglyphnode_p.h" #include "qsgdistancefieldglyphnode_p_p.h" -#include #include QT_BEGIN_NAMESPACE diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp index 153f0a45c5..a67c659c99 100644 --- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp +++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp @@ -38,7 +38,6 @@ ****************************************************************************/ #include "qsgdistancefieldglyphnode_p_p.h" -#include #include #include #include diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h index 04446c7b2c..7008f20925 100644 --- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h +++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.h @@ -59,7 +59,6 @@ QT_BEGIN_NAMESPACE class QSGRenderContext; -class QSGDistanceFieldGlyphCacheManager; class QSGDistanceFieldTextMaterial; class QSGDistanceFieldGlyphNode: public QSGGlyphNode, public QSGDistanceFieldGlyphConsumer { diff --git a/src/quick/scenegraph/scenegraph.pri b/src/quick/scenegraph/scenegraph.pri index 38c3b8dd85..c6db3df158 100644 --- a/src/quick/scenegraph/scenegraph.pri +++ b/src/quick/scenegraph/scenegraph.pri @@ -45,7 +45,6 @@ HEADERS += \ $$PWD/util/qsgtexture.h \ $$PWD/util/qsgtexture_p.h \ $$PWD/util/qsgtextureprovider.h \ - $$PWD/util/qsgdistancefieldutil_p.h \ $$PWD/util/qsgflatcolormaterial.h \ $$PWD/util/qsgsimplematerial.h \ $$PWD/util/qsgtexturematerial.h \ @@ -62,7 +61,6 @@ SOURCES += \ $$PWD/util/qsgsimpletexturenode.cpp \ $$PWD/util/qsgtexture.cpp \ $$PWD/util/qsgtextureprovider.cpp \ - $$PWD/util/qsgdistancefieldutil.cpp \ $$PWD/util/qsgflatcolormaterial.cpp \ $$PWD/util/qsgsimplematerial.cpp \ $$PWD/util/qsgtexturematerial.cpp \ diff --git a/src/quick/scenegraph/util/qsgdistancefieldutil.cpp b/src/quick/scenegraph/util/qsgdistancefieldutil.cpp deleted file mode 100644 index 97a5853bd6..0000000000 --- a/src/quick/scenegraph/util/qsgdistancefieldutil.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qsgdistancefieldutil_p.h" - -#include -#if QT_CONFIG(opengl) -# include -#endif -#include - -QT_BEGIN_NAMESPACE - -QSGDistanceFieldGlyphCacheManager::QSGDistanceFieldGlyphCacheManager() -{ -} - -QSGDistanceFieldGlyphCacheManager::~QSGDistanceFieldGlyphCacheManager() -{ - qDeleteAll(m_caches); -} - -QSGDistanceFieldGlyphCache *QSGDistanceFieldGlyphCacheManager::cache(const QRawFont &font) -{ - return m_caches.value(font, 0); -} - -void QSGDistanceFieldGlyphCacheManager::insertCache(const QRawFont &font, QSGDistanceFieldGlyphCache *cache) -{ - m_caches.insert(font, cache); -} - -QT_END_NAMESPACE diff --git a/src/quick/scenegraph/util/qsgdistancefieldutil_p.h b/src/quick/scenegraph/util/qsgdistancefieldutil_p.h deleted file mode 100644 index 78e7ce15cd..0000000000 --- a/src/quick/scenegraph/util/qsgdistancefieldutil_p.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSGDISTANCEFIELDUTIL_H -#define QSGDISTANCEFIELDUTIL_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QOpenGLShaderProgram; -class QSGDistanceFieldGlyphCache; -class QSGContext; - -class Q_QUICK_PRIVATE_EXPORT QSGDistanceFieldGlyphCacheManager -{ -public: - QSGDistanceFieldGlyphCacheManager(); - ~QSGDistanceFieldGlyphCacheManager(); - - QSGDistanceFieldGlyphCache *cache(const QRawFont &font); - void insertCache(const QRawFont &font, QSGDistanceFieldGlyphCache *cache); - -private: - QHash m_caches; -}; - -QT_END_NAMESPACE - -#endif // QSGDISTANCEFIELDUTIL_H -- cgit v1.2.3 From c021e4b412e1e2977f4c7cf390cee4699b80e67e Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 13 Mar 2017 12:09:13 +0100 Subject: Build fix for configure -no-opengl Change-Id: I21f111a04d9e2ce367d7677dbb48abbd591a4e71 Reviewed-by: Shawn Rutledge Reviewed-by: Joni Poikelin Reviewed-by: Lars Knoll --- src/quick/items/qquickshadereffect.cpp | 2 ++ src/quick/items/qquickshadereffect_p.h | 2 ++ 2 files changed, 4 insertions(+) (limited to 'src/quick') diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp index 436d7b33ce..d317c1d19b 100644 --- a/src/quick/items/qquickshadereffect.cpp +++ b/src/quick/items/qquickshadereffect.cpp @@ -873,9 +873,11 @@ void QQuickShaderEffectPrivate::updatePolish() q->m_impl->maybeUpdateShaders(); } +#if QT_CONFIG(opengl) bool QQuickShaderEffect::isOpenGLShaderEffect() const { return m_glImpl != Q_NULLPTR; } +#endif QT_END_NAMESPACE diff --git a/src/quick/items/qquickshadereffect_p.h b/src/quick/items/qquickshadereffect_p.h index d269dc5e50..30bd018098 100644 --- a/src/quick/items/qquickshadereffect_p.h +++ b/src/quick/items/qquickshadereffect_p.h @@ -117,7 +117,9 @@ public: bool isComponentComplete() const; QString parseLog(); +#if QT_CONFIG(opengl) bool isOpenGLShaderEffect() const; +#endif Q_SIGNALS: void fragmentShaderChanged(); -- cgit v1.2.3 From 65e005a72d62d8a42a60e0b8b789d1f04da91ccf Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 23 Mar 2017 19:33:29 +0100 Subject: in childMouseEventFilter, touchpoint grabber is also the mouse grabber When an item (such as Flickable) filters its children's mouse events, sometimes the mouse event may be one that is synthesized from a touch point. If that touch point is already grabbed, then in the context of childMouseEventFilter QQuickWindow::mouseGrabberItem() should return the item which has grabbed the touchpoint from which the mouse event was synthesized. Otherwise, there was a regression in which an item which can be dragged via touch (such as Slider in QQ Controls 2) could have its grab stolen by a filtering parent, such as Flickable, or the gesture recognizer in QtLocation. mouseGrabberItem() was returning null because touchMouseId and touchMouseDevice were not set, and the actual mouse was not grabbed. If a touch event is used to synthesize a mouse event, and during delivery an Item steals the grab of the synthetic mouse event, the original grabber needs to be notified that it has lost the grab. Task-number: QTBUG-59416 Change-Id: Ib121b06121df7593c0d549a6df42397b8ead1c45 Reviewed-by: Paolo Angelelli --- src/quick/items/qquickwindow.cpp | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index e6245f90f3..924de3645b 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -746,6 +746,7 @@ void QQuickWindowPrivate::setMouseGrabber(QQuickItem *grabber) qCDebug(DBG_MOUSE_TARGET) << "grabber" << q->mouseGrabberItem() << "->" << grabber; QQuickItem *oldGrabber = q->mouseGrabberItem(); + bool fromTouch = false; if (grabber && touchMouseId != -1 && touchMouseDevice) { // update the touch item for mouse touch id to the new grabber @@ -753,6 +754,7 @@ void QQuickWindowPrivate::setMouseGrabber(QQuickItem *grabber) auto point = touchMouseDevice->pointerEvent()->pointById(touchMouseId); if (point) point->setGrabber(grabber); + fromTouch = true; } else { QQuickPointerEvent *event = QQuickPointerDevice::genericMouseDevice()->pointerEvent(); Q_ASSERT(event->pointCount() == 1); @@ -762,8 +764,11 @@ void QQuickWindowPrivate::setMouseGrabber(QQuickItem *grabber) if (oldGrabber) { QEvent e(QEvent::UngrabMouse); QSet hasFiltered; - if (!sendFilteredMouseEvent(oldGrabber->parentItem(), oldGrabber, &e, &hasFiltered)) + if (!sendFilteredMouseEvent(oldGrabber->parentItem(), oldGrabber, &e, &hasFiltered)) { oldGrabber->mouseUngrabEvent(); + if (fromTouch) + oldGrabber->touchUngrabEvent(); + } } } @@ -2585,28 +2590,39 @@ bool QQuickWindowPrivate::sendFilteredTouchEvent(QQuickItem *target, QQuickItem break; } + bool touchMouseUnset = (touchMouseId == -1); // Only deliver mouse event if it is the touchMouseId or it could become the touchMouseId - if (touchMouseId == -1 || touchMouseId == tp.id()) { + if (touchMouseUnset || touchMouseId == tp.id()) { // targetEvent is already transformed wrt local position, velocity, etc. // FIXME: remove asTouchEvent!!! QScopedPointer mouseEvent(touchToMouseEvent(t, tp, event->asTouchEvent(), item, false)); + // If a filtering item calls QQuickWindow::mouseGrabberItem(), it should + // report the touchpoint's grabber. Whenever we send a synthetic mouse event, + // touchMouseId and touchMouseDevice must be set, even if it's only temporarily and isn't grabbed. + touchMouseId = tp.id(); + touchMouseDevice = event->device(); if (target->childMouseEventFilter(item, mouseEvent.data())) { qCDebug(DBG_TOUCH) << " - second chance intercepted on childMouseEventFilter by " << target; if (t != QEvent::MouseButtonRelease) { qCDebug(DBG_TOUCH_TARGET) << "TP" << tp.id() << "->" << target; - touchMouseDevice = event->device(); - if (touchMouseId == -1) { + if (touchMouseUnset) { // the point was grabbed as a pure touch point before, now it will be treated as mouse // but the old receiver still needs to be informed if (auto oldGrabber = touchMouseDevice->pointerEvent()->pointById(tp.id())->grabber()) oldGrabber->touchUngrabEvent(); } - touchMouseId = tp.id(); + touchMouseUnset = false; // We want to leave touchMouseId and touchMouseDevice set target->grabMouse(); } filtered = true; } + if (touchMouseUnset) { + // Now that we're done sending a synth mouse event, and it wasn't grabbed, + // the touchpoint is no longer acting as a synthetic mouse. Restore previous state. + touchMouseId = -1; + touchMouseDevice = nullptr; + } // Only one event can be filtered as a mouse event. break; } -- cgit v1.2.3 From 6d7c3c0743b3c6aac7d7faa1ffd18798ceced0ac Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 23 Mar 2017 20:19:34 +0100 Subject: Flickable: don't steal grab from item with keepTouchGrab set Sometimes filterMouseEvent can be given a mouse event which was synthesized from a touch point which was already grabbed. In such cases, if the grabber has keepTouchGrab set, respect it. This makes it possible again for a QQControls 2 slider to be draggable inside a Flickable which is also draggable in the same direction. Task-number: QTBUG-59416 Change-Id: I93b7fd9cb846b1e574615154f9a54316b60c0477 Reviewed-by: J-P Nurmi --- src/quick/items/qquickflickable.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index 6a2946bdcc..27d7072f03 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -2301,7 +2301,8 @@ bool QQuickFlickable::filterMouseEvent(QQuickItem *receiver, QMouseEvent *event) bool receiverDisabled = receiver && !receiver->isEnabled(); bool stealThisEvent = d->stealMouse; - if ((stealThisEvent || contains(localPos)) && (!receiver || !receiver->keepMouseGrab() || receiverDisabled)) { + bool receiverKeepsGrab = receiver && (receiver->keepMouseGrab() || receiver->keepTouchGrab()); + if ((stealThisEvent || contains(localPos)) && (!receiver || !receiverKeepsGrab || receiverDisabled)) { QScopedPointer mouseEvent(QQuickWindowPrivate::cloneMouseEvent(event, &localPos)); mouseEvent->setAccepted(false); @@ -2321,7 +2322,7 @@ bool QQuickFlickable::filterMouseEvent(QQuickItem *receiver, QMouseEvent *event) default: break; } - if ((receiver && stealThisEvent && !receiver->keepMouseGrab() && receiver != this) || receiverDisabled) { + if ((receiver && stealThisEvent && !receiverKeepsGrab && receiver != this) || receiverDisabled) { d->clearDelayedPress(); grabMouse(); } else if (d->delayedPressEvent) { @@ -2337,7 +2338,7 @@ bool QQuickFlickable::filterMouseEvent(QQuickItem *receiver, QMouseEvent *event) d->lastPosTime = -1; returnToBounds(); } - if (event->type() == QEvent::MouseButtonRelease || (receiver && receiver->keepMouseGrab() && !receiverDisabled)) { + if (event->type() == QEvent::MouseButtonRelease || (receiverKeepsGrab && !receiverDisabled)) { // mouse released, or another item has claimed the grab d->lastPosTime = -1; d->clearDelayedPress(); -- cgit v1.2.3