aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui
diff options
context:
space:
mode:
authorAaron Sonin <10217842+byteduck@users.noreply.github.com>2023-01-02 11:59:29 -0700
committerGitHub <noreply@github.com>2023-01-02 11:59:29 -0700
commite0e3d4d8feec359dbd1df7ccff2573af49d14d91 (patch)
treebe85bccd5764d178fd62f3a5ddf2cac7fbb57239 /launcher/ui
parentba81ad1ac3cff48b973ee167802a5d6398eac990 (diff)
parent4b12c85d91be34504384117584fb4f25a754481e (diff)
downloadPrismLauncher-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.cpp16
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(); }));
+ });
+ }
}