X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fview%2Ftrace.h;h=5f54ea1ddb0e16bcb35393a415e29b97eae8c00a;hb=2ae445ba4e7dc7924dae64cc62b75a9673e6fbdc;hp=ff65a2138536945d2f95115ffbfc38738331862c;hpb=569d1e41fbc1be584efdbcdc2c8a01e7af3353ed;p=pulseview.git diff --git a/pv/view/trace.h b/pv/view/trace.h index ff65a213..5f54ea1d 100644 --- a/pv/view/trace.h +++ b/pv/view/trace.h @@ -18,8 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef PULSEVIEW_PV_TRACE_H -#define PULSEVIEW_PV_TRACE_H +#ifndef PULSEVIEW_PV_VIEW_TRACE_H +#define PULSEVIEW_PV_VIEW_TRACE_H #include #include @@ -31,14 +31,9 @@ #include "selectableitem.h" -namespace pv { - -class SigSession; - -namespace widgets { -class Popup; -} +class QFormLayout; +namespace pv { namespace view { class View; @@ -52,7 +47,7 @@ private: static const int LabelHitPadding; protected: - Trace(SigSession &session, QString name); + Trace(QString name); public: /** @@ -117,7 +112,7 @@ public: virtual void paint_fore(QPainter &p, int left, int right); /** - * Paints the signal label into a QGLWidget. + * Paints the signal label. * @param p the QPainter to paint into. * @param right the x-coordinate of the right edge of the header * area. @@ -144,7 +139,16 @@ public: */ int get_y() const; + /** + * Computes the outline rectangle of a label. + * @param right the x-coordinate of the right edge of the header + * area. + * @return Returns the rectangle of the signal label. + */ + QRectF get_label_rect(int right); + protected: + /** * Gets the text colour. * @remarks This colour is computed by comparing the lightness @@ -162,44 +166,41 @@ protected: */ void paint_axis(QPainter &p, int y, int left, int right); + void add_colour_option(QWidget *parent, QFormLayout *form); + + void create_popup_form(); + virtual void populate_popup_form(QWidget *parent, QFormLayout *form); -private: + virtual void hover_point_changed(); - /** - * Computes an caches the size of the label text. - */ - void compute_text_size(QPainter &p); +private Q_SLOTS: + void on_text_changed(const QString &text); - /** - * Computes the outline rectangle of a label. - * @param p the QPainter to lay out text with. - * @param right the x-coordinate of the right edge of the header - * area. - * @return Returns the rectangle of the signal label. - */ - QRectF get_label_rect(int right); + void on_colour_changed(const QColor &colour); -private slots: - void on_action_set_name_triggered(); + void on_popup_closed(); - void on_action_set_colour_triggered(); + void on_hover_point_changed(); -signals: +Q_SIGNALS: + void visibility_changed(); void text_changed(); + void colour_changed(); protected: - pv::SigSession &_session; pv::view::View *_view; QString _name; QColor _colour; int _v_offset; - QSizeF _text_size; +private: + pv::widgets::Popup *_popup; + QFormLayout *_popup_form; }; } // namespace view } // namespace pv -#endif // PULSEVIEW_PV_TRACEL_H +#endif // PULSEVIEW_PV_VIEW_TRACE_H