From 342f18c71f51227a062bd204037541ecae150846 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Tue, 4 Oct 2016 12:58:02 +0200 Subject: Check qgl_current_fbo_invalid before using qgl_current_fbo QSG24BitTextMaskShader::useSRGB() on macOS accesses the current context qgl_current_fbo member without first checking if it is valid. Make sure it also checks qgl_current_fbo_invalid, thus not accidentally dereferencing a dangling pointer. Change-Id: I56a77de23ee3b4b271bd848506ff26e14d7b6d15 Reviewed-by: Laszlo Agocs --- src/quick/scenegraph/qsgdefaultglyphnode_p.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp index 3eba29ba41..5ef5c79416 100644 --- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp +++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp @@ -233,7 +233,8 @@ bool QSG24BitTextMaskShader::useSRGB() const // m_useSRGB is true, but if some QOGLFBO was bound check it's texture format: QOpenGLContext *ctx = QOpenGLContext::currentContext(); QOpenGLFramebufferObject *qfbo = QOpenGLContextPrivate::get(ctx)->qgl_current_fbo; - return !qfbo || qfbo->format().internalTextureFormat() == GL_SRGB8_ALPHA8_EXT; + bool fboInvalid = QOpenGLContextPrivate::get(ctx)->qgl_current_fbo_invalid; + return !qfbo || fboInvalid || qfbo->format().internalTextureFormat() == GL_SRGB8_ALPHA8_EXT; #else return m_useSRGB; #endif -- cgit v1.2.3 From 67e5fe1675b459de9a688be2509a060e8ccecc9e Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Sat, 1 Oct 2016 01:44:59 +0200 Subject: Remove superfluous warning statement in QAccessibleQuickItem::rect() The warning statement is printed whenever a successful hit test (essentialy a hover) happens on a QML item which is accessible (e.g. a Label) and also not visible. The message looks like "QQuickText QVariant(Invalid) QRect(0,0 0x0)". The information serves no real purpose though: 1) The property accessibleText is not set anywhere 2) The warning happens in a valid use case when an item is invisible, and the user mouse accidentally hovers over its position Change-Id: I8d20f7842d92c7944bb5e3b614ecd6fad500102a Reviewed-by: Frederik Gladhorn --- src/quick/accessible/qaccessiblequickitem.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src') diff --git a/src/quick/accessible/qaccessiblequickitem.cpp b/src/quick/accessible/qaccessiblequickitem.cpp index 2ce914c0b6..df99d43531 100644 --- a/src/quick/accessible/qaccessiblequickitem.cpp +++ b/src/quick/accessible/qaccessiblequickitem.cpp @@ -61,10 +61,6 @@ int QAccessibleQuickItem::childCount() const QRect QAccessibleQuickItem::rect() const { const QRect r = itemScreenRect(item()); - - if (!r.isValid()) { - qWarning() << item()->metaObject()->className() << item()->property("accessibleText") << r; - } return r; } -- cgit v1.2.3 From 6d732026a518741718528052656a513761451b31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Fri, 14 Oct 2016 12:05:08 +0100 Subject: Fix docs about ownership when QObject has a parent If you return a QObject with parent from a Q_INVOKABLE it *does* get QQmlEngine::JavaScriptOwnership. It just doesn't get deleted by JavaScript (until you unset it's parent). Change-Id: Id56debe06253ea1dd31dee844f5047d4ac055024 Reviewed-by: Simon Hausmann --- src/qml/doc/src/cppintegration/data.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/qml/doc/src/cppintegration/data.qdoc b/src/qml/doc/src/cppintegration/data.qdoc index ff30bffa83..1b75f6d14e 100644 --- a/src/qml/doc/src/cppintegration/data.qdoc +++ b/src/qml/doc/src/cppintegration/data.qdoc @@ -52,8 +52,8 @@ remain with C++ by invoking QQmlEngine::setObjectOwnership() with QQmlEngine::CppOwnership specified. Additionally, the QML engine respects the normal QObject parent ownership -semantics of Qt C++ objects, and will not ever take ownership of a QObject -instance which already has a parent. +semantics of Qt C++ objects, and will never delete a QObject instance which +has a parent. \section1 Basic Qt Data Types -- cgit v1.2.3 From 654e9e6a35682d2dbd468b82a954b55fef8b6e70 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sat, 15 Oct 2016 13:19:07 +0200 Subject: QQuickWindow: don't discard timestamps for wheel events Noticed while debugging QTBUG-56075 on XCB. QQuickFlickable did not receive timestamps for wheel events provided by XI2. This alone does not fix the flicking speed issue with high-precision trackpads, but is needed to be able to calculate the appropriate velocity. Task-number: QTBUG-56075 Change-Id: I458e6302aee72863cdc1f8e8f7d99449016905a9 Reviewed-by: Shawn Rutledge --- src/quick/items/qquickwindow.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 26d83cfdf5..7875005e2d 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -1827,6 +1827,7 @@ bool QQuickWindowPrivate::deliverWheelEvent(QQuickItem *item, QWheelEvent *event if (item->contains(p)) { QWheelEvent wheel(p, p, event->pixelDelta(), event->angleDelta(), event->delta(), event->orientation(), event->buttons(), event->modifiers(), event->phase(), event->source()); + wheel.setTimestamp(event->timestamp()); wheel.accept(); q->sendEvent(item, &wheel); if (wheel.isAccepted()) { -- cgit v1.2.3 From e858dc4701912c5c4e94a99d819d3a86a6ee92b3 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Wed, 19 Oct 2016 09:27:10 +0200 Subject: Fix TextInput::selectByMouse documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I41ef6b38e74162434c397535f9d73fff80e29c78 Reviewed-by: Topi Reiniƶ --- src/quick/items/qquicktextinput.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 072bfd3440..9e4b01a373 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -2206,8 +2206,8 @@ QString QQuickTextInput::displayText() const If true, the user can use the mouse to select text in some platform-specific way. Note that for some platforms this may - not be an appropriate interaction (eg. may conflict with how - the text needs to behave inside a Flickable. + not be an appropriate interaction (it may conflict with how + the text needs to behave inside a \l Flickable, for example). */ bool QQuickTextInput::selectByMouse() const { -- cgit v1.2.3 From 9f6ae7fce68d1592b71be7df7ebfffade60ef737 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 21 Oct 2016 18:38:50 +0200 Subject: Fix QML Compiler crash After commit 2afb54fb51091765f79548b0b057795bc3c6eb38, Primitive::undefinedValue() uses setM() to clear out all bits. Previously that code was #ifndef'ed out for the bootstrap build, but now that we can do the correct boxing in host builds (as we know the pointer size), we can re-enable setM() in bootstrap builds and fix this crash that was a Q_UNREACHABLE() assertion. Change-Id: I49036792c06c9a17272aba65261ab8f32beb2ad8 Task-number: QTBUG-56658 Reviewed-by: Friedemann Kleint Reviewed-by: Lars Knoll --- src/qml/jsruntime/qv4value_p.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src') diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h index 13339129eb..5b6688f6b4 100644 --- a/src/qml/jsruntime/qv4value_p.h +++ b/src/qml/jsruntime/qv4value_p.h @@ -169,10 +169,7 @@ public: Q_ALWAYS_INLINE quint32 value() const { return _val & quint64(~quint32(0)); } Q_ALWAYS_INLINE quint32 tag() const { return _val >> 32; } -#if defined(V4_BOOTSTRAP) - Q_ALWAYS_INLINE Heap::Base *m() const { Q_UNREACHABLE(); return Q_NULLPTR; } - Q_ALWAYS_INLINE void setM(Heap::Base *b) { Q_UNUSED(b); Q_UNREACHABLE(); } -#elif defined(QV4_USE_64_BIT_VALUE_ENCODING) +#if defined(QV4_USE_64_BIT_VALUE_ENCODING) Q_ALWAYS_INLINE Heap::Base *m() const { Heap::Base *b; -- cgit v1.2.3 From c849f3a7eff55d60c4010831ec67336c5c0f2a27 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 26 Oct 2016 08:21:00 +0200 Subject: Fix documentation for dragFinished signal Change-Id: I9a38ab8ff60921e6d5ff6c2fa476b24d28781feb Reviewed-by: Venugopal Shivashankar --- src/quick/items/qquickdrag.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp index 71217ce146..d3c7adf2ba 100644 --- a/src/quick/items/qquickdrag.cpp +++ b/src/quick/items/qquickdrag.cpp @@ -701,7 +701,7 @@ void QQuickDragAttached::cancel() */ /*! - \qmlattachedsignal QtQuick::Drag::dragFinished(DropAction action) + \qmlattachedsignal QtQuick::Drag::dragFinished(DropAction dropAction) This signal is emitted when a drag finishes and the drag was started with the \l startDrag() method or started automatically using the \l dragType property. -- cgit v1.2.3 From 93d7c26653757755ae65f14d06d6df6f9ec2fc07 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 16 Oct 2016 19:21:29 +0200 Subject: QQuickShortcut: allow setting a custom context matcher This allows Qt Quick Controls 2 to register a shortcut context matcher that makes shortcuts behave well with QQC2's item-based popups, which QQuickShortcut is not aware of. Task-number: QTBUG-56562 Change-Id: Ia2518fd6ac7140f60aa38c7d9af557007e9db23b Reviewed-by: Mitch Curtis Reviewed-by: Qt CI Bot --- src/quick/util/qquickshortcut.cpp | 55 +++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/quick/util/qquickshortcut.cpp b/src/quick/util/qquickshortcut.cpp index 9725ddd671..3e04161639 100644 --- a/src/quick/util/qquickshortcut.cpp +++ b/src/quick/util/qquickshortcut.cpp @@ -41,10 +41,9 @@ #include #include +#include #include -QT_BEGIN_NAMESPACE - /*! \qmltype Shortcut \instantiates QQuickShortcut @@ -89,6 +88,39 @@ QT_BEGIN_NAMESPACE The corresponding handler is \c onActivatedAmbiguously. */ +static bool qQuickShortcutContextMatcher(QObject *obj, Qt::ShortcutContext context) +{ + switch (context) { + case Qt::ApplicationShortcut: + return true; + case Qt::WindowShortcut: + while (obj && !obj->isWindowType()) { + obj = obj->parent(); + if (QQuickItem *item = qobject_cast(obj)) + obj = item->window(); + } + return obj && obj == QGuiApplication::focusWindow(); + default: + return false; + } +} + +typedef bool (*ContextMatcher)(QObject *, Qt::ShortcutContext); + +Q_GLOBAL_STATIC_WITH_ARGS(ContextMatcher, ctxMatcher, (qQuickShortcutContextMatcher)) + +Q_QUICK_PRIVATE_EXPORT ContextMatcher qt_quick_shortcut_context_matcher() +{ + return *ctxMatcher(); +} + +Q_QUICK_PRIVATE_EXPORT void qt_quick_set_shortcut_context_matcher(ContextMatcher matcher) +{ + *ctxMatcher() = matcher; +} + +QT_BEGIN_NAMESPACE + QQuickShortcut::QQuickShortcut(QObject *parent) : QObject(parent), m_id(0), m_enabled(true), m_completed(false), m_autorepeat(true), m_context(Qt::WindowShortcut) { @@ -278,30 +310,13 @@ bool QQuickShortcut::event(QEvent *event) return false; } -static bool qQuickShortcutContextMatcher(QObject *obj, Qt::ShortcutContext context) -{ - switch (context) { - case Qt::ApplicationShortcut: - return true; - case Qt::WindowShortcut: - while (obj && !obj->isWindowType()) { - obj = obj->parent(); - if (QQuickItem *item = qobject_cast(obj)) - obj = item->window(); - } - return obj && obj == QGuiApplication::focusWindow(); - default: - return false; - } -} - void QQuickShortcut::grabShortcut(const QKeySequence &sequence, Qt::ShortcutContext context) { ungrabShortcut(); if (m_completed && !sequence.isEmpty()) { QGuiApplicationPrivate *pApp = QGuiApplicationPrivate::instance(); - m_id = pApp->shortcutMap.addShortcut(this, sequence, context, qQuickShortcutContextMatcher); + m_id = pApp->shortcutMap.addShortcut(this, sequence, context, *ctxMatcher()); if (!m_enabled) pApp->shortcutMap.setShortcutEnabled(false, m_id, this); if (!m_autorepeat) -- cgit v1.2.3