]> sigrok.org Git - pulseview.git/commitdiff
TimeMarker: Automatically deselect item when popup closes
authorSoeren Apel <redacted>
Tue, 17 Oct 2023 23:35:44 +0000 (01:35 +0200)
committerSoeren Apel <redacted>
Wed, 18 Oct 2023 23:00:27 +0000 (01:00 +0200)
If this is not done, the item remains selected and the user has to manually deselect it, which is bothersome.

pv/views/trace/timemarker.cpp
pv/views/trace/timemarker.hpp

index af1d55d66bd254f28fee96a9f8fe3bec60cedd33..063e579a6cc3dd73567e85e490b17d73abb4b6be 100644 (file)
@@ -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));
index 00998462513f41c576f2e5e25f477308bc861c0e..f67a0f17a1e36567bb050afa23d6ecedaccdbb2c 100644 (file)
@@ -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: