Isis Developer Reference
Tool.h
Go to the documentation of this file.
1#ifndef Tool_h
2#define Tool_h
3
10/* SPDX-License-Identifier: CC0-1.0 */
11
12
13#include <QObject>
14
15#include <QDebug>
16#include <QPoint>
17
18class QAction;
19class QMenu;
20class QPainter;
21//class QPoint;
22class QStackedWidget;
23class QToolBar;
24
25template< class T > class QVector;
26
27
28namespace Isis {
29 class CubeViewport;
30 class MdiCubeViewport;
31 class RubberBandTool;
32 class ToolList;
33 class ToolPad;
34 class ViewportMainWindow;
35 class Workspace;
36
67 class Tool : public QObject {
68 Q_OBJECT
69
70 public:
71 Tool(QWidget *parent);
72
73 void addTo(ViewportMainWindow *mw);
74
75 void addTo(ToolPad *toolpad);
76
83 virtual QString menuName() const {
84 return "";
85 }
86
87
91 virtual void addTo(QMenu *menu) {};
92
93
97 virtual void addToPermanent(QToolBar *toolbar) {};
98
99 void addToActive(QToolBar *toolbar);
100
104 virtual void addTo(Workspace *ws);
105
106
113 QString toolIconDir() const {
114 return m_toolIconDir;
115 };
116
117
122 virtual void paintViewport(MdiCubeViewport *vp, QPainter *painter) {}
123
125 void setList(ToolList *currentList);
126
127 public slots:
128 void activate(bool);
129 virtual void updateTool();
131
132
133 signals:
136
137 protected slots:
138
141 virtual void rubberBandComplete() { }
142
143
148 virtual void screenPixelsChanged() {}
149
152 virtual void mouseEnter() {}
153
154 virtual void mouseMove(QPoint p);
155 virtual void mouseMove(QPoint p, Qt::MouseButton) {}
156
159 virtual void mouseLeave() {};
160
161 virtual void mouseDoubleClick(QPoint p);
162 virtual void mouseButtonPress(QPoint p, Qt::MouseButton s);
163 virtual void mouseButtonRelease(QPoint p, Qt::MouseButton s);
164
167 virtual void updateMeasure() {}
168
169
172 virtual void scaleChanged() {}
173
174
177 virtual void stretchRequested(MdiCubeViewport *, int) {}
178
179
183 void registerTool(MdiCubeViewport *viewport);
184
185
186 signals:
190
191 protected:
198 return m_cvp;
199 }
200
201
205 typedef QVector< MdiCubeViewport * > CubeViewportList;
206
208
209
217 virtual QAction *toolPadAction(ToolPad *toolpad) {
218 return NULL;
219 }
220
221
229 virtual QWidget *createToolBarWidget(QStackedWidget *parent) {
230 return NULL;
231 }
232
233
239 virtual void addConnections(MdiCubeViewport *cvp) {}
240
241
247 virtual void removeConnections(MdiCubeViewport *cvp) {}
248
249
251 virtual void enableRubberBandTool();
252
254
255 private:
256 void addViewportConnections();
257 void removeViewportConnections();
258 void enableToolBar();
259 void disableToolBar();
260
261 MdiCubeViewport *m_cvp;
262 Workspace *m_workspace;
263
264 bool m_active;
265 QWidget *m_toolBarWidget;
266 QAction *m_toolPadAction;
267 QString m_toolIconDir;
268 ToolList *m_toolList;
269 };
270}
271
272#endif
Cube display widget for certain Isis MDI applications.
Definition MdiCubeViewport.h:39
Rubber banding tool.
Definition RubberBandTool.h:50
Base class for the Qisis tools.
Definition Tool.h:67
virtual void removeConnections(MdiCubeViewport *cvp)
Anytime a tool is created, you must be able to remove it's connections.
Definition Tool.h:247
Tool(QWidget *parent)
Tool constructor.
Definition Tool.cpp:27
virtual QAction * toolPadAction(ToolPad *toolpad)
Anytime a tool is created, you must setup a tool pad action with it.
Definition Tool.h:217
virtual void rubberBandComplete()
Definition Tool.h:141
void addTo(ViewportMainWindow *mw)
Adds the tool to the application.
Definition Tool.cpp:78
virtual void mouseMove(QPoint p, Qt::MouseButton)
Definition Tool.h:155
virtual void enableRubberBandTool()
Anytime a tool is created, you may use the rubber band tool.
Definition Tool.cpp:339
virtual void addTo(QMenu *menu)
Definition Tool.h:91
virtual void screenPixelsChanged()
This is called when actions change which pixels from the cube are displayed.
Definition Tool.h:148
void toolActivated()
void setList(ToolList *currentList)
Definition Tool.cpp:68
virtual QString menuName() const
Anytime a tool is created, you must give it a name for the menu.
Definition Tool.h:83
QVector< MdiCubeViewport * > CubeViewportList
A list of cubeviewports.
Definition Tool.h:205
virtual void updateTool()
Updates the tool.
Definition Tool.cpp:318
virtual void mouseDoubleClick(QPoint p)
Definition Tool.cpp:358
RubberBandTool * rubberBandTool()
Definition Tool.cpp:57
virtual QWidget * createToolBarWidget(QStackedWidget *parent)
Anytime a tool is created, you must add it to the tool bar.
Definition Tool.h:229
virtual void mouseButtonRelease(QPoint p, Qt::MouseButton s)
Resets the Warning to Nowarning when a different activity occurs on the application.
Definition Tool.cpp:380
virtual void stretchRequested(MdiCubeViewport *, int)
Definition Tool.h:177
void activate(bool)
Activates the tool.
Definition Tool.cpp:131
CubeViewportList * cubeViewportList() const
Return the list of cubeviewports.
Definition Tool.cpp:390
virtual void mouseMove(QPoint p)
Definition Tool.cpp:352
void setCubeViewport(MdiCubeViewport *cvp)
Sets the current viewport to the given cvp.
Definition Tool.cpp:160
virtual void addConnections(MdiCubeViewport *cvp)
Anytime a tool is created, you must add the connections for it.
Definition Tool.h:239
virtual void paintViewport(MdiCubeViewport *vp, QPainter *painter)
Definition Tool.h:122
virtual void updateMeasure()
Definition Tool.h:167
virtual void addToPermanent(QToolBar *toolbar)
Definition Tool.h:97
void clearWarningSignal()
void addToActive(QToolBar *toolbar)
Definition Tool.cpp:112
void registerTool(MdiCubeViewport *viewport)
Registers the tool to the viewport.
Definition Tool.cpp:327
virtual void scaleChanged()
Definition Tool.h:172
MdiCubeViewport * cubeViewport() const
Return the current cubeviewport.
Definition Tool.h:197
virtual void mouseEnter()
Definition Tool.h:152
Workspace * workspace()
Definition Tool.cpp:344
virtual void mouseButtonPress(QPoint p, Qt::MouseButton s)
Definition Tool.cpp:367
virtual void mouseLeave()
Definition Tool.h:159
void viewportChanged()
QString toolIconDir() const
returns the path to the icon directory.
Definition Tool.h:113
Allows tools to share data between each other.
Definition ToolList.h:32
Definition ToolPad.h:14
This was called the Qisis MainWindow.
Definition ViewportMainWindow.h:43
Definition Workspace.h:78
This is free and unencumbered software released into the public domain.
Definition Calculator.h:18
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16