mirror of
https://github.com/yse/easy_profiler.git
synced 2024-12-31 02:49:13 +08:00
33 lines
888 B
C++
33 lines
888 B
C++
|
|
|
|
#include <QPainter>
|
|
#include <QPoint>
|
|
#include "treeview_first_column_delegate.h"
|
|
#include "globals.h"
|
|
|
|
EasyTreeViewFirstColumnItemDelegate::EasyTreeViewFirstColumnItemDelegate(QObject* parent) : QStyledItemDelegate(parent)
|
|
{
|
|
|
|
}
|
|
|
|
EasyTreeViewFirstColumnItemDelegate::~EasyTreeViewFirstColumnItemDelegate()
|
|
{
|
|
|
|
}
|
|
|
|
void EasyTreeViewFirstColumnItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
|
|
{
|
|
// Draw item as usual
|
|
QStyledItemDelegate::paint(painter, option, index);
|
|
|
|
// Draw line under tree indicator
|
|
const auto bottomLeft = option.rect.bottomLeft();
|
|
if (bottomLeft.x() > 0)
|
|
{
|
|
painter->save();
|
|
painter->setBrush(Qt::NoBrush);
|
|
painter->setPen(::profiler_gui::SYSTEM_BORDER_COLOR);
|
|
painter->drawLine(QPoint(0, bottomLeft.y()), bottomLeft);
|
|
painter->restore();
|
|
}
|
|
} |