Qt: Fix columns being hidden after editing cheats

This commit is contained in:
Stenzek 2025-01-14 13:53:05 +10:00
parent 3a13806f73
commit 880c76da24
No known key found for this signature in database
2 changed files with 8 additions and 1 deletions

View File

@ -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()

View File

@ -71,6 +71,7 @@ private:
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);