File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,15 +7,31 @@ import QtQuick.Controls 2.15
77import QtQuick.Layouts 1.15
88
99Pane {
10+ id: root
11+
1012 property alias leftItem: left_section .contentItem
1113 property alias centerItem: center_section .contentItem
1214 property alias rightItem: right_section .contentItem
1315 property var navigationStack: null
16+ // Optional tab group supplied by a containing view. This lets content
17+ // pages close transient UI when the user selects a different tab.
18+ property var tabGroup: null
1419 property bool showBackButton: navigationStack ? navigationStack .canGoBack : false
1520 property string backButtonObjectName: " "
1621 property string backButtonText: qsTr (" Back" )
1722
1823 signal backClicked
24+ signal tabChanged (int index)
25+
26+ Connections {
27+ target: root .tabGroup
28+
29+ function onCheckedButtonChanged () {
30+ if (root .tabGroup .checkedButton ) {
31+ root .tabChanged (root .tabGroup .checkedButton .index )
32+ }
33+ }
34+ }
1935
2036 background: null
2137 padding: 4
Original file line number Diff line number Diff line change @@ -29,6 +29,20 @@ Page {
2929 property bool searchMode: false
3030 property string commandDraft: " "
3131 property string searchDraft: " "
32+ // DesktopWallets supplies its navigation bar so this persistent
33+ // StackLayout child can dismiss overlay-based transient UI on tab changes.
34+ property var navigationBar: null
35+ property int navigationIndex: - 1
36+
37+ Connections {
38+ target: root .navigationBar
39+
40+ function onTabChanged (index ) {
41+ if (index !== root .navigationIndex ) {
42+ autocompletePopup .close ()
43+ }
44+ }
45+ }
3246
3347 function _pushPalette () {
3448 rpcConsoleModel .requestColor = consoleRequestColor
Original file line number Diff line number Diff line change @@ -106,6 +106,7 @@ Page {
106106
107107 header: NavigationBar2 {
108108 id: navBar
109+ tabGroup: navigationTabs
109110 leftItem: WalletBadge {
110111 objectName: " walletBadge"
111112 implicitWidth: 175
@@ -346,6 +347,8 @@ Page {
346347 }
347348 CommandConsole {
348349 showHeader: false
350+ navigationBar: navBar
351+ navigationIndex: consoleTabButton .index
349352 walletName: walletController .isWalletLoaded && walletController .selectedWallet
350353 ? walletController .selectedWallet .name
351354 : " "
Original file line number Diff line number Diff 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" )
You can’t perform that action at this time.
0 commit comments