diff options
| author | Mikaël Capelle <capelle.mikael@gmail.com> | 2021-01-02 20:26:39 +0100 |
|---|---|---|
| committer | Mikaël Capelle <capelle.mikael@gmail.com> | 2021-01-02 20:26:39 +0100 |
| commit | 8de7b79a2b211805a4ba348e490a7ab8eac15eef (patch) | |
| tree | 98dae2b10b0d4cd368fcc3346fefaffa73df1242 /src/viewmarkingscrollbar.cpp | |
| parent | d96dcf02b131808a25045afc23667ed6a26274a6 (diff) | |
Move markers management for overwrite/overwritten to ModListView.
Diffstat (limited to 'src/viewmarkingscrollbar.cpp')
| -rw-r--r-- | src/viewmarkingscrollbar.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/viewmarkingscrollbar.cpp b/src/viewmarkingscrollbar.cpp index fb165922..56754237 100644 --- a/src/viewmarkingscrollbar.cpp +++ b/src/viewmarkingscrollbar.cpp @@ -15,6 +15,15 @@ ViewMarkingScrollBar::ViewMarkingScrollBar(QTreeView* view, int role) Q_ASSERT(this->orientation() == Qt::Vertical);
}
+QColor ViewMarkingScrollBar::color(const QModelIndex& index) const
+{
+ auto data = index.data(m_role);
+ if (data.canConvert<QColor>()) {
+ return data.value<QColor>();
+ }
+ return QColor();
+}
+
void ViewMarkingScrollBar::paintEvent(QPaintEvent* event)
{
if (m_view->model() == nullptr) {
@@ -36,18 +45,7 @@ void ViewMarkingScrollBar::paintEvent(QPaintEvent* event) qreal scale = static_cast<qreal>(innerRect.height() - 3) / static_cast<qreal>(indices.size());
for (int i = 0; i < indices.size(); ++i) {
- QVariant data = indices[i].data(m_role);
- QColor color;
-
- if (data.canConvert<QColor>()) {
- color = data.value<QColor>();
- }
-
- auto childrenColor = MOShared::childrenColor(indices[i], m_view, m_role);
- if (childrenColor.isValid()) {
- color = childrenColor;
- }
-
+ QColor color = this->color(indices[i]);
if (color.isValid()) {
painter.setPen(color);
painter.setBrush(color);
|
