X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fviews%2Ftrace%2Fcursor.cpp;h=80eaba232b1d8157b2bbfacbb40ebe202e79670a;hb=0bb3dd25421a8638afb881d46799a13378d3f00b;hp=c218440e31eae87f04f482c448a7a0b150216f4a;hpb=39173000c5d0d164c52443d16a1dc434d538b198;p=pulseview.git diff --git a/pv/views/trace/cursor.cpp b/pv/views/trace/cursor.cpp index c218440e..80eaba23 100644 --- a/pv/views/trace/cursor.cpp +++ b/pv/views/trace/cursor.cpp @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -59,7 +60,7 @@ QString Cursor::get_text() const const pv::util::Timestamp& diff = abs(time_ - other->time_); return Ruler::format_time_with_distance( - diff, view_.absolute_to_ruler_time(time_), + diff, view_.ruler()->get_ruler_time_from_absolute_time(time_), view_.tick_prefix(), view_.time_unit(), view_.tick_precision()); } @@ -89,6 +90,19 @@ QRectF Cursor::label_rect(const QRectF &rect) const return QRectF(x - label_size.width(), top, label_size.width(), height); } +QMenu *Cursor::create_header_context_menu(QWidget *parent) +{ + QMenu *const menu = new QMenu(parent); + + QAction *const snap_disable = new QAction(tr("Disable snapping"), this); + snap_disable->setCheckable(true); + snap_disable->setChecked(snapping_disabled_); + connect(snap_disable, &QAction::toggled, this, [=](bool checked){snapping_disabled_ = checked;}); + menu->addAction(snap_disable); + + return menu; +} + shared_ptr Cursor::get_other_cursor() const { const shared_ptr cursors(view_.cursors());