From a88b74beb5b5c38ebe7140873d2353ec3d2d16f4 Mon Sep 17 00:00:00 2001 From: Paul Ebbers Date: Sun, 12 Jan 2025 20:09:05 +0100 Subject: [PATCH] When typing the second row is selected, so enter activates that command --- SearchBox.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/SearchBox.py b/SearchBox.py index 492f1f3..f9a0ae7 100644 --- a/SearchBox.py +++ b/SearchBox.py @@ -2,14 +2,14 @@ import FreeCAD as App import FreeCADGui as Gui import os -from PySide.QtCore import ( +from PySide6.QtCore import ( Qt, SIGNAL, QSize, QIdentityProxyModel, QPoint, ) -from PySide.QtWidgets import ( +from PySide6.QtWidgets import ( QTabWidget, QSlider, QSpinBox, @@ -28,7 +28,7 @@ from PySide.QtWidgets import ( QApplication, QListWidget, ) -from PySide.QtGui import ( +from PySide6.QtGui import ( QIcon, QPixmap, QColor, @@ -338,6 +338,8 @@ class SearchBox(QLineEdit): return group else: subitems = filterGroups(group["subitems"]) + # if len(subitems) == 0: + # self.index = 0 if len(subitems) > 0 or matches(group["text"]): return { "id": group["id"], @@ -373,9 +375,10 @@ class SearchBox(QLineEdit): self.proxyModel.setSourceModel(self.mdl) self.currentExtraInfo = None # Unset this so that the ExtraInfo can be updated # TODO: try to find the already-highlighted item + indexSelect = 1 nbRows = self.listView.model().rowCount() if nbRows > 0: - index = self.listView.model().index(0, 0) + index = self.listView.model().index(indexSelect, 0) self.listView.setCurrentIndex(index) self.setExtraInfo(index) else: