diff options
author | Aaron Sonin <10217842+byteduck@users.noreply.github.com> | 2023-01-02 11:59:29 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-02 11:59:29 -0700 |
commit | e0e3d4d8feec359dbd1df7ccff2573af49d14d91 (patch) | |
tree | be85bccd5764d178fd62f3a5ddf2cac7fbb57239 /launcher/ui | |
parent | ba81ad1ac3cff48b973ee167802a5d6398eac990 (diff) | |
parent | 4b12c85d91be34504384117584fb4f25a754481e (diff) | |
download | PrismLauncher-e0e3d4d8feec359dbd1df7ccff2573af49d14d91.tar.gz PrismLauncher-e0e3d4d8feec359dbd1df7ccff2573af49d14d91.tar.bz2 PrismLauncher-e0e3d4d8feec359dbd1df7ccff2573af49d14d91.zip |
Merge branch 'PrismLauncher:develop' into instance-accounts
Diffstat (limited to 'launcher/ui')
-rw-r--r-- | launcher/ui/widgets/ModListView.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/launcher/ui/widgets/ModListView.cpp b/launcher/ui/widgets/ModListView.cpp index d1860f57..09b03a76 100644 --- a/launcher/ui/widgets/ModListView.cpp +++ b/launcher/ui/widgets/ModListView.cpp @@ -14,6 +14,9 @@ */ #include "ModListView.h" + +#include "minecraft/mod/ModFolderModel.h" + #include <QHeaderView> #include <QMouseEvent> #include <QPainter> @@ -62,4 +65,17 @@ void ModListView::setModel ( QAbstractItemModel* model ) for(int i = 1; i < head->count(); i++) head->setSectionResizeMode(i, QHeaderView::ResizeToContents); } + + auto real_model = model; + if (auto proxy_model = dynamic_cast<QSortFilterProxyModel*>(model); proxy_model) + real_model = proxy_model->sourceModel(); + + if (auto mod_model = dynamic_cast<ModFolderModel*>(real_model); mod_model) { + connect(mod_model, &ModFolderModel::updateFinished, this, [this, mod_model]{ + auto mods = mod_model->allMods(); + // Hide the 'Provider' column if no mod has a defined provider! + setColumnHidden(ModFolderModel::Columns::ProviderColumn, + std::none_of(mods.constBegin(), mods.constEnd(), [](auto const mod){ return mod->provider().has_value(); })); + }); + } } |