From 2cacc1c07a1e361bb20411d3f19fdecb3009be12 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 15 Dec 2017 13:27:45 +0100 Subject: Add new logging category qt.quick.window.transient to monitor the increasing number of places from which the transient parent relationship can be detected; and a debug operator for QQuickWindow so that these log messages are more useful. [ChangeLog][QtQuick][QQuickWindow] added logging category qt.quick.window.transient to check detection of transient windows declared inside other Items and Windows Change-Id: Ic899af648765fcdc59b8da7dd1f1bed20db300f2 Reviewed-by: Frederik Gladhorn --- src/quick/items/qquickitem.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/quick/items/qquickitem.cpp') diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index bd37323ef9..4a44b1531a 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -86,6 +86,7 @@ QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(DBG_MOUSE_TARGET) Q_DECLARE_LOGGING_CATEGORY(DBG_HOVER_TRACE) +Q_DECLARE_LOGGING_CATEGORY(lcTransient) void debugFocusTree(QQuickItem *item, QQuickItem *scope = 0, int depth = 1) { @@ -3248,11 +3249,13 @@ void QQuickItemPrivate::data_append(QQmlListProperty *prop, QObject *o) } if (thisWindow) { - if (itemWindow) + if (itemWindow) { + qCDebug(lcTransient) << thisWindow << "is transient for" << itemWindow; thisWindow->setTransientParent(itemWindow); - else + } else { QObject::connect(item, SIGNAL(windowChanged(QQuickWindow*)), thisWindow, SLOT(setTransientParent_helper(QQuickWindow*))); + } } o->setParent(that); } -- cgit v1.2.3 From cbdbbe79ec141e66f3160a1332e49518f9682517 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Wed, 20 Dec 2017 13:48:07 +0100 Subject: Doc: correct Keys::shortcutOverride code snippet c4eefa4a added a snippet where an onEscapePressed handler had: event.accepted = true which is unnecessary, as the documentation says that handlers for specific key events set event.accepted to true by default. Change-Id: I1a40e6e82240a517ba5059a1d5d2217cc7968302 Reviewed-by: Shawn Rutledge --- src/quick/items/qquickitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/quick/items/qquickitem.cpp') diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 4a44b1531a..9adb993a2a 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -970,7 +970,7 @@ bool QQuickKeysAttached::isConnected(const char *signalName) const Keys.onEscapePressed: { console.log("escapeItem is handling escape"); - event.accepted = true; + // event.accepted is set to true by default for the specific key handlers } } -- cgit v1.2.3 From c7ebd4109a8c97164cfe8e1b8fca5a66a701cfa0 Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Wed, 13 Dec 2017 18:39:44 +0100 Subject: Move setVisible into QQuickItemPrivate Change-Id: I6bda48f5e982d8e93b8d9a604c275bc0cc0434de Reviewed-by: Shawn Rutledge --- src/quick/items/qquickitem.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'src/quick/items/qquickitem.cpp') diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 9adb993a2a..2865661fc7 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -5771,19 +5771,24 @@ bool QQuickItem::isVisible() const return d->effectiveVisible; } -void QQuickItem::setVisible(bool v) +void QQuickItemPrivate::setVisible(bool visible) { - Q_D(QQuickItem); - if (v == d->explicitVisible) + if (visible == explicitVisible) return; - d->explicitVisible = v; - if (!v) - d->dirty(QQuickItemPrivate::Visible); + explicitVisible = visible; + if (!visible) + dirty(QQuickItemPrivate::Visible); + + const bool childVisibilityChanged = setEffectiveVisibleRecur(calcEffectiveVisible()); + if (childVisibilityChanged && parentItem) + emit parentItem->visibleChildrenChanged(); // signal the parent, not this! +} - const bool childVisibilityChanged = d->setEffectiveVisibleRecur(d->calcEffectiveVisible()); - if (childVisibilityChanged && d->parentItem) - emit d->parentItem->visibleChildrenChanged(); // signal the parent, not this! +void QQuickItem::setVisible(bool v) +{ + Q_D(QQuickItem); + d->setVisible(v); } /*! -- cgit v1.2.3 From 76da60b5ad388b6873f496b07b2c3ccabe9c9490 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Fri, 5 Jan 2018 10:49:31 +0100 Subject: Doc: state that childrenRect is read-only Task-number: QTBUG-64115 Change-Id: I0246124a438328c062c37560b1b45c025078c681 Reviewed-by: J-P Nurmi --- src/quick/items/qquickitem.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/quick/items/qquickitem.cpp') diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 2865661fc7..af60ab879b 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -3654,8 +3654,9 @@ QQmlListProperty QQuickItemPrivate::data() \qmlproperty real QtQuick::Item::childrenRect.y \qmlproperty real QtQuick::Item::childrenRect.width \qmlproperty real QtQuick::Item::childrenRect.height + \readonly - This property holds the collective position and size of the item's + This read-only property holds the collective position and size of the item's children. This property is useful if you need to access the collective geometry -- cgit v1.2.3 From 52874a0e6f739ce410c8401e19b0a9ef6d02cabf Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 15 Jan 2018 11:30:26 +0100 Subject: Optimizations for Repeater::clear() and ~QQmlItem() QQmlRepeater::clear() had quadratic complexity in the number of items, because the items where removed from the back. Fix this by searching the cache from the back as well as searching for child items to remove from the back. Change-Id: I92e491a8abf47cee9d382ef15cd2471f722fa6dd Reviewed-by: Simon Hausmann --- src/quick/items/qquickitem.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/quick/items/qquickitem.cpp') diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index af60ab879b..54cb8be5da 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -2375,9 +2375,8 @@ QQuickItem::~QQuickItem() else if (d->window) d->derefWindow(); - // XXX todo - optimize while (!d->childItems.isEmpty()) - d->childItems.constFirst()->setParentItem(0); + d->childItems.constLast()->setParentItem(0); if (!d->changeListeners.isEmpty()) { const auto listeners = d->changeListeners; // NOTE: intentional copy (QTBUG-54732) @@ -2953,7 +2952,8 @@ void QQuickItemPrivate::removeChild(QQuickItem *child) Q_ASSERT(child); Q_ASSERT(childItems.contains(child)); - childItems.removeOne(child); + int idx = childItems.lastIndexOf(child); + childItems.removeAt(idx); Q_ASSERT(!childItems.contains(child)); QQuickItemPrivate *childPrivate = QQuickItemPrivate::get(child); -- cgit v1.2.3 From 187af5c7d2aab87545788f59eb8f8549e130c211 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 17 Jan 2018 11:37:14 +0100 Subject: Partially revert "Optimizations for Repeater::clear() and ~QQmlItem()" Reversing the destruction order in ~QQuickItem, and searching from the back in removeChild() wasn't such a good idea after all, as it breaks some assumptions people have about removing. We'll need to find a different solution for the quadratic behaviour coming from QQuickRepeater::clear(). This reverts parts of commit 52874a0e6f739ce410c8401e19b0a9ef6d02cabf. Change-Id: I5a6ff9f5ddd9f0f6667142dbcc568b6aba6f8ee9 Reviewed-by: Simon Hausmann --- src/quick/items/qquickitem.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/quick/items/qquickitem.cpp') diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 54cb8be5da..af60ab879b 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -2375,8 +2375,9 @@ QQuickItem::~QQuickItem() else if (d->window) d->derefWindow(); + // XXX todo - optimize while (!d->childItems.isEmpty()) - d->childItems.constLast()->setParentItem(0); + d->childItems.constFirst()->setParentItem(0); if (!d->changeListeners.isEmpty()) { const auto listeners = d->changeListeners; // NOTE: intentional copy (QTBUG-54732) @@ -2952,8 +2953,7 @@ void QQuickItemPrivate::removeChild(QQuickItem *child) Q_ASSERT(child); Q_ASSERT(childItems.contains(child)); - int idx = childItems.lastIndexOf(child); - childItems.removeAt(idx); + childItems.removeOne(child); Q_ASSERT(!childItems.contains(child)); QQuickItemPrivate *childPrivate = QQuickItemPrivate::get(child); -- cgit v1.2.3