From 7179846a0141c2683c30d03c43a7c12fde98801f Mon Sep 17 00:00:00 2001 From: Alberto Mardegan Date: Sat, 18 Jun 2016 16:07:27 +0300 Subject: QQuickDragAttached: set actual drag source when instantiating QDrag QDrag's constructor parameter is used as drag source in a DnD operation; objects receiving QDrag{Enter,Move,Leave}Event will get this object when calling event->source(). Task-number: QTBUG-54195 Change-Id: Id3ed7e8d62a8539983c7c21c45f8f1d72f9a2e30 Reviewed-by: Shawn Rutledge --- 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 e1b7ef47d8..71217ce146 100644 --- a/src/quick/items/qquickdrag.cpp +++ b/src/quick/items/qquickdrag.cpp @@ -713,7 +713,7 @@ Qt::DropAction QQuickDragAttachedPrivate::startDrag(Qt::DropActions supportedAct { Q_Q(QQuickDragAttached); - QDrag *drag = new QDrag(q); + QDrag *drag = new QDrag(source ? source : q); QMimeData *mimeData = new QMimeData(); Q_FOREACH (const QString &key, externalMimeData.keys()) { -- cgit v1.2.3 From fcc2c95421710f98c7b2dec73e2c8b0d9164bc9b Mon Sep 17 00:00:00 2001 From: Jonathan Liu Date: Wed, 24 Aug 2016 11:18:37 +1000 Subject: Workaround crashes in QtQml code related to dead-store elimination When compiled in release mode with GCC 6, QtQml may crash. This is because the C++ compiler is more aggressive about dead-store elimination in situations where a memory store to a location precedes the construction of an object at that memory location. The QV4::MemoryManager::allocate{Managed,Object} functions allocate memory and write to it before the caller does a placement new to construct an object in the same memory. The compiler considers these writes before the constructor as "dead stores" and eliminates them. The -fno-lifetime-dse compiler flag is added to disable this more aggressive dead-store eliminiation optimization. This is a temporary workaround until a proper solution is found. Task-number: QTBUG-55482 Change-Id: I7dbae6e9e613e53ce5fb25957c449bc6657803b5 Reviewed-by: Thiago Macieira --- src/qml/qml.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/qml/qml.pro b/src/qml/qml.pro index f4862a17a6..651afa6b75 100644 --- a/src/qml/qml.pro +++ b/src/qml/qml.pro @@ -18,7 +18,7 @@ exists("qqml_enable_gcov") { greaterThan(QT_GCC_MAJOR_VERSION, 5) { # Our code is bad. Temporary workaround. - QMAKE_CXXFLAGS += -fno-delete-null-pointer-checks + QMAKE_CXXFLAGS += -fno-delete-null-pointer-checks -fno-lifetime-dse } QMAKE_DOCS = $$PWD/doc/qtqml.qdocconf -- cgit v1.2.3 From c14c382e6e8527be1129788ccca31309b032f99c Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 26 Aug 2016 12:57:58 -0500 Subject: Allow for garbage collection of types with errors in trimCache() Change-Id: I821ea14f60871735bface4e2cf4e61fcb61b2784 Task-number: QTBUG-55567 Reviewed-by: Michael Brasser Reviewed-by: Ulf Hermann --- src/qml/qml/qqmltypeloader.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 01200fd881..6480420212 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -1961,8 +1961,10 @@ void QQmlTypeLoader::trimCache() QList unneededTypes; for (TypeCache::Iterator iter = m_typeCache.begin(), end = m_typeCache.end(); iter != end; ++iter) { QQmlTypeData *typeData = iter.value(); - if (typeData->m_compiledData && typeData->count() == 1 - && typeData->m_compiledData->count() == 1) { + + const bool hasError = !typeData->m_compiledData && !typeData->m_errors.isEmpty(); + const bool isNotReferenced = typeData->m_compiledData && typeData->m_compiledData->count() == 1; + if (typeData->count() == 1 && (hasError || isNotReferenced)) { // There are no live objects of this type unneededTypes.append(iter); } -- cgit v1.2.3 From dcede8bbe1a4e1401679d42bf7179305771d0c5a Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 1 Sep 2016 11:17:23 +0200 Subject: QtQml: Disable new optimizer of MSVC2015/Update 3 Add compiler option -d2SSAOptimizer- for this version of the compiler since it causes crashes. Task-number: QTBUG-55238 Change-Id: I9b38c669ad25f519150dd352b402dec982dc5555 Reviewed-by: Simon Hausmann Reviewed-by: Thiago Macieira --- src/qml/qml.pro | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/qml/qml.pro b/src/qml/qml.pro index 651afa6b75..7c9eef6df1 100644 --- a/src/qml/qml.pro +++ b/src/qml/qml.pro @@ -21,6 +21,10 @@ greaterThan(QT_GCC_MAJOR_VERSION, 5) { QMAKE_CXXFLAGS += -fno-delete-null-pointer-checks -fno-lifetime-dse } +# QTBUG-55238, disable new optimizer for MSVC 2015/Update 3. +release:win32-msvc*:equals(QT_CL_MAJOR_VERSION, 19):equals(QT_CL_MINOR_VERSION, 00): \ + greaterThan(QT_CL_PATCH_VERSION, 24212):QMAKE_CXXFLAGS += -d2SSAOptimizer- + QMAKE_DOCS = $$PWD/doc/qtqml.qdocconf # 2415: variable "xx" of static storage duration was declared but never referenced -- cgit v1.2.3 From 03e64ff6e60ebb2c0ea1b9f408d82367e68b6514 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Fri, 2 Sep 2016 15:42:01 +0200 Subject: Document that attached properties are created in C++ There was some uncertainty about whether or not it could be done from QML, which it can't. This patch also links to the documentation for creating custom attached objects. Change-Id: Icb9eff0ec96e7911b8d401bd38813bbd6eda227d Reviewed-by: Gavin Kistner Reviewed-by: Simon Hausmann --- src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc b/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc index 04d0d0ed2e..b0e262d2b9 100644 --- a/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc +++ b/src/qml/doc/src/qmllanguageref/syntax/objectattributes.qdoc @@ -855,7 +855,8 @@ are otherwise unavailable to the object. In particular, they allow objects to access properties or signals that are specifically relevant to the individual object. -A QML type implementation may choose to create an \e {attaching type} with +A QML type implementation may choose to \l {Providing Attached Objects for +Data Annotations}{create an \e {attaching type} in C++} with particular properties and signals. Instances of this type can then be created and \e attached to specific objects at run time, allowing those objects to access the properties and signals of the attaching type. These are accessed by -- cgit v1.2.3 From 82176ad2090b236e3255a8b4ae26557e4bc932c0 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 5 Sep 2016 17:21:29 +0200 Subject: Fix grammar in "Keyboard Focus in Qt Quick" documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I7f5ff2026ed00cacbc07484263c31397555622f1 Reviewed-by: Topi Reiniƶ --- src/quick/doc/src/concepts/input/focus.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/quick/doc/src/concepts/input/focus.qdoc b/src/quick/doc/src/concepts/input/focus.qdoc index db84961d20..ec4e4ca2d9 100644 --- a/src/quick/doc/src/concepts/input/focus.qdoc +++ b/src/quick/doc/src/concepts/input/focus.qdoc @@ -117,7 +117,7 @@ the focus, but it cannot control the focus when it is imported or reused. Likewise, the \c window component does not have the ability to know if its imported components are requesting the focus. -To solve this problem, the QML introduces a concept known as a \e {focus scope}. +To solve this problem, QML introduces a concept known as a \e {focus scope}. For existing Qt users, a focus scope is like an automatic focus proxy. A focus scope is created by declaring the \l FocusScope type. -- cgit v1.2.3 From c1d726fe19c83cf081042e55ace9d9d7b31c40e6 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Thu, 25 Aug 2016 12:31:20 +0200 Subject: Correctly update the geometry of QSGDefaultPainterNode When using a FBO, the source rect should be the painted part (m_textureSize) of the FBO. Also, the texture size is now correctly set when using an Image render target. Task-number: QTBUG-52054 Change-Id: If5d7a9c0b02f16f5d4be2cdf8c3c4cb15cb0583e Reviewed-by: Andy Shaw Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/quick/scenegraph/util/qsgdefaultpainternode.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/quick/scenegraph/util/qsgdefaultpainternode.cpp b/src/quick/scenegraph/util/qsgdefaultpainternode.cpp index e3103341cd..7a92d61016 100644 --- a/src/quick/scenegraph/util/qsgdefaultpainternode.cpp +++ b/src/quick/scenegraph/util/qsgdefaultpainternode.cpp @@ -218,7 +218,7 @@ void QSGDefaultPainterNode::updateGeometry() if (m_actualRenderTarget == QQuickPaintedItem::Image) source = QRectF(0, 0, 1, 1); else - source = QRectF(0, 0, qreal(m_size.width()) / m_fboSize.width(), qreal(m_size.height()) / m_fboSize.height()); + source = QRectF(0, 0, qreal(m_textureSize.width()) / m_fboSize.width(), qreal(m_textureSize.height()) / m_fboSize.height()); QRectF dest(0, 0, m_size.width(), m_size.height()); if (m_actualRenderTarget == QQuickPaintedItem::InvertedYFramebufferObject) dest = QRectF(QPointF(0, m_size.height()), QPointF(m_size.width(), 0)); @@ -300,7 +300,7 @@ void QSGDefaultPainterNode::updateRenderTarget() QSGPainterTexture *texture = new QSGPainterTexture; if (m_actualRenderTarget == QQuickPaintedItem::Image) { texture->setOwnsTexture(true); - texture->setTextureSize(m_size); + texture->setTextureSize(m_textureSize); } else { texture->setTextureId(m_fbo->texture()); texture->setOwnsTexture(false); -- cgit v1.2.3 From 2a7bfd6b37552b5812fa0e18f0212121d6c1703a Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 9 Sep 2016 14:52:05 +1000 Subject: Destroy an incubating delegate if it is removed before incubation completes Removing an item from a model after its delegate has started incubation, but before it has completed results is an orphaned item. Task-number: QTBUG-55901 Change-Id: I3d3136dc05a950ca38d53687ae7d38a6d0c7ec35 Reviewed-by: Andrew den Exter --- src/qml/types/qqmldelegatemodel.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index f2de911725..21f89cd4ec 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -1310,9 +1310,23 @@ void QQmlDelegateModelPrivate::itemsRemoved( } } else { if (QQDMIncubationTask *incubationTask = cacheItem->incubationTask) { - for (int i = 1; i < m_groupCount; ++i) { - if (remove.inGroup(i)) - incubationTask->index[i] = remove.index[i]; + if (!cacheItem->isObjectReferenced()) { + releaseIncubator(cacheItem->incubationTask); + cacheItem->incubationTask = 0; + if (cacheItem->object) { + QObject *object = cacheItem->object; + cacheItem->destroyObject(); + if (QQuickPackage *package = qmlobject_cast(object)) + emitDestroyingPackage(package); + else + emitDestroyingItem(object); + } + cacheItem->scriptRef -= 1; + } else { + for (int i = 1; i < m_groupCount; ++i) { + if (remove.inGroup(i)) + incubationTask->index[i] = remove.index[i]; + } } } if (QQmlDelegateModelAttached *attached = cacheItem->attached) { -- cgit v1.2.3 From 43a65845e6148a2346b2ccdb2442cef6c43df94c Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Thu, 8 Sep 2016 13:59:13 +0200 Subject: QQuickTextInput: avoid emitting editingFinished twice On platforms like iOS, hiding the virtual keyboard will force the current focus object to lose focus. And when QQuickTextInput loses focus, it will emit editingFinished. To not emit the signal once more directly after hiding the keyboard, we add an extra check in the key event handler to verify that we still have focus. Task-number: QTBUG-44038 Change-Id: Ib64f7028a9f16a172b3c38cab72f3599d560e331 Reviewed-by: Liang Qi Reviewed-by: Shawn Rutledge --- src/quick/items/qquicktextinput.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index f3b217dd7f..072bfd3440 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -4197,8 +4197,13 @@ void QQuickTextInputPrivate::processKeyEvent(QKeyEvent* event) if (!(q->inputMethodHints() & Qt::ImhMultiLine)) inputMethod->hide(); + if (activeFocus) { + // If we lost focus after hiding the virtual keyboard, we've already emitted + // editingFinished from handleFocusEvent. Otherwise we emit it now. + emit q->editingFinished(); + } + emit q->accepted(); - emit q->editingFinished(); } event->ignore(); return; -- cgit v1.2.3 From 4e6c5eade5504b335e31bd0950b9a702f8db58e7 Mon Sep 17 00:00:00 2001 From: Eike Hein Date: Thu, 21 Jan 2016 00:01:12 +0100 Subject: Propagate window enter event as hover enter event in QQuickWindow QQuickWindow currently propagates window leave events as hover leave events to its content item, but it does not propagate window enter events as corresponding hover enter events. Instead, hover enter is only triggered implicitly by mouse moves. This can cause problems when there is no mouse movement inbetween the window being entered and a subsequent button press event. A common example where this occurs is dismissing a mouse-grabbing popup window (e.g. a QMenu) by clicking outside the popup, and then clicking in the same spot that was clicked to dismiss the popup. Without this patch, hover state is not realized until movement occurs, so there may be no no visual feedback and code that needs to update state based on what is being hovered prior to handling a press event can't work correctly. This patch synthesizes a QHoverEvent and delivers it in response to QEvent::Enter, similar to how QEvent::Leave is already handled. QWidget handles this correctly via QWidget::enterEvent. The equivalent in Qt Quick is QQuickItem::hoverEnterEvent, ultimately called with the synthesized event. The patch also updates the touchmouse::hoverEnabled autotest. Due to the window enter event now being handled correctly, exitSpy2 would run up a count() of 2, as the cursor was not in a neutral position after previous test cases. The change makes sure the cursor is in a neutral position before test case activity. [ChangeLog][QQuickWindow] The relevant child item is now sent a hover event when the window receives a QEnterEvent, making sure hovering is recognized without waiting for mouse movement. Change-Id: If0586f6cd971df0dfc266bb1a39c9cdb184fd286 Reviewed-by: Shawn Rutledge --- src/quick/items/qquickwindow.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 8a2471b34f..26d83cfdf5 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -1437,6 +1437,15 @@ bool QQuickWindow::event(QEvent *e) // return in order to avoid the QWindow::event below return d->deliverTouchCancelEvent(static_cast(e)); break; + case QEvent::Enter: { + QEnterEvent *enter = static_cast(e); + bool accepted = enter->isAccepted(); + bool delivered = d->deliverHoverEvent(d->contentItem, enter->windowPos(), d->lastMousePosition, + QGuiApplication::keyboardModifiers(), 0L, accepted); + enter->setAccepted(accepted); + return delivered; + } + break; case QEvent::Leave: d->clearHover(); d->lastMousePosition = QPoint(); -- cgit v1.2.3