Merge pull request #1432 from TheKodeToad/revert-revert-hide-provider-column
This commit is contained in:
commit
f51a66dad5
@ -14,6 +14,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ModListView.h"
|
#include "ModListView.h"
|
||||||
|
|
||||||
|
#include "minecraft/mod/ModFolderModel.h"
|
||||||
|
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
@ -62,4 +65,17 @@ void ModListView::setModel ( QAbstractItemModel* model )
|
|||||||
for(int i = 1; i < head->count(); i++)
|
for(int i = 1; i < head->count(); i++)
|
||||||
head->setSectionResizeMode(i, QHeaderView::ResizeToContents);
|
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(); }));
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user