summaryrefslogtreecommitdiff
path: root/src/modlistview.cpp
diff options
context:
space:
mode:
authorMikaël Capelle <capelle.mikael@gmail.com>2020-12-31 13:39:07 +0100
committerMikaël Capelle <capelle.mikael@gmail.com>2021-01-02 15:38:18 +0100
commit524145405b292682c635db7412017c19ce86d1ea (patch)
tree84d0b546d5c193fc5c29d793a7742712268938ba /src/modlistview.cpp
parentacdea8854140b329c13765abb9ea322dacd95ba6 (diff)
Minor refactoring.
Diffstat (limited to 'src/modlistview.cpp')
-rw-r--r--src/modlistview.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/modlistview.cpp b/src/modlistview.cpp
index 7e9a0438..184a6be5 100644
--- a/src/modlistview.cpp
+++ b/src/modlistview.cpp
@@ -677,27 +677,25 @@ void ModListView::setup(OrganizerCore& core, CategoryFactory& factory, MainWindo
m_sortProxy = new ModListSortProxy(core.currentProfile(), &core);
setModel(m_sortProxy);
- connect(m_sortProxy, &QAbstractItemModel::layoutAboutToBeChanged,
- this, [this](const QList<QPersistentModelIndex>& parents, QAbstractItemModel::LayoutChangeHint hint) {
+ // update the proxy when changing the sort column/direction and the group
+ connect(m_sortProxy, &QAbstractItemModel::layoutAboutToBeChanged, [this](auto&& parents, auto&& hint) {
if (hint == QAbstractItemModel::VerticalSortHint) {
updateGroupByProxy(-1);
}
});
- sortByColumn(ModList::COL_PRIORITY, Qt::AscendingOrder);
-
- connect(ui.groupBy, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [&](int index) {
+ connect(ui.groupBy, QOverload<int>::of(&QComboBox::currentIndexChanged), [=](int index) {
updateGroupByProxy(index);
onModFilterActive(m_sortProxy->isFilterActive());
- });
+ });
+ sortByColumn(ModList::COL_PRIORITY, Qt::AscendingOrder);
connect(this, &ModListView::dragEntered, core.modList(), &ModList::onDragEnter);
connect(this, &ModListView::dropEntered, m_byPriorityProxy, &ModListByPriorityProxy::onDropEnter);
connect(model(), &QAbstractItemModel::layoutChanged, this, &ModListView::updateModCount);
- connect(header(), &QHeaderView::sortIndicatorChanged, this, [&](int, Qt::SortOrder) {
- verticalScrollBar()->repaint(); });
- connect(header(), &QHeaderView::sectionResized, this, [&](int logicalIndex, int oldSize, int newSize) {
+ connect(header(), &QHeaderView::sortIndicatorChanged, [=](int, Qt::SortOrder) { verticalScrollBar()->repaint(); });
+ connect(header(), &QHeaderView::sectionResized, [=](int logicalIndex, int oldSize, int newSize) {
m_sortProxy->setColumnVisible(logicalIndex, newSize != 0); });
GenericIconDelegate* contentDelegate = new GenericIconDelegate(this, Qt::UserRole + 3, ModList::COL_CONTENT, 150);