diff options
| author | Mikaël Capelle <capelle.mikael@gmail.com> | 2021-01-01 13:51:36 +0100 |
|---|---|---|
| committer | Mikaël Capelle <capelle.mikael@gmail.com> | 2021-01-02 15:38:19 +0100 |
| commit | e5f43788e874e638e1d4dbab20451c36e52df10d (patch) | |
| tree | 9191bae2dce4cb69bd9c5bfa0099a4f8981a50d1 /src/modlistview.cpp | |
| parent | f36c68332019ec68a713b21519c0439039845fa1 (diff) | |
Visual fixes for the modlist.
- Fix invalid positions of markers in the scrollbar.
- Use color from children for collapsed elements (background and markers).
Diffstat (limited to 'src/modlistview.cpp')
| -rw-r--r-- | src/modlistview.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/modlistview.cpp b/src/modlistview.cpp index 80aa6495..da4d79cf 100644 --- a/src/modlistview.cpp +++ b/src/modlistview.cpp @@ -28,6 +28,7 @@ #include "modelutils.h"
using namespace MOBase;
+using namespace MOShared;
// delegate to remove indentation for mods when using collapsible
// separator
@@ -57,6 +58,13 @@ public: }
}
QStyledItemDelegate::paint(painter, opt, index);
+
+ auto color = childrenColor(index, m_view, Qt::BackgroundRole);
+ if (color.isValid()) {
+ // int shift = 3 * opt.rect.height() / 4;
+ // opt.rect.adjust(0, shift, 0, 0);
+ painter->fillRect(opt.rect, color);
+ }
}
};
@@ -67,7 +75,7 @@ ModListView::ModListView(QWidget* parent) , m_byPriorityProxy(nullptr)
, m_byCategoryProxy(nullptr)
, m_byNexusIdProxy(nullptr)
- , m_scrollbar(new ViewMarkingScrollBar(this->model(), ModList::ScrollMarkRole, this))
+ , m_scrollbar(new ViewMarkingScrollBar(this, ModList::ScrollMarkRole))
{
setVerticalScrollBar(m_scrollbar);
MOBase::setCustomizableColumns(this);
@@ -79,13 +87,6 @@ ModListView::ModListView(QWidget* parent) connect(this, &ModListView::customContextMenuRequested, this, &ModListView::onCustomContextMenuRequested);
}
-void ModListView::setModel(QAbstractItemModel* model)
-{
- QTreeView::setModel(model);
- setVerticalScrollBar(new ViewMarkingScrollBar(model, ModList::ScrollMarkRole, this));
-}
-
-
void ModListView::refresh()
{
updateGroupByProxy(-1);
|
