GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
displayform.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2012 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 #ifndef DISPLAY_FORM_H
12 #define DISPLAY_FORM_H
13 
14 #include <gnuradio/qtgui/api.h>
16 #include <QtGui/QtGui>
17 #include <vector>
18 
19 #include <qwt_plot_grid.h>
20 #include <qwt_plot_layout.h>
21 
24 
25 /*!
26  * \brief Base class for setting up and managing QTGUI plot forms.
27  * \ingroup qtgui_blk
28  */
29 class QTGUI_API DisplayForm : public QWidget
30 {
31  Q_OBJECT
32 
33 public:
34  DisplayForm(int nplots = 1, QWidget* parent = 0);
35  ~DisplayForm() override;
36 
37  virtual DisplayPlot* getPlot() = 0;
38  void Reset();
39  bool isClosed() const;
40 
41  void enableMenu(bool en = true);
42 
43 public slots:
44  void mousePressEvent(QMouseEvent* e) override;
45  void customEvent(QEvent* e) override = 0;
46 
47  void closeEvent(QCloseEvent* e) override;
48 
49  void setUpdateTime(double t);
50 
51  void setTitle(const QString& title);
52  void setLineLabel(unsigned int which, const QString& label);
53  void setLineColor(unsigned int which, const QString& color);
54  void setLineWidth(unsigned int which, unsigned int width);
55  void setLineStyle(unsigned int which, Qt::PenStyle style);
56  void setLineMarker(unsigned int which, QwtSymbol::Style style);
57  void setMarkerAlpha(unsigned int which, unsigned int alpha);
58 
59  QString title();
60  QString lineLabel(unsigned int which);
61  QString lineColor(unsigned int which);
62  int lineWidth(unsigned int which);
63  Qt::PenStyle lineStyle(unsigned int which);
64  QwtSymbol::Style lineMarker(unsigned int which);
65  int markerAlpha(unsigned int which);
66 
67  virtual void setSampleRate(const QString& rate);
68 
69  void setStop(bool on);
70  void setStop();
71 
72  void setGrid(bool on);
73  void setAxisLabels(bool en);
74 
75  void saveFigure();
76 
77  void disableLegend();
78 
79 private slots:
80  virtual void newData(const QEvent*) = 0;
81  virtual void autoScale(bool) = 0;
82  void updateGuiTimer();
83 
84  virtual void onPlotPointSelected(const QPointF p);
85 
86 signals:
87  void plotPointSelected(const QPointF p, int type);
88  void toggleGrid(bool en);
89 
90 protected:
91  bool d_isclosed;
92 
93  unsigned int d_nplots;
94 
95  QGridLayout* d_layout;
98 
99  QwtPlotGrid* d_grid;
100 
101  bool d_menu_on;
102  QMenu* d_menu;
103 
104  QAction* d_stop_act;
106  QAction* d_grid_act;
110 
111  QAction* d_autoscale_act;
113 
114  QList<QMenu*> d_lines_menu;
115  QList<LineTitleAction*> d_line_title_act;
116  QList<LineColorMenu*> d_line_color_menu;
117  QList<LineWidthMenu*> d_line_width_menu;
118  QList<LineStyleMenu*> d_line_style_menu;
119  QList<LineMarkerMenu*> d_line_marker_menu;
120  QList<MarkerAlphaMenu*> d_marker_alpha_menu;
121 
123  QAction* d_save_act;
124 
126 };
127 
128 #endif /* DISPLAY_FORM_H */
Base class for setting up and managing QTGUI plot forms.
Definition: displayform.h:30
QwtSymbol::Style lineMarker(unsigned int which)
bool d_menu_on
Definition: displayform.h:101
void setAxisLabels(bool en)
QAction * d_stop_act
Definition: displayform.h:104
void setLineStyle(unsigned int which, Qt::PenStyle style)
void enableMenu(bool en=true)
QList< LineStyleMenu * > d_line_style_menu
Definition: displayform.h:118
int markerAlpha(unsigned int which)
QList< LineTitleAction * > d_line_title_act
Definition: displayform.h:115
bool d_stop_state
Definition: displayform.h:105
void customEvent(QEvent *e) override=0
void setTitle(const QString &title)
QAction * d_grid_act
Definition: displayform.h:106
QwtPlotGrid * d_grid
Definition: displayform.h:99
void setGrid(bool on)
void disableLegend()
QList< MarkerAlphaMenu * > d_marker_alpha_menu
Definition: displayform.h:120
void setLineWidth(unsigned int which, unsigned int width)
bool isClosed() const
void setStop(bool on)
double d_update_time
Definition: displayform.h:125
QString title()
bool d_axislabels
Definition: displayform.h:109
void setMarkerAlpha(unsigned int which, unsigned int alpha)
Qt::PenStyle lineStyle(unsigned int which)
QList< LineMarkerMenu * > d_line_marker_menu
Definition: displayform.h:119
void closeEvent(QCloseEvent *e) override
~DisplayForm() override
bool d_isclosed
Definition: displayform.h:91
void setLineColor(unsigned int which, const QString &color)
void mousePressEvent(QMouseEvent *e) override
QAction * d_axislabelsmenu
Definition: displayform.h:108
QList< LineColorMenu * > d_line_color_menu
Definition: displayform.h:116
QMenu * d_menu
Definition: displayform.h:102
void setUpdateTime(double t)
void saveFigure()
QAction * d_save_act
Definition: displayform.h:123
virtual void setSampleRate(const QString &rate)
void toggleGrid(bool en)
void setLineMarker(unsigned int which, QwtSymbol::Style style)
bool d_grid_state
Definition: displayform.h:107
QString lineLabel(unsigned int which)
void Reset()
DisplayPlot * d_display_plot
Definition: displayform.h:96
int lineWidth(unsigned int which)
bool d_autoscale_state
Definition: displayform.h:112
QList< QMenu * > d_lines_menu
Definition: displayform.h:114
virtual DisplayPlot * getPlot()=0
DisplayForm(int nplots=1, QWidget *parent=0)
void plotPointSelected(const QPointF p, int type)
QString lineColor(unsigned int which)
PopupMenu * d_samp_rate_act
Definition: displayform.h:122
bool d_system_specified_flag
Definition: displayform.h:97
QAction * d_autoscale_act
Definition: displayform.h:111
void setLineLabel(unsigned int which, const QString &label)
void setStop()
QList< LineWidthMenu * > d_line_width_menu
Definition: displayform.h:117
QGridLayout * d_layout
Definition: displayform.h:95
unsigned int d_nplots
Definition: displayform.h:93
QWidget base plot to build QTGUI plotting tools.
Definition: DisplayPlot.h:42
Definition: form_menus.h:1191
#define QTGUI_API
Definition: gr-qtgui/include/gnuradio/qtgui/api.h:18