Skip to content

Commit

Permalink
Qt: Fix columns being hidden after editing cheats
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Jan 14, 2025
1 parent 3a13806 commit 880c76d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/duckstation-qt/gamecheatsettingswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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});
}

Expand Down Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions src/duckstation-qt/gamecheatsettingswidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 880c76d

Please sign in to comment.