diff --git a/profiler_gui/descriptors_tree_widget.cpp b/profiler_gui/descriptors_tree_widget.cpp index 48b9737..5c47716 100644 --- a/profiler_gui/descriptors_tree_widget.cpp +++ b/profiler_gui/descriptors_tree_widget.cpp @@ -57,6 +57,7 @@ #include #include #include +#include #include #include "descriptors_tree_widget.h" #include "globals.h" @@ -382,7 +383,7 @@ void EasyDescTreeWidget::build() auto it = p.children.find(desc->line()); if (it == p.children.end()) { - auto item = new EasyDescWidgetItem(id, p.item); + auto item = new EasyDescWidgetItem(desc->id(), p.item); item->setText(DESC_COL_FILE_LINE, QString::number(desc->line())); item->setData(DESC_COL_FILE_LINE, Qt::UserRole, desc->line()); item->setText(DESC_COL_NAME, desc->name()); @@ -403,6 +404,7 @@ void EasyDescTreeWidget::build() item->setForeground(DESC_COL_STATUS, QColor::fromRgba(statusColor(desc->status()))); m_items[id] = item; + p.children.insert(::std::make_pair(desc->line(), item)); } else { @@ -424,6 +426,7 @@ void EasyDescTreeWidget::build() setSortingEnabled(true); sortByColumn(DESC_COL_FILE_LINE, Qt::AscendingOrder); resizeColumnsToContents(); + QTimer::singleShot(100, [this](){ onSelectedBlockChange(EASY_GLOBALS.selected_block); }); } ////////////////////////////////////////////////////////////////////////// @@ -541,7 +544,7 @@ void EasyDescTreeWidget::resizeColumnsToContents() void EasyDescTreeWidget::onSelectedBlockChange(uint32_t _block_index) { - if (_block_index == ::profiler_gui::numeric_max(_block_index)) + if (::profiler_gui::is_max(_block_index)) return; auto item = m_items[blocksTree(_block_index).node->id()]; diff --git a/profiler_gui/easy_graphics_item.cpp b/profiler_gui/easy_graphics_item.cpp index 1a356b7..2fc8465 100644 --- a/profiler_gui/easy_graphics_item.cpp +++ b/profiler_gui/easy_graphics_item.cpp @@ -352,7 +352,8 @@ void EasyGraphicsItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem* _painter->setBrush(brush); } - if (EASY_GLOBALS.highlight_blocks_with_same_id && EASY_GLOBALS.selected_block_id == itemDesc.id()) + if (EASY_GLOBALS.highlight_blocks_with_same_id && (EASY_GLOBALS.selected_block_id == itemBlock.tree.node->id() + || (::profiler_gui::is_max(EASY_GLOBALS.selected_block) && EASY_GLOBALS.selected_block_id == itemDesc.id()))) { if (previousPenStyle != Qt::DotLine) { @@ -409,7 +410,8 @@ void EasyGraphicsItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem* _painter->setBrush(brush); } - if (EASY_GLOBALS.highlight_blocks_with_same_id && EASY_GLOBALS.selected_block_id == itemDesc.id()) + if (EASY_GLOBALS.highlight_blocks_with_same_id && (EASY_GLOBALS.selected_block_id == itemBlock.tree.node->id() + || (::profiler_gui::is_max(EASY_GLOBALS.selected_block) && EASY_GLOBALS.selected_block_id == itemDesc.id()))) { if (previousPenStyle != Qt::DotLine) { @@ -578,7 +580,7 @@ void EasyGraphicsItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem* _painter->setFont(SELECTED_ITEM_FONT); // drawing text - auto name = *itemBlock.tree.node->name() != 0 ? itemBlock.tree.node->name() : easyDescriptor(itemBlock.tree.node->id()).name(); + auto name = *itemBlock.tree.node->name() != 0 ? itemBlock.tree.node->name() : itemDesc.name(); _painter->drawText(rect, Qt::AlignCenter, ::profiler_gui::toUnicode(name)); // END Draw text~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ }