From: Soeren Apel Date: Tue, 17 Oct 2023 23:35:44 +0000 (+0200) Subject: TimeMarker: Automatically deselect item when popup closes X-Git-Url: http://sigrok.org/gitweb/?p=pulseview.git;a=commitdiff_plain;h=499f68de03c8e4b08d62283a233e44af517fe696 TimeMarker: Automatically deselect item when popup closes If this is not done, the item remains selected and the user has to manually deselect it, which is bothersome. --- diff --git a/pv/views/trace/timemarker.cpp b/pv/views/trace/timemarker.cpp index af1d55d6..063e579a 100644 --- a/pv/views/trace/timemarker.cpp +++ b/pv/views/trace/timemarker.cpp @@ -184,6 +184,8 @@ pv::widgets::Popup* TimeMarker::create_popup(QWidget *parent) popup->set_position(parent->mapToGlobal( drag_point(parent->rect())), Popup::Bottom); + connect(popup, SIGNAL(closed()), this, SLOT(on_popup_closed())); + QFormLayout *const form = new QFormLayout(popup); popup->setLayout(form); @@ -198,6 +200,11 @@ pv::widgets::Popup* TimeMarker::create_popup(QWidget *parent) return popup; } +void TimeMarker::on_popup_closed() +{ + select(false); +} + void TimeMarker::on_value_changed(const pv::util::Timestamp& value) { set_time(view_.ruler()->get_absolute_time_from_ruler_time(value)); diff --git a/pv/views/trace/timemarker.hpp b/pv/views/trace/timemarker.hpp index 00998462..f67a0f17 100644 --- a/pv/views/trace/timemarker.hpp +++ b/pv/views/trace/timemarker.hpp @@ -128,6 +128,8 @@ public: virtual pv::widgets::Popup* create_popup(QWidget *parent) override; private Q_SLOTS: + void on_popup_closed(); + void on_value_changed(const pv::util::Timestamp& value); protected: