Fixed segfault when trying to change opacity after table refresh

This commit is contained in:
Pablo Santana 2025-02-03 20:05:35 +01:00
parent 88f3e06bd6
commit f340ae471d
3 changed files with 19 additions and 12 deletions

View File

@ -82,6 +82,8 @@ void GameGridFrame::PlayBackgroundMusic(QString path) {
}
void GameGridFrame::PopulateGameGrid(QVector<GameInfo> m_games_search, bool fromSearch) {
this->crtRow = -1;
this->crtColumn = -1;
QVector<GameInfo> m_games_;
this->clearContents();
if (fromSearch)

View File

@ -105,6 +105,7 @@ void GameListFrame::PlayBackgroundMusic(QTableWidgetItem* item) {
}
void GameListFrame::PopulateGameList(bool isInitialPopulation) {
this->m_current_item = nullptr;
// Do not show status column if it is not enabled
this->setColumnHidden(2, !Config::getCompatibilityEnabled());
this->setColumnHidden(6, !Config::GetLoadGameSizeEnabled());

View File

@ -292,17 +292,21 @@ void MainWindow::CreateConnects() {
connect(settingsDialog, &SettingsDialog::CompatibilityChanged, this,
&MainWindow::RefreshGameTable);
// Connect background opacity changes to refresh both frames
connect(
settingsDialog, &SettingsDialog::BackgroundOpacityChanged, this, [this](int opacity) {
connect(settingsDialog, &SettingsDialog::BackgroundOpacityChanged, this,
[this](int opacity) {
Config::setBackgroundImageOpacity(opacity);
if (m_game_list_frame) {
m_game_list_frame->SetListBackgroundImage(m_game_list_frame->GetCurrentItem());
QTableWidgetItem* current = m_game_list_frame->GetCurrentItem();
if (current) {
m_game_list_frame->SetListBackgroundImage(current);
}
}
if (m_game_grid_frame) {
if (m_game_grid_frame->IsValidCellSelected()) {
m_game_grid_frame->SetGridBackgroundImage(m_game_grid_frame->crtRow,
m_game_grid_frame->crtColumn);
}
}
});
settingsDialog->exec();