0
0
mirror of https://github.com/yse/easy_profiler.git synced 2024-12-31 02:49:13 +08:00
easy_profiler/profiler_gui/treeview_first_column_delegate.cpp
2017-12-07 22:36:53 +03:00

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();
}
}