From 5f3f8eeec6268bbb90fe98d91e78204ff19133c7 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Fri, 28 Apr 2023 14:05:52 +0200 Subject: [PATCH] Qt: fix squished icon column when opening rpcs3 after closing with an empty list --- rpcs3/rpcs3qt/game_list_frame.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index a172456a2f..76773a7b35 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -922,15 +922,25 @@ void game_list_frame::OnRefreshFinished() if (!std::exchange(m_initial_refresh_done, true)) { + // Resize to fit and get the ideal icon column width + ResizeColumnsToContents(); + const int icon_column_width = m_game_list->columnWidth(gui::column_icon); + + // Restore header layout from last session const QByteArray state = m_gui_settings->GetValue(gui::gl_state).toByteArray(); if (!m_game_list->horizontalHeader()->restoreState(state) && m_game_list->rowCount()) { - // If no settings exist, resize to contents. - ResizeColumnsToContents(); + // Nothing to do } + // Make sure no columns are squished FixNarrowColumns(); + // Make sure that the icon column is large enough for the actual items. + // This is important if the list appeared as empty when closing the software before. + m_game_list->horizontalHeader()->resizeSection(gui::column_icon, icon_column_width); + + // Save new header state m_game_list->horizontalHeader()->restoreState(m_game_list->horizontalHeader()->saveState()); }