Slicer  4.11
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qSlicerMainWindow.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Copyright (c) Kitware Inc.
6 
7  See COPYRIGHT.txt
8  or http://www.slicer.org/copyright/copyright.txt for details.
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 
16  This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc.
17  and was partially funded by NIH grant 3P41RR013218-12S1
18 
19 ==============================================================================*/
20 
21 #ifndef __qSlicerMainWindow_h
22 #define __qSlicerMainWindow_h
23 
24 // Qt includes
25 #include <QMainWindow>
26 #include <QVariantMap>
27 
28 // CTK includes
29 #include <ctkErrorLogModel.h>
30 class ctkErrorLogWidget;
31 class ctkPythonConsole;
32 
33 // Slicer includes
34 #include "qSlicerBaseQTAppExport.h"
35 #include "qSlicerIO.h"
36 #include "vtkSlicerConfigure.h" // For Slicer_BUILD_DICOM_SUPPORT, Slicer_USE_PYTHONQT, Slicer_USE_QtTesting
37 
39 class qSlicerMainWindowPrivate;
40 
41 // VTK includes
42 class vtkObject;
43 
44 class Q_SLICER_BASE_QTAPP_EXPORT qSlicerMainWindow : public QMainWindow
45 {
46  Q_OBJECT
47 public:
48  typedef QMainWindow Superclass;
49 
50  qSlicerMainWindow(QWidget *parent=nullptr);
51  ~qSlicerMainWindow() override;
52 
56  Q_INVOKABLE qSlicerModuleSelectorToolBar* moduleSelector()const;
57 
58 #ifdef Slicer_USE_PYTHONQT
59  Q_INVOKABLE ctkPythonConsole* pythonConsole()const;
62 #endif
63  Q_INVOKABLE ctkErrorLogWidget* errorLogWidget()const;
66 
67 public slots:
68  virtual void setHomeModuleCurrent();
69  virtual void restoreToolbars();
70 
71  virtual void on_FileAddDataAction_triggered();
72  virtual void on_FileLoadDataAction_triggered();
73  virtual void on_FileImportSceneAction_triggered();
74  virtual void on_FileLoadSceneAction_triggered();
75  virtual void on_FileAddVolumeAction_triggered();
76  virtual void on_FileAddTransformAction_triggered();
77  virtual void on_FileSaveSceneAction_triggered();
78  virtual void on_FileExitAction_triggered();
79  virtual void onFileRecentLoadedActionTriggered();
80  virtual void on_SDBSaveToDirectoryAction_triggered();
81  virtual void on_SDBSaveToMRBAction_triggered();
82  virtual void on_FileCloseSceneAction_triggered();
83  virtual void on_LoadDICOMAction_triggered();
84 
85  virtual void on_EditRecordMacroAction_triggered();
86  virtual void on_EditPlayMacroAction_triggered();
87  virtual void on_EditUndoAction_triggered();
88  virtual void on_EditRedoAction_triggered();
89 
90  virtual void on_ModuleHomeAction_triggered();
91 
92  virtual void onLayoutActionTriggered(QAction* action);
93  virtual void onLayoutCompareActionTriggered(QAction* action);
94  virtual void onLayoutCompareWidescreenActionTriggered(QAction* action);
95  virtual void onLayoutCompareGridActionTriggered(QAction* action);
96 
97  virtual void setLayout(int);
98  virtual void setLayoutNumberOfCompareViewRows(int);
99  virtual void setLayoutNumberOfCompareViewColumns(int);
100 
101  virtual void onPythonConsoleToggled(bool);
102 
103  virtual void on_WindowErrorLogAction_triggered();
104  virtual void on_WindowToolbarsResetToDefaultAction_triggered();
105 
106  virtual void on_EditApplicationSettingsAction_triggered();
107  virtual void on_CutAction_triggered();
108  virtual void on_CopyAction_triggered();
109  virtual void on_PasteAction_triggered();
110  virtual void on_ViewExtensionsManagerAction_triggered();
111 
112 signals:
115  void initialWindowShown();
116 
117 protected slots:
118  virtual void onModuleLoaded(const QString& moduleName);
119  virtual void onModuleAboutToBeUnloaded(const QString& moduleName);
120  virtual void onNewFileLoaded(const qSlicerIO::IOProperties &fileProperties);
121 
122  virtual void onMRMLSceneModified(vtkObject*);
123  virtual void onLayoutChanged(int);
124  virtual void onWarningsOrErrorsOccurred(ctkErrorLogLevel::LogLevel logLevel);
125 
126 #ifdef Slicer_USE_PYTHONQT
127  virtual void onPythonConsoleUserInput(const QString&);
128 #endif
129 
130 protected:
132  virtual void setupMenuActions();
133 
135  virtual void pythonConsoleInitialDisplay();
136 
138  virtual void disclaimer();
139 
143  void dragEnterEvent(QDragEnterEvent *event) override;
144 
147  void dropEvent(QDropEvent *event) override;
148 
155  bool eventFilter(QObject* object, QEvent* event) override;
156 
157  void closeEvent(QCloseEvent *event) override;
158  void showEvent(QShowEvent *event) override;
159 
160  void changeEvent(QEvent* event) override;
161 
162 protected:
163  QScopedPointer<qSlicerMainWindowPrivate> d_ptr;
164 
165  qSlicerMainWindow(qSlicerMainWindowPrivate* pimpl, QWidget* parent);
166 
167 private:
168  Q_DECLARE_PRIVATE(qSlicerMainWindow);
169  Q_DISABLE_COPY(qSlicerMainWindow);
170 };
171 
172 #endif
QMainWindow Superclass
QScopedPointer< qSlicerMainWindowPrivate > d_ptr