Qt: Fix columns in cheat tree list not auto-sizing

This commit is contained in:
Stenzek 2024-01-07 13:05:09 +10:00 committed by Connor McLaughlin
parent 05bb126af9
commit 53633b7279
2 changed files with 11 additions and 2 deletions

View File

@ -17,7 +17,6 @@ GameCheatSettingsWidget::GameCheatSettingsWidget(SettingsWindow* dialog, QWidget
: m_dialog(dialog)
{
m_ui.setupUi(this);
QtUtils::ResizeColumnsForTreeView(m_ui.cheatList, {300, 100, -1});
reloadList();
@ -90,6 +89,12 @@ void GameCheatSettingsWidget::disableAllCheats()
si->Save();
}
void GameCheatSettingsWidget::resizeEvent(QResizeEvent* event)
{
QWidget::resizeEvent(event);
QtUtils::ResizeColumnsForTreeView(m_ui.cheatList, {320, 100, -1});
}
void GameCheatSettingsWidget::setCheatEnabled(std::string name, bool enabled, bool save_and_reload_settings)
{
SettingsInterface* si = m_dialog->getSettingsInterface();

View File

@ -28,9 +28,13 @@ class GameCheatSettingsWidget : public QWidget
public:
GameCheatSettingsWidget(SettingsWindow* dialog, QWidget* parent);
void disableAllCheats();
~GameCheatSettingsWidget();
void disableAllCheats();
protected:
void resizeEvent(QResizeEvent* event) override;
private Q_SLOTS:
void onCheatListItemDoubleClicked(QTreeWidgetItem* item, int column);
void onCheatListItemChanged(QTreeWidgetItem* item, int column);