From 880c76da2478a8f618a3d5a762e56e33d7259a3a Mon Sep 17 00:00:00 2001 From: Stenzek Date: Tue, 14 Jan 2025 13:53:05 +1000 Subject: [PATCH] Qt: Fix columns being hidden after editing cheats --- src/duckstation-qt/gamecheatsettingswidget.cpp | 8 +++++++- src/duckstation-qt/gamecheatsettingswidget.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/duckstation-qt/gamecheatsettingswidget.cpp b/src/duckstation-qt/gamecheatsettingswidget.cpp index c551d53872..c62b9b7b4e 100644 --- a/src/duckstation-qt/gamecheatsettingswidget.cpp +++ b/src/duckstation-qt/gamecheatsettingswidget.cpp @@ -436,6 +436,11 @@ void GameCheatSettingsWidget::disableAllCheats() void GameCheatSettingsWidget::resizeEvent(QResizeEvent* event) { QWidget::resizeEvent(event); + resizeColumns(); +} + +void GameCheatSettingsWidget::resizeColumns() +{ QtUtils::ResizeColumnsForTreeView(m_ui.cheatList, {-1, 150}); } @@ -518,8 +523,9 @@ void GameCheatSettingsWidget::reloadList() // Hide root indicator when there's no groups, frees up some whitespace. m_ui.cheatList->setRootIsDecorated(!m_parent_map.empty()); - // Expand all items. + // Expand all items, and ensure the size is correct. Otherwise editing codes resizes it. expandAllItems(); + resizeColumns(); } void GameCheatSettingsWidget::expandAllItems() diff --git a/src/duckstation-qt/gamecheatsettingswidget.h b/src/duckstation-qt/gamecheatsettingswidget.h index 23c805a0ec..b49306d2da 100644 --- a/src/duckstation-qt/gamecheatsettingswidget.h +++ b/src/duckstation-qt/gamecheatsettingswidget.h @@ -71,6 +71,7 @@ private Q_SLOTS: QStandardItem* getTreeWidgetParent(const std::string_view parent); void populateTreeWidgetItem(QStandardItem* parent, const Cheats::CodeInfo& pi, bool enabled); void expandAllItems(); + void resizeColumns(); void setCheatEnabled(std::string name, bool enabled, bool save_and_reload_settings); void setStateForAll(bool enabled);