tabbedplotwidget.h
Go to the documentation of this file.
1 /*
2  * This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at https://mozilla.org/MPL/2.0/.
5  */
6 
7 #ifndef TABBEDPLOTWIDGET_H
8 #define TABBEDPLOTWIDGET_H
9 
10 #include <QWidget>
11 #include <QMainWindow>
12 #include <QTableWidget>
13 #include <QDomDocument>
14 #include "plot_docker.h"
15 
16 class TabbedPlotWidget : public QWidget
17 {
18  Q_OBJECT
19 
20 public:
21  typedef struct
22  {
24 
25  explicit TabbedPlotWidget(QString name, QMainWindow* main_window,
26  PlotDataMapRef& mapped_data, QMainWindow* parent);
27 
29 
30  QTabWidget* tabWidget();
31 
32  const QTabWidget* tabWidget() const;
33 
34  PlotDocker* addTab(QString name);
35 
36  QDomElement xmlSaveState(QDomDocument& doc) const;
37 
38  bool xmlLoadState(QDomElement& tabbed_area);
39 
40  ~TabbedPlotWidget() override;
41 
42  QString name() const
43  {
44  return _name;
45  }
46 
47  static const std::map<QString, TabbedPlotWidget*>& instances();
48 
49  static TabbedPlotWidget* instance(const QString& key);
50 
51  void setControlsVisible(bool visible);
52 
53 public slots:
54 
55  void setStreamingMode(bool streaming_mode);
56 
57  // static void saveTabImage(QString fileName, PlotDocker* matrix);
58 
59  void on_stylesheetChanged(QString style_dir);
60 
61 private slots:
62 
63  void on_renameCurrentTab();
64 
65  // void on_savePlotsToFile();
66 
68 
70 
71  void on_tabWidget_tabCloseRequested(int index);
72 
73  void on_buttonLinkHorizontalScale_toggled(bool checked);
74 
75  void on_requestTabMovement(const QString& destination_name);
76 
78 
79  // TODO void onMoveWidgetIntoNewTab(QString plot_name);
80 
81  void paintEvent(QPaintEvent* event) override;
82 
83 private:
84  QTabWidget* _tabWidget;
85 
86  QPushButton* _buttonHorizontalLink;
87  QPushButton* _buttonLegend;
88  QPushButton* _buttonAddTab;
89 
90  // TODO QAction* _action_savePlots;
91 
92  // QMenu* _tab_menu;
93 
94  const QString _name;
95 
96  QMainWindow* _main_window;
97 
99 
101 
102  QString _parent_type;
103 
104  virtual void closeEvent(QCloseEvent* event) override;
105 
106  // void printPlotsNames();
107 
108 protected:
109  virtual bool eventFilter(QObject* obj, QEvent* event) override;
110 
111  static std::map<QString, TabbedPlotWidget*> _instances;
112 
113 signals:
114  void created();
115  void undoableChange();
116  void tabAdded(PlotDocker*);
118 };
119 
120 #endif // TABBEDPLOTWIDGET_H
TabbedPlotWidget(QString name, QMainWindow *main_window, PlotDataMapRef &mapped_data, QMainWindow *parent)
QString name() const
void on_stylesheetChanged(QString style_dir)
void on_tabWidget_currentChanged(int index)
void on_buttonLinkHorizontalScale_toggled(bool checked)
QMainWindow * _main_window
static std::map< QString, TabbedPlotWidget * > _instances
void on_requestTabMovement(const QString &destination_name)
void tabAdded(PlotDocker *)
~TabbedPlotWidget() override
PlotDataMapRef & _mapped_data
void sendTabToNewWindow(PlotDocker *)
PlotDocker * currentTab()
void paintEvent(QPaintEvent *event) override
bool xmlLoadState(QDomElement &tabbed_area)
void setStreamingMode(bool streaming_mode)
QPushButton * _buttonHorizontalLink
QPushButton * _buttonAddTab
QTabWidget * tabWidget()
static TabbedPlotWidget * instance(const QString &key)
virtual void closeEvent(QCloseEvent *event) override
QDomElement xmlSaveState(QDomDocument &doc) const
QPushButton * _buttonLegend
QTabWidget * _tabWidget
virtual bool eventFilter(QObject *obj, QEvent *event) override
void setControlsVisible(bool visible)
void on_tabWidget_tabCloseRequested(int index)
PlotDocker * addTab(QString name)
const QString _name
static const std::map< QString, TabbedPlotWidget * > & instances()


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Jun 19 2023 03:12:53