QString() : annotations[0].annotations().front();
}
-void DecodeTrace::hover_point_changed()
+void DecodeTrace::hover_point_changed(const QPoint &hp)
{
assert(owner_);
const View *const view = owner_->view();
assert(view);
- QPoint hp = view->hover_point();
-
if (hp.x() == 0) {
QToolTip::hideText();
return;
// If it did, the tool tip would constantly hide and re-appear.
// We also push it up by one row so that it appears above the
// decode trace, not below.
- hp.setX(hp.x() - (text_size.width() / 2) - padding);
+ QPoint p = hp;
+ p.setX(hp.x() - (text_size.width() / 2) - padding);
- hp.setY(get_visual_y() - (row_height_ / 2) +
+ p.setY(get_visual_y() - (row_height_ / 2) +
(hover_row * row_height_) -
row_height_ - text_size.height() - padding);
- QToolTip::showText(view->viewport()->mapToGlobal(hp), ann);
+ QToolTip::showText(view->viewport()->mapToGlobal(p), ann);
}
void DecodeTrace::create_decoder_form(int index,
const data::DecodeChannel *ch);
public:
- void hover_point_changed();
+ void hover_point_changed(const QPoint &hp);
private Q_SLOTS:
void on_new_annotations();
namespace views {
namespace trace {
-void RowItem::hover_point_changed()
+void RowItem::hover_point_changed(const QPoint &hp)
{
+ (void)hp;
}
} // namespace trace
Q_OBJECT
public:
- virtual void hover_point_changed();
+ virtual void hover_point_changed(const QPoint &hp);
};
} // namespace trace
{
setMouseTracking(true);
- connect(&view_, SIGNAL(hover_point_changed()),
- this, SLOT(hover_point_changed()));
+ connect(&view_, SIGNAL(hover_point_changed(QPoint)),
+ this, SLOT(hover_point_changed(QPoint)));
connect(&view_, SIGNAL(offset_changed()),
this, SLOT(invalidate_tick_position_cache()));
connect(&view_, SIGNAL(scale_changed()),
return QFontMetrics(font()).ascent();
}
-void Ruler::hover_point_changed()
+void Ruler::hover_point_changed(const QPoint &hp)
{
+ (void)hp;
+
update();
}
void resizeEvent(QResizeEvent*) override;
private Q_SLOTS:
- void hover_point_changed();
+ void hover_point_changed(const QPoint &hp);
// Resets the 'tick_position_cache_'.
void invalidate_tick_position_cache();
connect(splitter_, SIGNAL(splitterMoved(int, int)),
this, SLOT(on_splitter_moved()));
- connect(this, SIGNAL(hover_point_changed()),
- this, SLOT(on_hover_point_changed()));
-
connect(&lazy_event_handler_, SIGNAL(timeout()),
this, SLOT(process_sticky_events()));
lazy_event_handler_.setSingleShot(true);
else
hover_point_ = QPoint(-1, -1);
- hover_point_changed();
+ update_hover_point();
} else if (type == QEvent::Leave) {
hover_point_ = QPoint(-1, -1);
- hover_point_changed();
+ update_hover_point();
} else if (type == QEvent::Show) {
// This is somewhat of a hack, unfortunately. We cannot use
update_layout();
}
+void View::update_hover_point()
+{
+ const vector<shared_ptr<TraceTreeItem>> trace_tree_items(
+ list_by_type<TraceTreeItem>());
+ for (shared_ptr<TraceTreeItem> r : trace_tree_items)
+ r->hover_point_changed(hover_point_);
+
+ hover_point_changed(hover_point_);
+}
+
void View::row_item_appearance_changed(bool label, bool content)
{
if (label)
sticky_events_ = 0;
}
-void View::on_hover_point_changed()
-{
- const vector<shared_ptr<TraceTreeItem>> trace_tree_items(
- list_by_type<TraceTreeItem>());
- for (shared_ptr<TraceTreeItem> r : trace_tree_items)
- r->hover_point_changed();
-}
-
} // namespace trace
} // namespace views
} // namespace pv
void restack_all_trace_tree_items();
Q_SIGNALS:
- void hover_point_changed();
+ void hover_point_changed(const QPoint &hp);
void selection_changed();
void resizeEvent(QResizeEvent *event);
+ void update_hover_point();
+
public:
void row_item_appearance_changed(bool label, bool content);
void time_item_appearance_changed(bool label, bool content);
void process_sticky_events();
- void on_hover_point_changed();
-
/**
* Sets the 'offset_' member and emits the 'offset_changed'
* signal if needed.