Fixed repaint issue

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2023-05-28 16:57:35 +03:00
parent 7d79abb607
commit bf0a577fb9
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318
2 changed files with 7 additions and 5 deletions

View File

@ -312,9 +312,11 @@ void ResourcePage::addResourceToDialog(ModPlatform::IndexedPack& pack, ModPlatfo
m_parent_dialog->addResource(pack, version); m_parent_dialog->addResource(pack, version);
} }
void ResourcePage::removeResourceFromDialog(const QString& pack_name) void ResourcePage::removeResourceFromDialog(ModPlatform::IndexedPack& pack)
{ {
m_parent_dialog->removeResource(pack_name); m_parent_dialog->removeResource(pack.name);
for (auto& ver : pack.versions)
ver.is_currently_selected = false;
} }
void ResourcePage::addResourceToPage(ModPlatform::IndexedPack& pack, void ResourcePage::addResourceToPage(ModPlatform::IndexedPack& pack,
@ -340,7 +342,7 @@ void ResourcePage::onResourceSelected()
auto& version = current_pack.versions[m_selected_version_index]; auto& version = current_pack.versions[m_selected_version_index];
if (version.is_currently_selected) if (version.is_currently_selected)
removeResourceFromDialog(current_pack.name); removeResourceFromDialog(current_pack);
else else
addResourceToDialog(current_pack, version); addResourceToDialog(current_pack, version);
@ -351,7 +353,7 @@ void ResourcePage::onResourceSelected()
updateSelectionButton(); updateSelectionButton();
/* Force redraw on the resource list when the selection changes */ /* Force redraw on the resource list when the selection changes */
m_ui->packView->adjustSize(); m_ui->packView->repaint();
} }
void ResourcePage::openUrl(const QUrl& url) void ResourcePage::openUrl(const QUrl& url)

View File

@ -76,7 +76,7 @@ class ResourcePage : public QWidget, public BasePage {
virtual void updateVersionList(); virtual void updateVersionList();
void addResourceToDialog(ModPlatform::IndexedPack&, ModPlatform::IndexedVersion&); void addResourceToDialog(ModPlatform::IndexedPack&, ModPlatform::IndexedVersion&);
void removeResourceFromDialog(const QString& pack_name); void removeResourceFromDialog(ModPlatform::IndexedPack& pack);
virtual void removeResourceFromPage(const QString& name); virtual void removeResourceFromPage(const QString& name);
virtual void addResourceToPage(ModPlatform::IndexedPack&, ModPlatform::IndexedVersion&, const std::shared_ptr<ResourceFolderModel>); virtual void addResourceToPage(ModPlatform::IndexedPack&, ModPlatform::IndexedVersion&, const std::shared_ptr<ResourceFolderModel>);