Skip to content

Commit 4799fdf

Browse files
committed
Merge #809: Close console autocomplete when leaving Console tab
5021838 qml: close console autocomplete when leaving Console tab (Uqlidi) Pull request description: The RPC console lives as a persistent StackLayout child and its autocomplete Popup renders in the window overlay layer, so hiding the console on a tab switch does not hide the popup. It lingers over the newly selected tab. Add a `tabActive` property to CommandConsole, bound by DesktopWallets to `consoleTabButton.checked`, and close the popup when the tab is left. Keyed off the tab ButtonGroup rather than StackLayout visibility, which never reports the transition. fix #782 ACKs for top commit: johnny9: ACK 5021838 jarolrod: ACK 5021838 Tree-SHA512: 884dbacc6653bc3e38c1bf157a8b58cd0091f5986c00eb2079670a81e44021e0f13721055cae02645ef376d85817c30e41680e9b0683ee91ffbfdea21bd5a188
2 parents 2a998b7 + 5021838 commit 4799fdf

3 files changed

Lines changed: 29 additions & 0 deletions

File tree

qml/pages/node/CommandConsole.qml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ Page {
3030
property string commandDraft: ""
3131
property string searchDraft: ""
3232

33+
// True while this view's tab is the selected one. As a persistent StackLayout
34+
// child, the console is never destroyed on tab changes, and its autocomplete
35+
// Popup renders in the window overlay layer, so it is not hidden along with
36+
// the view. The embedder binds this to its tab's checked state; when the tab
37+
// is left, dismiss the popup so it cannot linger over the newly selected tab.
38+
property bool tabActive: true
39+
onTabActiveChanged: if (!tabActive) autocompletePopup.close()
40+
3341
function _pushPalette() {
3442
rpcConsoleModel.requestColor = consoleRequestColor
3543
rpcConsoleModel.replyColor = consoleReplyColor

qml/pages/wallet/DesktopWallets.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ Page {
346346
}
347347
CommandConsole {
348348
showHeader: false
349+
tabActive: consoleTabButton.checked
349350
walletName: walletController.isWalletLoaded && walletController.selectedWallet
350351
? walletController.selectedWallet.name
351352
: ""

test/qml/tst_desktopwallets.qml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,26 @@ TestCase {
9797
compare(tabs[3].iconSize, 30)
9898
}
9999

100+
function test_console_autocomplete_closes_when_switching_tabs() {
101+
const page = createDesktopWallets()
102+
const consoleTab = findChild(page, "consoleTabButton")
103+
const activityTab = findChild(page, "activityTabButton")
104+
const popup = findChild(page, "consoleAutocompletePopup")
105+
106+
verify(consoleTab !== null)
107+
verify(activityTab !== null)
108+
verify(popup !== null)
109+
110+
consoleTab.checked = true
111+
tryCompare(consoleTab, "checked", true)
112+
popup.open()
113+
tryCompare(popup, "visible", true)
114+
115+
activityTab.checked = true
116+
tryCompare(activityTab, "checked", true)
117+
tryCompare(popup, "visible", false)
118+
}
119+
100120
function test_receive_options_view_address_history_opens_settings_address_stack() {
101121
const page = createDesktopWallets()
102122
const receiveTab = findChild(page, "receiveTabButton")

0 commit comments

Comments
 (0)