X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fview%2Ftrace.h;h=4866b558ca3d537b4c671450d0a9f0a9bcf37f44;hp=ff65a2138536945d2f95115ffbfc38738331862c;hb=7c238e082a6fadc14f90285805f5901cc8f68570;hpb=569d1e41fbc1be584efdbcdc2c8a01e7af3353ed diff --git a/pv/view/trace.h b/pv/view/trace.h index ff65a213..4866b558 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,37 @@ protected: */ void paint_axis(QPainter &p, int y, int left, int right); - virtual void populate_popup_form(QWidget *parent, QFormLayout *form); + void add_colour_option(QWidget *parent, QFormLayout *form); -private: + void create_popup_form(); - /** - * Computes an caches the size of the label text. - */ - void compute_text_size(QPainter &p); + virtual void populate_popup_form(QWidget *parent, QFormLayout *form); - /** - * 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); +private Q_SLOTS: + void on_text_changed(const QString &text); -private slots: - void on_action_set_name_triggered(); + void on_colour_changed(const QColor &colour); - void on_action_set_colour_triggered(); + void on_popup_closed(); -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