Skip to content

Commit 6c52a36

Browse files
jagannatharjunrobUx4
authored andcommitted
qml: fix possible invalid access
fixes related warnings as well
1 parent 3d69677 commit 6c52a36

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

modules/gui/qt/network/qml/BrowseHomeDisplay.qml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ FocusScope {
3333

3434
// Properties
3535

36+
property bool _initialized: false
37+
property bool _resetFocusPendingAfterInitialization: false
38+
3639
property int leftPadding: 0
3740
property int rightPadding: 0
3841

@@ -69,8 +72,24 @@ FocusScope {
6972

7073
focus: true
7174

72-
onActiveFocusChanged: resetFocus()
7375

76+
Component.onCompleted: {
77+
_initialized = true
78+
if (_resetFocusPendingAfterInitialization) {
79+
resetFocus()
80+
81+
_resetFocusPendingAfterInitialization = false
82+
}
83+
}
84+
85+
onActiveFocusChanged: {
86+
if (!_initialized) {
87+
_resetFocusPendingAfterInitialization = true
88+
return
89+
}
90+
91+
resetFocus()
92+
}
7493

7594
function setCurrentItemFocus(reason) {
7695
if (foldersSection.visible)

0 commit comments

Comments
 (0)