itom
Loading...
Searching...
No Matches
figureWidget.h
1/* ********************************************************************
2 itom software
3 URL: http://www.uni-stuttgart.de/ito
4 Copyright (C) 2020, Institut für Technische Optik (ITO),
5 Universität Stuttgart, Germany
6
7 This file is part of itom.
8
9 itom is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Library General Public Licence as published by
11 the Free Software Foundation; either version 2 of the Licence, or (at
12 your option) any later version.
13
14 itom is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
17 General Public Licence for more details.
18
19 You should have received a copy of the GNU Library General Public License
20 along with itom. If not, see <http://www.gnu.org/licenses/>.
21*********************************************************************** */
22
23#ifndef FIGUREWIDGET_H
24#define FIGUREWIDGET_H
25
26#include "abstractDockWidget.h"
27
28#include "common/sharedStructures.h"
29#include "DataObject/dataobj.h"
30#if ITOM_POINTCLOUDLIBRARY > 0
31#include "../../PointCloud/pclStructures.h"
32#endif
33#include "common/addInInterface.h"
34
35#include <qgridlayout.h>
36#include <qsharedpointer.h>
37#include <qpointer.h>
38#include <qaction.h>
39#include <qmenu.h>
40#include <qevent.h>
41#include <qsize.h>
42#include <qsignalmapper.h>
43
44namespace ito {
45
47{
48 Q_OBJECT
49
50 Q_PROPERTY(QRect geometry READ geometry WRITE setGeometry)
51 Q_PROPERTY(QColor currentBorderColor READ currentBorderColor WRITE setCurrentBorderColor)
52
53
54public:
56 const QString& title,
57 bool docked,
58 bool isDockAvailable,
59 int rows,
60 int cols,
61 QWidget* parent = 0,
62 Qt::WindowFlags flags = Qt::WindowFlags());
64
65 RetVal plot(QSharedPointer<ito::DataObject> dataObj,
66 QSharedPointer<ito::DataObject> xAxisObj,
67 int areaRow, int areaCol,
68 const QString &className,
69 QWidget **canvasWidget);
70#if ITOM_POINTCLOUDLIBRARY > 0
71 RetVal plot(QSharedPointer<ito::PCLPointCloud> dataObj, int areaRow, int areaCol, const QString &className, QWidget **canvasWidget);
72 RetVal plot(QSharedPointer<ito::PCLPolygonMesh> dataObj, int areaRow, int areaCol, const QString &className, QWidget **canvasWidget);
73#endif
74 RetVal liveImage(QPointer<AddInDataIO> cam, int areaRow, int areaCol, const QString &className, QWidget **canvasWidget);
75
76 RetVal loadDesignerWidget(int areaRow, int areaCol, const QString &className, QWidget **canvasWidget);
77
78 QWidget *getSubplot(int index) const;
79
80 RetVal changeCurrentSubplot(int newIndex);
81
82 virtual QSize defaultSize() const;
83
84 //---------------------------------
85 // setter / getter
86 //---------------------------------
87 void setFigHandle(QSharedPointer<unsigned int> figHandle) { m_guardedFigHandle = figHandle; }
88
89
90 inline int rows() const { return m_rows; };
91 inline int cols() const { return m_cols; };
92
93 QColor currentBorderColor() const { return m_currentBorderColor; }
94 void setCurrentBorderColor(QColor color);
95
96protected:
97
98 QWidget* prepareWidget(const QString &plotClassName, int areaRow, int areaCol, RetVal &retval);
99 void setMenusVisible(const QWidget *widget, bool visible);
100
101 void createActions();
102 void createMenus();
103 void createToolBars();
104 void createStatusBar();
105 void updateActions();
106 void updatePythonActions(){ updateActions(); }
107
108 void closeEvent(QCloseEvent *event); // { event->accept(); };
109
110 //bool eventFilter(QObject *obj, QEvent *event);
111
112 QSharedPointer<ito::Param> getParamByInvoke(ito::AddInBase* addIn, const QString &paramName, ito::RetVal &retval);
113
114private:
115 QGridLayout *m_pGrid;
116 QWidget *m_pCenterWidget;
117
118 QMenu *m_menuWindow;
119 QMenu *m_menuSubplot;
120 QAction *m_firstSysAction;
121
122 QActionGroup *m_pSubplotActions;
123
124 int m_rows;
125 int m_cols;
126 int m_curIdx;
127
128 QColor m_currentBorderColor;
129
130 QSharedPointer<unsigned int> m_guardedFigHandle; //this figure holds its own reference, this is deleted if this figure is closed by a close-event or if the close-method is called.
131
132 QMap< QObject*, QList<QAction*> > m_menuStack;
133
134 QVector<QWidget*> m_widgets;
135
136signals:
137
138private slots:
139 void mnu_subplotActionsTriggered(QAction *action);
140};
141
142} //end namespace ito
143
144#endif
abstract dock widget class which inherits QDockWidget. The content of QDockWidget consists of an inst...
Definition abstractDockWidget.h:55
Base class for all plugins.
Definition addInInterface.h:386
Definition figureWidget.h:47
void closeEvent(QCloseEvent *event)
closeEvent invoked if this AbstractDockWidget should be closed
Definition figureWidget.cpp:121
~FigureWidget()
destructor
Definition figureWidget.cpp:102
virtual QSize defaultSize() const
Definition figureWidget.cpp:108
Class for managing status values (like errors or warning)
Definition retVal.h:54
Definition apiFunctionsGraph.cpp:40