some more work on game_list repainter

This commit is contained in:
georgemoralis 2023-03-14 10:10:44 +02:00
parent 9e4a670be8
commit 583298211d
2 changed files with 29 additions and 5 deletions

View File

@ -117,6 +117,7 @@ game_list_frame::game_list_frame(std::shared_ptr<gui_settings> gui_settings, QWi
item->call_icon_func(); item->call_icon_func();
} }
}); });
connect(&m_repaint_watcher, &QFutureWatcher<game_list_item*>::finished, this, &game_list_frame::OnRepaintFinished);
Refresh();//TODO remove when watchers added Refresh();//TODO remove when watchers added
} }
@ -279,6 +280,28 @@ void game_list_frame::LoadSettings()
m_game_list->horizontalHeader()->restoreState(m_game_list->horizontalHeader()->saveState()); m_game_list->horizontalHeader()->restoreState(m_game_list->horizontalHeader()->saveState());
} }
void game_list_frame::OnRepaintFinished()
{
if (m_is_list_layout)
{
// Fixate vertical header and row height
m_game_list->verticalHeader()->setMinimumSectionSize(m_icon_size.height());
m_game_list->verticalHeader()->setMaximumSectionSize(m_icon_size.height());
// Resize the icon column
m_game_list->resizeColumnToContents(gui::column_icon);
// Shorten the last section to remove horizontal scrollbar if possible
m_game_list->resizeColumnToContents(gui::column_count - 1);
}
else
{
// The game grid needs to be recreated from scratch
//TODO !!
}
}
void game_list_frame::SaveSettings() void game_list_frame::SaveSettings()
{ {
for (int col = 0; col < m_columnActs.count(); ++col) for (int col = 0; col < m_columnActs.count(); ++col)

View File

@ -38,6 +38,7 @@ public :
private Q_SLOTS: private Q_SLOTS:
void OnHeaderColumnClicked(int col); void OnHeaderColumnClicked(int col);
void OnRepaintFinished();
private: private:
QPixmap PaintedPixmap(const QPixmap& icon) const; QPixmap PaintedPixmap(const QPixmap& icon) const;
void SortGameList() const; void SortGameList() const;