Qt: Force game list column resize on window show

Fixes a regression from dbfb93a50f where
the game list columns would always be too short on open.
This commit is contained in:
Connor McLaughlin 2022-06-05 02:13:05 +10:00 committed by refractionpcsx2
parent b89d0837a6
commit f1702b5693
3 changed files with 13 additions and 1 deletions

View File

@ -52,6 +52,7 @@ public:
__fi GameListModel* getModel() const { return m_model; }
void initialize();
void resizeTableViewColumnsToFit();
void refresh(bool invalidate_cache);
void cancelRefresh();
@ -97,7 +98,6 @@ protected:
void resizeEvent(QResizeEvent* event);
private:
void resizeTableViewColumnsToFit();
void loadTableViewColumnVisibilitySettings();
void saveTableViewColumnVisibilitySettings();
void saveTableViewColumnVisibilitySettings(int column);

View File

@ -1400,6 +1400,17 @@ void MainWindow::onPerformanceMetricsUpdated(const QString& fps_stat, const QStr
m_status_gs_widget->setText(gs_stat);
}
void MainWindow::showEvent(QShowEvent* event)
{
QMainWindow::showEvent(event);
// This is a bit silly, but for some reason resizing *before* the window is shown
// gives the incorrect sizes for columns, if you set the style before setting up
// the rest of the window... so, instead, let's just force it to be resized on show.
if (isShowingGameList())
m_game_list_widget->resizeTableViewColumnsToFit();
}
void MainWindow::closeEvent(QCloseEvent* event)
{
if (!requestShutdown(true, true, true))

View File

@ -156,6 +156,7 @@ private Q_SLOTS:
void recreate();
protected:
void showEvent(QShowEvent* event) override;
void closeEvent(QCloseEvent* event) override;
void dragEnterEvent(QDragEnterEvent* event) override;
void dropEvent(QDropEvent* event) override;