mirror of
https://github.com/RPCS3/rpcs3
synced 2024-11-02 11:45:30 +00:00
Qt: Fix obnoxious glitch where game list columns ended up with 0 width
Qt can be messy at times
This commit is contained in:
parent
67637dfaa4
commit
95951c31f8
3 changed files with 31 additions and 6 deletions
|
@ -165,8 +165,7 @@ game_list_frame::game_list_frame(std::shared_ptr<gui_settings> guiSettings, std:
|
|||
|
||||
if (checked) // handle hidden columns that have zero width after showing them (stuck between others)
|
||||
{
|
||||
if (m_gameList->columnWidth(col) <= m_gameList->horizontalHeader()->minimumSectionSize())
|
||||
m_gameList->setColumnWidth(col, m_gameList->horizontalHeader()->minimumSectionSize());
|
||||
FixNarrowColumns();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -192,12 +191,10 @@ void game_list_frame::LoadSettings()
|
|||
bool vis = xgui_settings->GetGamelistColVisibility(col);
|
||||
m_columnActs[col]->setChecked(vis);
|
||||
m_gameList->setColumnHidden(col, !vis);
|
||||
|
||||
// handle columns that have zero width after showing them (stuck between others)
|
||||
if (vis && m_gameList->columnWidth(col) <= m_gameList->horizontalHeader()->minimumSectionSize())
|
||||
m_gameList->setColumnWidth(col, m_gameList->horizontalHeader()->minimumSectionSize());
|
||||
}
|
||||
|
||||
FixNarrowColumns();
|
||||
|
||||
m_gameList->horizontalHeader()->restoreState(m_gameList->horizontalHeader()->saveState());
|
||||
|
||||
m_colSortOrder = xgui_settings->GetValue(gui::gl_sortAsc).toBool() ? Qt::AscendingOrder : Qt::DescendingOrder;
|
||||
|
@ -214,6 +211,28 @@ game_list_frame::~game_list_frame()
|
|||
SaveSettings();
|
||||
}
|
||||
|
||||
void game_list_frame::FixNarrowColumns()
|
||||
{
|
||||
if (!isVisible()) // don't use isHidden here
|
||||
{
|
||||
// Handle Qt glitch. If we call columnWidth when the table is not shown yet then some columns will have 0 width
|
||||
return;
|
||||
}
|
||||
|
||||
qApp->processEvents();
|
||||
|
||||
// handle columns (other than the icon column) that have zero width after showing them (stuck between others)
|
||||
for (int col = 1; col < m_columnActs.count(); ++col)
|
||||
{
|
||||
const bool visible = !m_gameList->isColumnHidden(col);
|
||||
|
||||
if (visible && m_gameList->columnWidth(col) <= m_gameList->horizontalHeader()->minimumSectionSize())
|
||||
{
|
||||
m_gameList->setColumnWidth(col, m_gameList->horizontalHeader()->minimumSectionSize());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void game_list_frame::OnColClicked(int col)
|
||||
{
|
||||
if (col == 0) return; // Don't "sort" icons.
|
||||
|
|
|
@ -180,6 +180,9 @@ public:
|
|||
explicit game_list_frame(std::shared_ptr<gui_settings> guiSettings, std::shared_ptr<emu_settings> emuSettings, QWidget *parent = nullptr);
|
||||
~game_list_frame();
|
||||
|
||||
/** Fix columns with width smaller than the minimal section size */
|
||||
void FixNarrowColumns();
|
||||
|
||||
/** Refresh the gamelist with/without loading game data from files. Public so that main frame can refresh after vfs or install */
|
||||
void Refresh(const bool fromDrive = false, const bool scrollAfter = true);
|
||||
|
||||
|
|
|
@ -186,6 +186,9 @@ void main_window::Init()
|
|||
connect(m_thumb_restart, &QWinThumbnailToolButton::clicked, [=]() { Emu.Restart(); });
|
||||
connect(m_thumb_playPause, &QWinThumbnailToolButton::clicked, this, &main_window::OnPlayOrPause);
|
||||
#endif
|
||||
|
||||
// Fix possible hidden game list columns. The game list has to be visible already. Use this after show()
|
||||
m_gameListFrame->FixNarrowColumns();
|
||||
}
|
||||
|
||||
// returns appIcon
|
||||
|
|
Loading…
Reference in a new issue