mirror of
https://github.com/yse/easy_profiler.git
synced 2025-01-14 16:47:55 +08:00
(ProfGraphicsView) using SELECTED_ITEM_COLOR constant
This commit is contained in:
parent
f0f82c01e2
commit
48e0906bf4
@ -253,14 +253,6 @@ void ProfGraphicsItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem*
|
|||||||
// _painter->setBrush(brush);
|
// _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;
|
bool changepen = false;
|
||||||
if (!m_bTest && item.block->block_index == ::profiler_gui::EASY_GLOBALS.selected_block)
|
if (!m_bTest && item.block->block_index == ::profiler_gui::EASY_GLOBALS.selected_block)
|
||||||
{
|
{
|
||||||
@ -269,23 +261,38 @@ void ProfGraphicsItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem*
|
|||||||
pen.setColor(Qt::red);
|
pen.setColor(Qt::red);
|
||||||
pen.setWidth(2);
|
pen.setWidth(2);
|
||||||
_painter->setPen(pen);
|
_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
|
// Set background color brush for rectangle
|
||||||
if (previousPenStyle != Qt::NoPen)
|
previousColor = item.color;
|
||||||
{
|
brush.setColor(previousColor);
|
||||||
previousPenStyle = Qt::NoPen;
|
_painter->setBrush(brush);
|
||||||
_painter->setPen(Qt::NoPen);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
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
|
if (w < 3)
|
||||||
previousPenStyle = Qt::SolidLine;
|
{
|
||||||
_painter->setPen(BORDERS_COLOR);
|
// 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,13 +342,6 @@ void ProfGraphicsItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem*
|
|||||||
// brush = QBrush(previousColor);
|
// brush = QBrush(previousColor);
|
||||||
// _painter->setBrush(brush);
|
// _painter->setBrush(brush);
|
||||||
//} else
|
//} 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)
|
if (!m_bTest && item.block->block_index == ::profiler_gui::EASY_GLOBALS.selected_block)
|
||||||
{
|
{
|
||||||
@ -349,12 +349,27 @@ void ProfGraphicsItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem*
|
|||||||
pen.setColor(Qt::red);
|
pen.setColor(Qt::red);
|
||||||
pen.setWidth(2);
|
pen.setWidth(2);
|
||||||
_painter->setPen(pen);
|
_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
|
if (previousColor != item.color)
|
||||||
previousPenStyle = Qt::SolidLine;
|
{
|
||||||
_painter->setPen(BORDERS_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
|
// Draw rectangle
|
||||||
|
@ -39,6 +39,7 @@ namespace profiler_gui {
|
|||||||
const QColor CHRONOMETER_COLOR = QColor::fromRgba(0x202020c0);
|
const QColor CHRONOMETER_COLOR = QColor::fromRgba(0x202020c0);
|
||||||
const QRgb SELECTED_THREAD_BACKGROUND = 0x00e0e060;
|
const QRgb SELECTED_THREAD_BACKGROUND = 0x00e0e060;
|
||||||
const QRgb SELECTED_THREAD_FOREGROUND = 0x00ffffff - SELECTED_THREAD_BACKGROUND;
|
const QRgb SELECTED_THREAD_FOREGROUND = 0x00ffffff - SELECTED_THREAD_BACKGROUND;
|
||||||
|
const QRgb SELECTED_ITEM_COLOR = 0x000050a0;
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user