Go to the documentation of this file.00001 #ifndef TABBEDPLOTWIDGET_H
00002 #define TABBEDPLOTWIDGET_H
00003
00004 #include <QWidget>
00005 #include <QMainWindow>
00006 #include <QTableWidget>
00007 #include "plotmatrix.h"
00008
00009 namespace Ui {
00010 class TabbedPlotWidget;
00011 }
00012
00013
00014 class TabbedPlotWidget : public QWidget
00015 {
00016 Q_OBJECT
00017
00018 public:
00019 typedef struct{} MainWindowArea;
00020
00021 explicit TabbedPlotWidget(QString name,
00022 QMainWindow *main_window,
00023 PlotMatrix* first_tab,
00024 PlotDataMapRef &mapped_data,
00025 QMainWindow *parent );
00026
00027 PlotMatrix* currentTab();
00028
00029 QTabWidget* tabWidget();
00030
00031 const QTabWidget* tabWidget() const;
00032
00033 void addTab(PlotMatrix *tab = nullptr);
00034
00035 QDomElement xmlSaveState(QDomDocument &doc) const;
00036
00037 bool xmlLoadState(QDomElement &tabbed_area);
00038
00039 ~TabbedPlotWidget() override;
00040
00041 QString name() const { return _name; }
00042
00043 static const std::map<QString,TabbedPlotWidget*>& instances();
00044
00045 static TabbedPlotWidget *instance(const QString& key);
00046
00047 void setControlsVisible(bool visible);
00048
00049 public slots:
00050
00051 void setStreamingMode(bool streaming_mode);
00052
00053 static void saveTabImage(QString fileName, PlotMatrix* matrix);
00054
00055 private slots:
00056
00057 void on_renameCurrentTab();
00058
00059 void on_savePlotsToFile();
00060
00061 void on_pushAddColumn_pressed();
00062
00063 void on_pushVerticalResize_pressed();
00064
00065 void on_pushHorizontalResize_pressed();
00066
00067 void on_pushAddRow_pressed();
00068
00069 void on_addTabButton_pressed();
00070
00071 void on_pushRemoveEmpty_pressed();
00072
00073 void on_tabWidget_currentChanged(int index);
00074
00075 void on_tabWidget_tabCloseRequested(int index);
00076
00077 void on_buttonLinkHorizontalScale_toggled(bool checked);
00078
00079 void on_requestTabMovement(const QString &destination_name);
00080
00081 void on_moveTabIntoNewWindow();
00082
00083 void on_pushButtonShowLabel_pressed();
00084
00085 void onLabelStatusChanged();
00086
00087 void on_pushButtonZoomMax_pressed();
00088
00089 void onMoveWidgetIntoNewTab(QString plot_name);
00090
00091 private:
00092
00093 enum LabelStatus{ LEFT, RIGHT, HIDDEN };
00094
00095 Ui::TabbedPlotWidget *ui;
00096
00097 QAction* _action_renameTab;
00098 QAction* _action_savePlots;
00099
00100 QMenu* _tab_menu;
00101
00102 const QString _name;
00103
00104 PlotDataMapRef& _mapped_data;
00105
00106 bool _horizontal_link;
00107
00108 QString _parent_type;
00109
00110 LabelStatus _labels_status;
00111
00112 virtual void closeEvent(QCloseEvent *event) override;
00113
00114 protected:
00115
00116 virtual bool eventFilter(QObject *obj, QEvent *event) override;
00117
00118 static std::map<QString,TabbedPlotWidget*> _instances;
00119
00120 signals:
00121 void created();
00122 void undoableChangeHappened();
00123 void matrixAdded( PlotMatrix * );
00124 void sendTabToNewWindow(PlotMatrix *);
00125 };
00126
00127 #endif // TABBEDPLOTWIDGET_H