improved result display when searching for dxvk/vkd3d
This commit is contained in:
@@ -1455,11 +1455,24 @@ class ComponentVersionSelectionDialog(QDialog):
|
||||
row += 1
|
||||
|
||||
def filter_versions(self):
|
||||
"""Фильтрует видимость кнопок версий на основе текста поиска."""
|
||||
"""Фильтрует видимость кнопок версий и перестраивает сетку для плотного отображения."""
|
||||
search_text = self.search_edit.text().lower()
|
||||
|
||||
visible_buttons = []
|
||||
for btn_widget in self.buttons:
|
||||
is_match = search_text in btn_widget.text().lower()
|
||||
btn_widget.setVisible(is_match)
|
||||
if search_text in btn_widget.text().lower():
|
||||
visible_buttons.append(btn_widget)
|
||||
|
||||
# Сначала скроем все кнопки, чтобы очистить сетку
|
||||
for btn_widget in self.buttons:
|
||||
btn_widget.setVisible(False)
|
||||
|
||||
# Затем добавим только видимые кнопки, перестраивая сетку
|
||||
num_columns = 3 # Как определено в populate_ui
|
||||
for i, btn_widget in enumerate(visible_buttons):
|
||||
row, col = divmod(i, num_columns)
|
||||
self.grid_layout.addWidget(btn_widget, row, col)
|
||||
btn_widget.setVisible(True)
|
||||
|
||||
def on_version_selected(self, version_name):
|
||||
"""Обрабатывает выбор версии."""
|
||||
|
Reference in New Issue
Block a user