From b7d0f292f3ae4e2b641355d980b32032fb29e9cd Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 12 Nov 2021 17:53:23 +0200 Subject: [PATCH] effects/overview: Load desktop name editor on demand It's most likely going to be unused, so don't bother loading it. --- src/effects/overview/qml/DesktopBar.qml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/effects/overview/qml/DesktopBar.qml b/src/effects/overview/qml/DesktopBar.qml index 34c4dccc27..57fdea3e35 100644 --- a/src/effects/overview/qml/DesktopBar.qml +++ b/src/effects/overview/qml/DesktopBar.qml @@ -197,19 +197,20 @@ Item { } } - PC3.TextField { - id: editor + Loader { + active: label.state == "editing" anchors.fill: parent - visible: label.state == "editing" - focus: visible - topPadding: 0 - bottomPadding: 0 - text: delegate.desktop.name - onEditingFinished: { - delegate.desktop.name = text; - label.stopEditing(); + sourceComponent: PC3.TextField { + topPadding: 0 + bottomPadding: 0 + text: delegate.desktop.name + onEditingFinished: { + delegate.desktop.name = text; + label.stopEditing(); + } + Keys.onEscapePressed: label.stopEditing(); + Component.onCompleted: forceActiveFocus(); } - Keys.onEscapePressed: label.stopEditing(); } states: [ @@ -223,7 +224,6 @@ Item { function startEditing() { state = "editing"; - editor.forceActiveFocus(); } function stopEditing() { state = "normal";