GNU Radio C++ API Reference  gf8e89b7
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 
40  void enableMenu(bool en = true);
41 
42 public slots:
43  void mousePressEvent(QMouseEvent* e) override;
44  void customEvent(QEvent* e) override = 0;
45 
46  void closeEvent(QCloseEvent* e) override;
47 
48  void setUpdateTime(double t);
49 
50  void setTitle(const QString& title);
51  void setLineLabel(unsigned int which, const QString& label);
52  void setLineColor(unsigned int which, const QString& color);
53  void setLineWidth(unsigned int which, unsigned int width);
54  void setLineStyle(unsigned int which, Qt::PenStyle style);
55  void setLineMarker(unsigned int which, QwtSymbol::Style style);
56  void setMarkerAlpha(unsigned int which, unsigned int alpha);
57 
58  QString title();
59  QString lineLabel(unsigned int which);
60  QString lineColor(unsigned int which);
61  int lineWidth(unsigned int which);
62  Qt::PenStyle lineStyle(unsigned int which);
63  QwtSymbol::Style lineMarker(unsigned int which);
64  int markerAlpha(unsigned int which);
65 
66  virtual void setSampleRate(const QString& rate);
67 
68  void setStop(bool on);
69  void setStop();
70 
71  void setGrid(bool on);
72  void setAxisLabels(bool en);
73 
74  void saveFigure();
75 
76  void disableLegend();
77 
78 private slots:
79  virtual void newData(const QEvent*) = 0;
80  virtual void autoScale(bool) = 0;
81  void updateGuiTimer();
82 
83  virtual void onPlotPointSelected(const QPointF p);
84 
85 signals:
86  void plotPointSelected(const QPointF p, int type);
87  void toggleGrid(bool en);
88 
89 protected:
90  unsigned int d_nplots;
91 
92  QGridLayout* d_layout;
95 
96  QwtPlotGrid* d_grid;
97 
98  bool d_menu_on;
99  QMenu* d_menu;
100 
101  QAction* d_stop_act;
103  QAction* d_grid_act;
107 
108  QAction* d_autoscale_act;
110 
111  QList<QMenu*> d_lines_menu;
112  QList<LineTitleAction*> d_line_title_act;
113  QList<LineColorMenu*> d_line_color_menu;
114  QList<LineWidthMenu*> d_line_width_menu;
115  QList<LineStyleMenu*> d_line_style_menu;
116  QList<LineMarkerMenu*> d_line_marker_menu;
117  QList<MarkerAlphaMenu*> d_marker_alpha_menu;
118 
120  QAction* d_save_act;
121 
123 };
124 
125 #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:98
void setAxisLabels(bool en)
QAction * d_stop_act
Definition: displayform.h:101
void setLineStyle(unsigned int which, Qt::PenStyle style)
void enableMenu(bool en=true)
QList< LineStyleMenu * > d_line_style_menu
Definition: displayform.h:115
int markerAlpha(unsigned int which)
QList< LineTitleAction * > d_line_title_act
Definition: displayform.h:112
bool d_stop_state
Definition: displayform.h:102
void customEvent(QEvent *e) override=0
void setTitle(const QString &title)
QAction * d_grid_act
Definition: displayform.h:103
QwtPlotGrid * d_grid
Definition: displayform.h:96
void setGrid(bool on)
void disableLegend()
QList< MarkerAlphaMenu * > d_marker_alpha_menu
Definition: displayform.h:117
void setLineWidth(unsigned int which, unsigned int width)
void setStop(bool on)
double d_update_time
Definition: displayform.h:122
QString title()
bool d_axislabels
Definition: displayform.h:106
void setMarkerAlpha(unsigned int which, unsigned int alpha)
Qt::PenStyle lineStyle(unsigned int which)
QList< LineMarkerMenu * > d_line_marker_menu
Definition: displayform.h:116
void closeEvent(QCloseEvent *e) override
~DisplayForm() override
void setLineColor(unsigned int which, const QString &color)
void mousePressEvent(QMouseEvent *e) override
QAction * d_axislabelsmenu
Definition: displayform.h:105
QList< LineColorMenu * > d_line_color_menu
Definition: displayform.h:113
QMenu * d_menu
Definition: displayform.h:99
void setUpdateTime(double t)
void saveFigure()
QAction * d_save_act
Definition: displayform.h:120
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:104
QString lineLabel(unsigned int which)
void Reset()
DisplayPlot * d_display_plot
Definition: displayform.h:93
int lineWidth(unsigned int which)
bool d_autoscale_state
Definition: displayform.h:109
QList< QMenu * > d_lines_menu
Definition: displayform.h:111
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:119
bool d_system_specified_flag
Definition: displayform.h:94
QAction * d_autoscale_act
Definition: displayform.h:108
void setLineLabel(unsigned int which, const QString &label)
void setStop()
QList< LineWidthMenu * > d_line_width_menu
Definition: displayform.h:114
QGridLayout * d_layout
Definition: displayform.h:92
unsigned int d_nplots
Definition: displayform.h:90
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