fix: fix card overlap on display_filter change

Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
This commit is contained in:
2025-10-13 12:14:54 +05:00
parent 987199d8e6
commit b1047ba18e
2 changed files with 51 additions and 19 deletions

View File

@@ -100,6 +100,7 @@ class MainWindow(QMainWindow):
self.games_load_timer.timeout.connect(self.finalize_game_loading)
self.games_loaded.connect(self.on_games_loaded)
self.current_add_game_dialog = None
self.current_display_filter = read_display_filter()
self.settingsDebounceTimer = QTimer(self)
self.settingsDebounceTimer.setSingleShot(True)
@@ -820,6 +821,24 @@ class MainWindow(QMainWindow):
for i, btn in self.tabButtons.items():
btn.setChecked(i == index)
self.stackedWidget.setCurrentIndex(index)
if hasattr(self, "game_library_manager"):
mgr = self.game_library_manager
if mgr.gamesListWidget and mgr.gamesListLayout:
layout = mgr.gamesListLayout
widget = mgr.gamesListWidget
QTimer.singleShot(0, lambda: (
layout.invalidate(),
widget.adjustSize(),
widget.updateGeometry()
))
if hasattr(self, "autoInstallContainer") and hasattr(self, "autoInstallContainerLayout"):
layout = self.autoInstallContainerLayout
widget = self.autoInstallContainer
QTimer.singleShot(0, lambda: (
layout.invalidate(),
widget.adjustSize(),
widget.updateGeometry()
))
def openSystemOverlay(self):
"""Opens the system overlay dialog."""
@@ -1978,9 +1997,12 @@ class MainWindow(QMainWindow):
def applySettingsDelayed(self):
read_time_config()
self.games = []
self.loadGames()
display_filter = read_display_filter()
reload_needed = display_filter != self.current_display_filter
if reload_needed:
self.games = []
self.loadGames()
self.current_display_filter = display_filter
for card in self.game_library_manager.game_card_cache.values():
card.update_badge_visibility(display_filter)
@@ -1995,6 +2017,10 @@ class MainWindow(QMainWindow):
filter_idx = self.gamesDisplayCombo.currentIndex()
filter_key = self.filter_keys[filter_idx]
old_filter = self.current_display_filter
save_display_filter(filter_key)
save_display_filter(filter_key)
proxy_url = self.proxyUrlEdit.text().strip()
@@ -2011,17 +2037,19 @@ class MainWindow(QMainWindow):
rumble_enabled = self.gamepadRumbleCheckBox.isChecked()
save_rumble_config(rumble_enabled)
for card in self.game_library_manager.game_card_cache.values():
card.update_badge_visibility(filter_key)
if filter_key != old_filter:
for card in self.game_library_manager.game_card_cache.values():
card.update_badge_visibility(filter_key)
if self.currentDetailPage and self.current_exec_line:
current_game = next((game for game in self.games if game[4] == self.current_exec_line), None)
if current_game:
self.stackedWidget.removeWidget(self.currentDetailPage)
self.currentDetailPage.deleteLater()
self.currentDetailPage = None
self.openGameDetailPage(*current_game)
if self.currentDetailPage and self.current_exec_line:
current_game = next((game for game in self.games if game[4] == self.current_exec_line), None)
if current_game:
self.stackedWidget.removeWidget(self.currentDetailPage)
self.currentDetailPage.deleteLater()
self.currentDetailPage = None
self.openGameDetailPage(*current_game)
self.current_display_filter = filter_key
self.settingsDebounceTimer.start()
gamepad_connected = self.input_manager.find_gamepad() is not None