projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
DecodeTrace: Don't dereference iterator pointing at end of container.
[pulseview.git]
/
pv
/
view
/
tracegroup.cpp
diff --git
a/pv/view/tracegroup.cpp
b/pv/view/tracegroup.cpp
index 272fc1a1e3b341823e82133c099d4f35f392c617..9c1d49ff2b6645b5ae186b900b2fccf058b6f813 100644
(file)
--- 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(),
bool TraceGroup::enabled() const
{
return std::any_of(child_items().begin(), child_items().end(),
- [](const shared_ptr<
Ro
wItem> &r) { return r->enabled(); });
+ [](const shared_ptr<
Vie
wItem> &r) { return r->enabled(); });
}
pv::Session& TraceGroup::session()
}
pv::Session& TraceGroup::session()
@@
-78,12
+78,12
@@
const pv::view::View* TraceGroup::view() const
pair<int, int> TraceGroup::v_extents() const
{
pair<int, int> TraceGroup::v_extents() const
{
- return
Row
ItemOwner::v_extents();
+ return
TraceTree
ItemOwner::v_extents();
}
}
-void TraceGroup::paint_label(QPainter &p,
int righ
t, bool hover)
+void TraceGroup::paint_label(QPainter &p,
const QRect &rec
t, bool hover)
{
{
- const QRectF r = label_rect(r
igh
t).adjusted(
+ const QRectF r = label_rect(r
ec
t).adjusted(
LineThickness / 2, LineThickness / 2,
-LineThickness / 2, -LineThickness / 2);
LineThickness / 2, LineThickness / 2,
-LineThickness / 2, -LineThickness / 2);
@@
-112,15
+112,15
@@
void TraceGroup::paint_label(QPainter &p, int right, bool hover)
p.drawPolyline(points, countof(points));
}
p.drawPolyline(points, countof(points));
}
-QRectF TraceGroup::label_rect(
int righ
t) const
+QRectF TraceGroup::label_rect(
const QRectF &rec
t) const
{
{
- QRectF rect;
- for (const shared_ptr<
Ro
wItem> r : child_items())
+ QRectF
child_
rect;
+ for (const shared_ptr<
Vie
wItem> r : child_items())
if (r && r->enabled())
if (r && r->enabled())
-
rect = rect.united(r->label_rect(righ
t));
+
child_rect = child_rect.united(r->label_rect(rec
t));
- return QRectF(
rect.x() - Width - Padding,
rect.y(),
- Width, rect.height());
+ return QRectF(
child_rect.x() - Width - Padding, child_
rect.y(),
+ Width,
child_
rect.height());
}
bool TraceGroup::pt_in_label_rect(int left, int right, const QPoint &point)
}
bool TraceGroup::pt_in_label_rect(int left, int right, const QPoint &point)
@@
-147,7
+147,7
@@
QMenu* TraceGroup::create_context_menu(QWidget *parent)
pv::widgets::Popup* TraceGroup::create_popup(QWidget *parent)
{
(void)parent;
pv::widgets::Popup* TraceGroup::create_popup(QWidget *parent)
{
(void)parent;
- return
NULL
;
+ return
nullptr
;
}
int TraceGroup::owner_visual_v_offset() const
}
int TraceGroup::owner_visual_v_offset() const
@@
-157,22
+157,21
@@
int TraceGroup::owner_visual_v_offset() const
void TraceGroup::restack_items()
{
void TraceGroup::restack_items()
{
- vector< shared_ptr<RowItem> > items(
- child_items().begin(), child_items().end());
+ vector<shared_ptr<TraceTreeItem>> items(trace_tree_child_items());
// Sort by the centre line of the extents
stable_sort(items.begin(), items.end(),
// Sort by the centre line of the extents
stable_sort(items.begin(), items.end(),
- [](const shared_ptr<
RowItem> &a, const shared_ptr<Row
Item> &b) {
+ [](const shared_ptr<
TraceTreeItem> &a, const shared_ptr<TraceTree
Item> &b) {
const auto aext = a->v_extents();
const auto bext = b->v_extents();
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;
});
int total_offset = 0;
(aext.first + aext.second) / 2 <
b->layout_v_offset() +
(bext.first + bext.second) / 2;
});
int total_offset = 0;
- for (shared_ptr<
Row
Item> r : items) {
+ for (shared_ptr<
TraceTree
Item> r : items) {
const pair<int, int> extents = r->v_extents();
if (extents.first == 0 && extents.second == 0)
continue;
const pair<int, int> extents = r->v_extents();
if (extents.first == 0 && extents.second == 0)
continue;
@@
-197,11
+196,10
@@
unsigned int TraceGroup::depth() const
void TraceGroup::ungroup()
{
void TraceGroup::ungroup()
{
- const vector< shared_ptr<RowItem> > items(
- child_items().begin(), child_items().end());
+ const vector<shared_ptr<TraceTreeItem>> items(trace_tree_child_items());
clear_child_items();
clear_child_items();
- for (shared_ptr<
Row
Item> r : items)
+ for (shared_ptr<
TraceTree
Item> r : items)
owner_->add_child_item(r);
owner_->remove_child_item(shared_from_this());
owner_->add_child_item(r);
owner_->remove_child_item(shared_from_this());
@@
-212,10
+210,10
@@
void TraceGroup::on_ungroup()
ungroup();
}
ungroup();
}
-void TraceGroup::appearance_changed(bool label, bool content)
+void TraceGroup::
row_item_
appearance_changed(bool label, bool content)
{
if (owner_)
{
if (owner_)
- owner_->appearance_changed(label, content);
+ owner_->
row_item_
appearance_changed(label, content);
}
void TraceGroup::extents_changed(bool horz, bool vert)
}
void TraceGroup::extents_changed(bool horz, bool vert)