X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fview%2Ftracegroup.cpp;h=9c1d49ff2b6645b5ae186b900b2fccf058b6f813;hp=87f1ff3dcab20fac2c065a5daadb0525534e56f8;hb=d55923a65aa672f65f9fe2c30ddbe46beddcaa3a;hpb=af503b104d890a357c736c678bb00296d889c090 diff --git a/pv/view/tracegroup.cpp b/pv/view/tracegroup.cpp index 87f1ff3d..9c1d49ff 100644 --- a/pv/view/tracegroup.cpp +++ b/pv/view/tracegroup.cpp @@ -49,7 +49,7 @@ TraceGroup::~TraceGroup() bool TraceGroup::enabled() const { return std::any_of(child_items().begin(), child_items().end(), - [](const shared_ptr &r) { return r->enabled(); }); + [](const shared_ptr &r) { return r->enabled(); }); } pv::Session& TraceGroup::session() @@ -115,7 +115,7 @@ void TraceGroup::paint_label(QPainter &p, const QRect &rect, bool hover) QRectF TraceGroup::label_rect(const QRectF &rect) const { QRectF child_rect; - for (const shared_ptr r : child_items()) + for (const shared_ptr r : child_items()) if (r && r->enabled()) child_rect = child_rect.united(r->label_rect(rect)); @@ -157,15 +157,14 @@ int TraceGroup::owner_visual_v_offset() const void TraceGroup::restack_items() { - vector< shared_ptr > items( - child_items().begin(), child_items().end()); + vector> items(trace_tree_child_items()); // Sort by the centre line of the extents stable_sort(items.begin(), items.end(), [](const shared_ptr &a, const shared_ptr &b) { const auto aext = a->v_extents(); const auto bext = b->v_extents(); - return a->layout_v_offset() + + return a->layout_v_offset() + (aext.first + aext.second) / 2 < b->layout_v_offset() + (bext.first + bext.second) / 2; @@ -197,8 +196,7 @@ unsigned int TraceGroup::depth() const void TraceGroup::ungroup() { - const vector< shared_ptr > items( - child_items().begin(), child_items().end()); + const vector> items(trace_tree_child_items()); clear_child_items(); for (shared_ptr r : items)