0
0
mirror of https://github.com/yse/easy_profiler.git synced 2024-12-27 08:41:02 +08:00

Merge commit

This commit is contained in:
Sergey Yagovtsev 2016-08-08 22:54:20 +03:00
commit b257ef2c1d
2 changed files with 132 additions and 116 deletions

View File

@ -255,14 +255,6 @@ void ProfGraphicsItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem*
// _painter->setBrush(brush);
//}
if (previousColor != item.color)
{
// Set background color brush for rectangle
previousColor = item.color;
brush.setColor(previousColor);
_painter->setBrush(brush);
}
bool changepen = false;
if (!m_bTest && item.block->block_index == ::profiler_gui::EASY_GLOBALS.selected_block)
{
@ -271,23 +263,38 @@ void ProfGraphicsItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem*
pen.setColor(Qt::red);
pen.setWidth(2);
_painter->setPen(pen);
previousColor = SELECTED_ITEM_COLOR;
brush.setColor(previousColor);
_painter->setBrush(brush);
}
else if (::profiler_gui::EASY_GLOBALS.draw_graphics_items_borders)
else
{
if (w < 3)
if (previousColor != item.color)
{
// Do not paint borders for very narrow items
if (previousPenStyle != Qt::NoPen)
{
previousPenStyle = Qt::NoPen;
_painter->setPen(Qt::NoPen);
}
// Set background color brush for rectangle
previousColor = item.color;
brush.setColor(previousColor);
_painter->setBrush(brush);
}
else if (previousPenStyle != Qt::SolidLine)
if (::profiler_gui::EASY_GLOBALS.draw_graphics_items_borders)
{
// Restore pen for item which is wide enough to paint borders
previousPenStyle = Qt::SolidLine;
_painter->setPen(BORDERS_COLOR);
if (w < 3)
{
// Do not paint borders for very narrow items
if (previousPenStyle != Qt::NoPen)
{
previousPenStyle = Qt::NoPen;
_painter->setPen(Qt::NoPen);
}
}
else if (previousPenStyle != Qt::SolidLine)
{
// Restore pen for item which is wide enough to paint borders
previousPenStyle = Qt::SolidLine;
_painter->setPen(BORDERS_COLOR);
}
}
}
@ -337,13 +344,6 @@ void ProfGraphicsItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem*
// brush = QBrush(previousColor);
// _painter->setBrush(brush);
//} else
if (previousColor != item.color)
{
// Set background color brush for rectangle
previousColor = item.color;
brush.setColor(previousColor);
_painter->setBrush(brush);
}
if (!m_bTest && item.block->block_index == ::profiler_gui::EASY_GLOBALS.selected_block)
{
@ -351,12 +351,27 @@ void ProfGraphicsItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem*
pen.setColor(Qt::red);
pen.setWidth(2);
_painter->setPen(pen);
previousColor = SELECTED_ITEM_COLOR;
brush.setColor(previousColor);
_painter->setBrush(brush);
}
else if (::profiler_gui::EASY_GLOBALS.draw_graphics_items_borders && previousPenStyle != Qt::SolidLine)
else
{
// Restore pen for item which is wide enough to paint borders
previousPenStyle = Qt::SolidLine;
_painter->setPen(BORDERS_COLOR);
if (previousColor != item.color)
{
// Set background color brush for rectangle
previousColor = item.color;
brush.setColor(previousColor);
_painter->setBrush(brush);
}
if (::profiler_gui::EASY_GLOBALS.draw_graphics_items_borders && previousPenStyle != Qt::SolidLine)
{
// Restore pen for item which is wide enough to paint borders
previousPenStyle = Qt::SolidLine;
_painter->setPen(BORDERS_COLOR);
}
}
// Draw rectangle

View File

@ -30,10 +30,10 @@
class ProfGraphicsItem;
class ProfTreeWidgetItem;
//////////////////////////////////////////////////////////////////////////
const unsigned int NEGATIVE_ONE = std::numeric_limits<unsigned int>::max();
//////////////////////////////////////////////////////////////////////////
namespace profiler_gui {
const QString ORGANAZATION_NAME = "EasyProfiler";
@ -42,6 +42,7 @@ namespace profiler_gui {
const QColor CHRONOMETER_COLOR = QColor::fromRgba(0x202020c0);
const QRgb SELECTED_THREAD_BACKGROUND = 0x00e0e060;
const QRgb SELECTED_THREAD_FOREGROUND = 0x00ffffff - SELECTED_THREAD_BACKGROUND;
const QRgb SELECTED_ITEM_COLOR = 0x000050a0;
//////////////////////////////////////////////////////////////////////////