X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fview%2Ftimemarker.h;h=328d428f0e52ca547c48840d5a4071e247c78e14;hp=616221b23ba139afd1992b9ac7d6acc9332db1d8;hb=ef8311a4296a2dc85c82b063de61efa4eb7a8404;hpb=cd6c8ee24fe845fc7d4fcbf8672bb8cdd3afea1a diff --git a/pv/view/timemarker.h b/pv/view/timemarker.h index 616221b2..328d428f 100644 --- a/pv/view/timemarker.h +++ b/pv/view/timemarker.h @@ -22,6 +22,12 @@ #define PULSEVIEW_PV_VIEW_MARKER_H #include +#include +#include +#include +#include + +#include "selectableitem.h" class QPainter; class QRect; @@ -31,8 +37,10 @@ namespace view { class View; -class TimeMarker +class TimeMarker : public SelectableItem { + Q_OBJECT + protected: /** * Constructor. @@ -40,9 +48,11 @@ protected: * @param colour A reference to the colour of this cursor. * @param time The time to set the flag to. */ - TimeMarker(const View &view, const QColor &colour, double time); + TimeMarker(View &view, const QColor &colour, double time); public: + virtual void init_context_bar_actions(QWidget *parent); + /** * Gets the time of the marker. */ @@ -60,21 +70,48 @@ public: */ virtual void paint(QPainter &p, const QRect &rect); + /** + * Gets the marker label rectangle. + * @param rect The rectangle of the ruler client area. + * @return Returns the label rectangle. + */ + virtual QRectF get_label_rect(const QRect &rect) const = 0; + /** * Paints the marker's label to the ruler. * @param p The painter to draw with. * @param rect The rectangle of the ruler client area. + * @param prefix The SI prefix to paint time value with. */ - virtual void paint_label(QPainter &p, const QRect &rect) = 0; + virtual void paint_label(QPainter &p, const QRect &rect, + unsigned int prefix) = 0; + + /** + * Returns a list of context menu items to show in the context + * bar. + */ + const std::list get_context_bar_actions(); + +private slots: + void on_value_changed(double value); + +signals: + void time_changed(); protected: - const View &_view; + View &_view; const QColor &_colour; double _time; + + QSizeF _text_size; + + QWidgetAction *_value_action; + QDoubleSpinBox *_value_widget; + bool _updating_value_widget; }; } // namespace view } // namespace pv -#endif // PULSEVIEW_PV_VIEW_MARKER_H \ No newline at end of file +#endif // PULSEVIEW_PV_VIEW_MARKER_H