]> sigrok.org Git - pulseview.git/commitdiff
Make traces only selectable in the header area
authorSoeren Apel <redacted>
Tue, 29 Dec 2015 22:13:18 +0000 (23:13 +0100)
committerUwe Hermann <redacted>
Wed, 30 Dec 2015 22:15:52 +0000 (23:15 +0100)
pv/view/trace.cpp
pv/view/trace.hpp
pv/view/viewitem.hpp

index f7e7ebf25b8ec00a351bb415f7fe696de155e8b6..ee0a4f0e921630b986a090bbdca494fb3849010f 100644 (file)
@@ -91,6 +91,16 @@ bool Trace::is_draggable() const
        return (cursor_pos.x() <= view->header_size().width());
 }
 
+void Trace::select(bool select)
+{
+       // Trace can only be selected if the mouse cursor is in the header area;
+       // as is_draggable() checks the same thing, we re-use it here
+       if (is_draggable() && select)
+               selected_ = true;
+       else
+               selected_ = false;
+}
+
 void Trace::paint_label(QPainter &p, const QRect &rect, bool hover)
 {
        const int y = get_visual_y();
index acaa341adbadd55f477e32d1f3e01d9cd4c662f6..88e54b1a7edcb37a95045a3f4cf4703a9b9dcbc3 100644 (file)
@@ -86,6 +86,11 @@ public:
         */
        bool is_draggable() const;
 
+       /**
+        * Selects or deselects the signal.
+        */
+       void select(bool select = true);
+
        /**
         * Computes the outline rectangle of the viewport hit-box.
         * @param rect the rectangle of the viewport area.
index a4eb6aef30423a79beefa6fa616357cdb8f3a483..c9da948ed03617778ff7caa7bb29b25c3dcde42f 100644 (file)
@@ -167,8 +167,6 @@ protected:
 protected:
        QWidget *context_parent_;
        QPoint drag_point_;
-
-private:
        bool selected_;
 };