X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fviews%2Ftrace%2Fcursor.cpp;h=80eaba232b1d8157b2bbfacbb40ebe202e79670a;hb=74bf66669012692f7eda790abe724bd5bb4ae8c6;hp=0fcb6faf44dd9048b9ea842fdc57d7734b28a3f9;hpb=4468ee4246cd5e47845494e8b3b22a17d434ed5b;p=pulseview.git diff --git a/pv/views/trace/cursor.cpp b/pv/views/trace/cursor.cpp index 0fcb6faf..80eaba23 100644 --- a/pv/views/trace/cursor.cpp +++ b/pv/views/trace/cursor.cpp @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -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());