Revert "Qt: speed up list refresh"

This reverts commit 715f4f0669.
This commit is contained in:
Megamouse 2020-08-21 08:25:53 +02:00
parent 4a40ef6a19
commit b487c09d34
3 changed files with 11 additions and 22 deletions

View File

@ -94,7 +94,6 @@ game_list_frame::game_list_frame(std::shared_ptr<gui_settings> gui_settings, std
m_game_list->setAlternatingRowColors(true);
m_game_list->installEventFilter(this);
m_game_list->setColumnCount(gui::column_count);
m_game_list->horizontalHeader()->setSectionResizeMode(gui::column_icon, QHeaderView::Fixed);
m_game_compat = new game_compatibility(m_gui_settings, this);
@ -364,9 +363,7 @@ void game_list_frame::SortGameList()
// Fixate vertical header and row height
m_game_list->verticalHeader()->setMinimumSectionSize(m_icon_size.height());
m_game_list->verticalHeader()->setMaximumSectionSize(m_icon_size.height());
// Removed for better performance. I can't see any visual difference with and without this code
// m_game_list->resizeRowsToContents();
m_game_list->resizeRowsToContents();
// Resize columns if the game list was empty before
if (!old_row_count && !old_game_count)
@ -378,6 +375,9 @@ void game_list_frame::SortGameList()
m_game_list->resizeColumnToContents(gui::column_icon);
}
// Fixate icon column
m_game_list->horizontalHeader()->setSectionResizeMode(gui::column_icon, QHeaderView::Fixed);
// Shorten the last section to remove horizontal scrollbar if possible
m_game_list->resizeColumnToContents(gui::column_count - 1);
}

View File

@ -372,14 +372,7 @@ void save_manager_dialog::UpdateIcons()
icon_item->setData(Qt::DecorationRole, scaled[i]);
}
// Fixate vertical header and row height
m_list->verticalHeader()->setMinimumSectionSize(m_icon_size.height());
m_list->verticalHeader()->setMaximumSectionSize(m_icon_size.height());
// Removed for better performance. I can't see any visual difference with and without this code
// m_list->resizeRowsToContents();
// Resize icon column
m_list->resizeRowsToContents();
m_list->resizeColumnToContents(0);
}

View File

@ -89,7 +89,6 @@ trophy_manager_dialog::trophy_manager_dialog(std::shared_ptr<gui_settings> gui_s
m_game_table->setHorizontalHeaderLabels(QStringList{ tr("Icon"), tr("Game"), tr("Progress") });
m_game_table->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
m_game_table->horizontalHeader()->setStretchLastSection(true);
m_game_table->horizontalHeader()->setSectionResizeMode(GameColumns::GameIcon, QHeaderView::Fixed);
m_game_table->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed);
m_game_table->verticalHeader()->setVisible(false);
m_game_table->setAlternatingRowColors(true);
@ -111,7 +110,6 @@ trophy_manager_dialog::trophy_manager_dialog(std::shared_ptr<gui_settings> gui_s
m_trophy_table->setHorizontalHeaderLabels(QStringList{ tr("Icon"), tr("Name"), tr("Description"), tr("Type"), tr("Status"), tr("ID"), tr("Platinum Relevant") });
m_trophy_table->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
m_trophy_table->horizontalHeader()->setStretchLastSection(true);
m_trophy_table->horizontalHeader()->setSectionResizeMode(TrophyColumns::Icon, QHeaderView::Fixed);
m_trophy_table->verticalHeader()->setVisible(false);
m_trophy_table->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed);
m_trophy_table->setContextMenuPolicy(Qt::CustomContextMenu);
@ -888,12 +886,11 @@ void trophy_manager_dialog::ReadjustGameTable()
// Fixate vertical header and row height
m_game_table->verticalHeader()->setMinimumSectionSize(m_game_icon_size.height());
m_game_table->verticalHeader()->setMaximumSectionSize(m_game_icon_size.height());
m_game_table->resizeRowsToContents();
// Removed for better performance. I can't see any visual difference with and without this code
// m_game_table->resizeRowsToContents();
// Resize icon column
// Resize and fixate icon column
m_game_table->resizeColumnToContents(GameColumns::GameIcon);
m_game_table->horizontalHeader()->setSectionResizeMode(GameColumns::GameIcon, QHeaderView::Fixed);
// Shorten the last section to remove horizontal scrollbar if possible
m_game_table->resizeColumnToContents(GameColumns::GameColumnsCount - 1);
@ -904,12 +901,11 @@ void trophy_manager_dialog::ReadjustTrophyTable()
// Fixate vertical header and row height
m_trophy_table->verticalHeader()->setMinimumSectionSize(m_icon_height);
m_trophy_table->verticalHeader()->setMaximumSectionSize(m_icon_height);
m_trophy_table->resizeRowsToContents();
// Removed for better performance. I can't see any visual difference with and without this code
// m_trophy_table->resizeRowsToContents();
// Resize icon column
// Resize and fixate icon column
m_trophy_table->resizeColumnToContents(TrophyColumns::Icon);
m_trophy_table->horizontalHeader()->setSectionResizeMode(TrophyColumns::Icon, QHeaderView::Fixed);
// Shorten the last section to remove horizontal scrollbar if possible
m_trophy_table->resizeColumnToContents(TrophyColumns::Count - 1);