File indexing completed on 2025-01-05 05:14:52
0001 /* 0002 SPDX-FileCopyrightText: 2021 Hamed Masafi <hamed.masfi@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-3.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "gitgraphlane.h" 0010 #include <QStyledItemDelegate> 0011 0012 #include "libkommitwidgets_export.h" 0013 0014 namespace Git 0015 { 0016 class LogsModel; 0017 } 0018 class LIBKOMMITWIDGETS_EXPORT GraphPainter : public QStyledItemDelegate 0019 { 0020 Q_OBJECT 0021 0022 public: 0023 explicit GraphPainter(Git::LogsModel *model, QObject *parent = nullptr); 0024 0025 void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override; 0026 void paintLane(QPainter *painter, const Git::GraphLane &lane, int index) const; 0027 int colX(int col) const; 0028 0029 QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override; 0030 0031 private: 0032 Git::LogsModel *const mModel; 0033 QVector<QColor> mColors; 0034 };