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 
69  void on_tabWidget_currentChanged(int index);
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::_mapped_data
PlotDataMapRef & _mapped_data
Definition: tabbedplotwidget.h:98
TabbedPlotWidget::xmlLoadState
bool xmlLoadState(QDomElement &tabbed_area)
Definition: tabbedplotwidget.cpp:200
TabbedPlotWidget::setStreamingMode
void setStreamingMode(bool streaming_mode)
Definition: tabbedplotwidget.cpp:237
TabbedPlotWidget::closeEvent
virtual void closeEvent(QCloseEvent *event) override
Definition: tabbedplotwidget.cpp:416
TabbedPlotWidget::paintEvent
void paintEvent(QPaintEvent *event) override
Definition: tabbedplotwidget.cpp:100
TabbedPlotWidget::MainWindowArea
Definition: tabbedplotwidget.h:21
TabbedPlotWidget::created
void created()
TabbedPlotWidget::_tabWidget
QTabWidget * _tabWidget
Definition: tabbedplotwidget.h:84
TabbedPlotWidget::xmlSaveState
QDomElement xmlSaveState(QDomDocument &doc) const
Definition: tabbedplotwidget.cpp:177
TabbedPlotWidget::instance
static TabbedPlotWidget * instance(const QString &key)
Definition: tabbedplotwidget.cpp:426
TabbedPlotWidget::on_tabWidget_tabCloseRequested
void on_tabWidget_tabCloseRequested(int index)
Definition: tabbedplotwidget.cpp:300
TabbedPlotWidget::_parent_type
QString _parent_type
Definition: tabbedplotwidget.h:102
TabbedPlotWidget::undoableChange
void undoableChange()
TabbedPlotWidget::_buttonLegend
QPushButton * _buttonLegend
Definition: tabbedplotwidget.h:87
TabbedPlotWidget::on_renameCurrentTab
void on_renameCurrentTab()
Definition: tabbedplotwidget.cpp:245
TabbedPlotWidget::tabWidget
QTabWidget * tabWidget()
Definition: tabbedplotwidget.cpp:113
TabbedPlotWidget::_name
const QString _name
Definition: tabbedplotwidget.h:94
TabbedPlotWidget::instances
static const std::map< QString, TabbedPlotWidget * > & instances()
Definition: tabbedplotwidget.cpp:421
TabbedPlotWidget::eventFilter
virtual bool eventFilter(QObject *obj, QEvent *event) override
Definition: tabbedplotwidget.cpp:354
TabbedPlotWidget::on_addTabButton_pressed
void on_addTabButton_pressed()
Definition: tabbedplotwidget.cpp:265
TabbedPlotWidget::addTab
PlotDocker * addTab(QString name)
Definition: tabbedplotwidget.cpp:123
TabbedPlotWidget::on_stylesheetChanged
void on_stylesheetChanged(QString style_dir)
Definition: tabbedplotwidget.cpp:260
TabbedPlotWidget::setControlsVisible
void setControlsVisible(bool visible)
Definition: tabbedplotwidget.cpp:439
TabbedPlotWidget::TabbedPlotWidget
TabbedPlotWidget(QString name, QMainWindow *main_window, PlotDataMapRef &mapped_data, QMainWindow *parent)
Definition: tabbedplotwidget.cpp:28
TabbedPlotWidget::_horizontal_link
bool _horizontal_link
Definition: tabbedplotwidget.h:100
TabbedPlotWidget::name
QString name() const
Definition: tabbedplotwidget.h:42
TabbedPlotWidget::on_tabWidget_currentChanged
void on_tabWidget_currentChanged(int index)
Definition: tabbedplotwidget.cpp:271
plot_docker.h
PlotDocker
Definition: plot_docker.h:45
TabbedPlotWidget::sendTabToNewWindow
void sendTabToNewWindow(PlotDocker *)
TabbedPlotWidget::~TabbedPlotWidget
~TabbedPlotWidget() override
Definition: tabbedplotwidget.cpp:241
TabbedPlotWidget::on_buttonLinkHorizontalScale_toggled
void on_buttonLinkHorizontalScale_toggled(bool checked)
Definition: tabbedplotwidget.cpp:325
TabbedPlotWidget::_main_window
QMainWindow * _main_window
Definition: tabbedplotwidget.h:96
TabbedPlotWidget::on_requestTabMovement
void on_requestTabMovement(const QString &destination_name)
Definition: tabbedplotwidget.cpp:336
TabbedPlotWidget::on_moveTabIntoNewWindow
void on_moveTabIntoNewWindow()
Definition: tabbedplotwidget.cpp:349
PJ::PlotDataMapRef
Definition: plotdata.h:34
TabbedPlotWidget::_instances
static std::map< QString, TabbedPlotWidget * > _instances
Definition: tabbedplotwidget.h:111
TabbedPlotWidget::_buttonHorizontalLink
QPushButton * _buttonHorizontalLink
Definition: tabbedplotwidget.h:86
TabbedPlotWidget::_buttonAddTab
QPushButton * _buttonAddTab
Definition: tabbedplotwidget.h:88
TabbedPlotWidget
Definition: tabbedplotwidget.h:16
TabbedPlotWidget::tabAdded
void tabAdded(PlotDocker *)
TabbedPlotWidget::currentTab
PlotDocker * currentTab()
Definition: tabbedplotwidget.cpp:108


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:47