@@ -27,13 +27,21 @@ Item {
2727
2828 property string nsFilterText: " "
2929 property int nsHighlightIndex: 0
30+ property bool nsListHovered: false
31+ property var nsFilteredListCache: []
3032
3133 readonly property var nsFilteredList: {
3234 var all = main? .namespaces ?? [];
3335 var q = root .nsFilterText .toLowerCase ();
3436 return q === " " ? all : all .filter (n => n .toLowerCase ().includes (q));
3537 }
3638
39+ onNsFilteredListChanged: {
40+ if (! root .nsListHovered ) {
41+ root .nsFilteredListCache = root .nsFilteredList ;
42+ }
43+ }
44+
3745 function nsSelectHighlighted () {
3846 var list = root .nsFilteredList ;
3947 if (list .length === 0 ) return ;
@@ -292,6 +300,7 @@ Item {
292300 onClicked: {
293301 nsDropdown .visible = ! nsDropdown .visible ;
294302 if (nsDropdown .visible ) {
303+ root .nsFilteredListCache = root .nsFilteredList ;
295304 Qt .callLater (function () {
296305 if (nsSearchInput .inputItem ) nsSearchInput .inputItem .forceActiveFocus ();
297306 });
@@ -340,7 +349,7 @@ Item {
340349 id: nsListScroll
341350 Layout .fillWidth : true
342351 Layout .preferredHeight : {
343- var filtered = root .nsFilteredList ;
352+ var filtered = root .nsFilteredListCache ;
344353 var count = filtered .length ;
345354 if (count === 0 ) return Math .round (32 * Style .uiScaleRatio );
346355 var rowH = nsListColumn .children .length > 0
@@ -349,15 +358,19 @@ Item {
349358 return Math .min (count, 4 ) * rowH;
350359 }
351360 horizontalPolicy: ScrollBar .AlwaysOff
352- verticalPolicy: root .nsFilteredList .length > 4 ? ScrollBar .AsNeeded : ScrollBar .AlwaysOff
361+ verticalPolicy: root .nsFilteredListCache .length > 4 ? ScrollBar .AsNeeded : ScrollBar .AlwaysOff
362+
363+ HoverHandler {
364+ onHoveredChanged: root .nsListHovered = hovered
365+ }
353366
354367 ColumnLayout {
355368 id: nsListColumn
356369 width: nsListScroll .availableWidth
357370 spacing: 0
358371
359372 Repeater {
360- model: root .nsFilteredList
373+ model: root .nsFilteredListCache
361374 delegate: ContextRow {
362375 required property string modelData
363376 required property int index
@@ -375,7 +388,7 @@ Item {
375388 }
376389
377390 NText {
378- visible: root .nsFilteredList .length === 0
391+ visible: root .nsFilteredListCache .length === 0
379392 text: pluginApi? .tr (" panel.noNamespaces" )
380393 pointSize: Style .fontSizeS
381394 color: Color .mOnSurfaceVariant
0 commit comments