32 using std::shared_ptr;
52 [](
const shared_ptr<ViewItem> &r) {
return r->enabled(); });
91 const QPointF points[] = {
101 Qt::SolidLine, Qt::SquareCap, Qt::RoundJoin));
102 p.setBrush(Qt::transparent);
103 p.drawPolyline(points,
countof(points));
107 Qt::SolidLine, Qt::SquareCap, Qt::RoundJoin));
108 p.drawPolyline(points,
countof(points));
112 p.drawPolyline(points,
countof(points));
119 if (r && r->enabled())
120 child_rect = child_rect.united(r->label_rect(rect));
122 return QRectF(child_rect.x() -
Width -
Padding, child_rect.y(),
123 Width, child_rect.height());
137 QMenu *
const menu =
new QMenu(parent);
139 QAction *
const ungroup =
new QAction(tr(
"Ungroup"),
this);
140 ungroup->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_U));
141 connect(ungroup, SIGNAL(triggered()),
this, SLOT(
on_ungroup()));
142 menu->addAction(ungroup);
163 stable_sort(items.begin(), items.end(),
164 [](
const shared_ptr<TraceTreeItem> &a,
const shared_ptr<TraceTreeItem> &b) {
165 const auto aext = a->v_extents();
166 const auto bext = b->v_extents();
167 return a->layout_v_offset() +
168 (aext.first + aext.second) / 2 <
169 b->layout_v_offset() +
170 (bext.first + bext.second) / 2;
173 int total_offset = 0;
174 for (shared_ptr<TraceTreeItem> r : items) {
175 const pair<int, int> extents = r->v_extents();
176 if (extents.first == 0 && extents.second == 0)
182 total_offset += -extents.first;
185 r->set_layout_v_offset(total_offset);
188 total_offset += extents.second;
202 for (shared_ptr<TraceTreeItem> r : items)
virtual void row_item_appearance_changed(bool label, bool content)=0
void extents_changed(bool horz, bool vert)
std::vector< std::shared_ptr< TraceTreeItem > > trace_tree_child_items() const
std::pair< int, int > v_extents() const
int visual_v_offset() const
std::pair< int, int > v_extents() const
void row_item_appearance_changed(bool label, bool content)
static const int LineThickness
virtual void extents_changed(bool horz, bool vert)=0
pv::widgets::Popup * create_popup(QWidget *parent)
virtual const item_list & child_items() const
QMenu * create_context_menu(QWidget *parent)
static const QColor LineColour
virtual pv::view::View * view()=0
virtual pv::view::View * view()
void add_child_item(std::shared_ptr< TraceTreeItem > item)
QRectF label_rect(const QRectF &rect) const
int owner_visual_v_offset() const
void paint_label(QPainter &p, const QRect &rect, bool hover)
virtual unsigned int depth() const =0
unsigned int depth() const
TraceTreeItemOwner * owner_
virtual int owner_visual_v_offset() const =0
bool pt_in_label_rect(int left, int right, const QPoint &point)
static QPen highlight_pen()
void remove_child_item(std::shared_ptr< TraceTreeItem > item)
virtual pv::Session & session()=0