Slicer  5.3
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 
31 // Slicer includes
32 #include "qSlicerBaseQTAppExport.h"
33 #include "qSlicerIO.h"
34 #include "vtkSlicerConfigure.h" // For Slicer_BUILD_DICOM_SUPPORT, Slicer_USE_PYTHONQT, Slicer_USE_QtTesting
35 
36 class ctkErrorLogWidget;
37 class ctkPythonConsole;
39 class qSlicerMainWindowPrivate;
41 class vtkObject;
42 
43 class Q_SLICER_BASE_QTAPP_EXPORT qSlicerMainWindow : public QMainWindow
44 {
45  Q_OBJECT
46 public:
47  typedef QMainWindow Superclass;
48 
49  qSlicerMainWindow(QWidget *parent=nullptr);
50  ~qSlicerMainWindow() override;
51 
55  Q_INVOKABLE qSlicerModuleSelectorToolBar* moduleSelector()const;
56 
57 #ifdef Slicer_USE_PYTHONQT
58  Q_INVOKABLE ctkPythonConsole* pythonConsole()const;
61 #endif
62  Q_INVOKABLE ctkErrorLogWidget* errorLogWidget()const;
65 
67  Q_INVOKABLE vtkMRMLAbstractViewNode* layoutMaximizedViewNode();
68 
69 public slots:
70  virtual void setHomeModuleCurrent();
71  virtual void restoreToolbars();
72 
73  virtual void on_FileFavoriteModulesAction_triggered();
74  virtual void on_FileAddDataAction_triggered();
75  virtual void on_FileLoadDataAction_triggered();
76  virtual void on_FileImportSceneAction_triggered();
77  virtual void on_FileLoadSceneAction_triggered();
78  virtual void on_FileAddVolumeAction_triggered();
79  virtual void on_FileAddTransformAction_triggered();
80  virtual void on_FileSaveSceneAction_triggered();
81  virtual void on_FileExitAction_triggered();
82  virtual void onFileRecentLoadedActionTriggered();
83  virtual void on_SDBSaveToDirectoryAction_triggered();
84  virtual void on_SDBSaveToMRBAction_triggered();
85  virtual void on_FileCloseSceneAction_triggered();
86  virtual void on_LoadDICOMAction_triggered();
87 
88  virtual void on_EditRecordMacroAction_triggered();
89  virtual void on_EditPlayMacroAction_triggered();
90  virtual void on_EditUndoAction_triggered();
91  virtual void on_EditRedoAction_triggered();
92 
93  virtual void on_ModuleHomeAction_triggered();
94 
95  virtual void onLayoutActionTriggered(QAction* action);
96  virtual void onLayoutCompareActionTriggered(QAction* action);
97  virtual void onLayoutCompareWidescreenActionTriggered(QAction* action);
98  virtual void onLayoutCompareGridActionTriggered(QAction* action);
99 
101  virtual void setLayout(int);
102 
105  virtual void setLayoutMaximizedViewNode(vtkMRMLAbstractViewNode*);
106 
107  virtual void setLayoutNumberOfCompareViewRows(int);
108  virtual void setLayoutNumberOfCompareViewColumns(int);
109 
110  virtual void onPythonConsoleToggled(bool);
111 
112  virtual void on_WindowErrorLogAction_triggered();
113  virtual void on_WindowToolbarsResetToDefaultAction_triggered();
114 
115  virtual void on_EditApplicationSettingsAction_triggered();
116  virtual void on_CutAction_triggered();
117  virtual void on_CopyAction_triggered();
118  virtual void on_PasteAction_triggered();
119  virtual void on_ViewExtensionsManagerAction_triggered();
120 
121  virtual void on_ShowStatusBarAction_triggered(bool);
122 
133  virtual void saveGUIState(bool force=false);
134 
137  virtual void restoreGUIState(bool force=false);
138 
139  virtual void addFileToRecentFiles(const qSlicerIO::IOProperties& fileProperties);
140 
142  virtual void on_FavoriteModulesChanged();
143 
144 signals:
147  void initialWindowShown();
148 
149 protected slots:
150  virtual void onModuleLoaded(const QString& moduleName);
151  virtual void onModuleAboutToBeUnloaded(const QString& moduleName);
152  virtual void onNewFileLoaded(const qSlicerIO::IOProperties &fileProperties);
153  virtual void onFileSaved(const qSlicerIO::IOProperties& fileProperties);
154 
155  virtual void onMRMLSceneModified(vtkObject*);
156  virtual void onLayoutChanged(int);
157  virtual void onWarningsOrErrorsOccurred(ctkErrorLogLevel::LogLevel logLevel);
158 
159  // Show/hide update indicator on Extensions Manager toolbar icon
160  void setExtensionUpdatesAvailable(bool updateAvailable);
161 
162 #ifdef Slicer_USE_PYTHONQT
163  virtual void onPythonConsoleUserInput(const QString&);
164 #endif
165 
166 protected:
168  virtual void setupMenuActions();
169 
171  virtual void pythonConsoleInitialDisplay();
172 
174  virtual void disclaimer();
175 
179  void dragEnterEvent(QDragEnterEvent *event) override;
180 
183  void dropEvent(QDropEvent *event) override;
184 
191  bool eventFilter(QObject* object, QEvent* event) override;
192 
193  void closeEvent(QCloseEvent *event) override;
194  void showEvent(QShowEvent *event) override;
195 
196  void changeEvent(QEvent* event) override;
197 
198 protected:
199  QScopedPointer<qSlicerMainWindowPrivate> d_ptr;
200 
201  qSlicerMainWindow(qSlicerMainWindowPrivate* pimpl, QWidget* parent);
202 
203 private:
204  Q_DECLARE_PRIVATE(qSlicerMainWindow);
205  Q_DISABLE_COPY(qSlicerMainWindow);
206 };
207 
208 #endif
Abstract MRML node to represent a view. The class holds the properties common to any view type (3D...
QMainWindow Superclass
QScopedPointer< qSlicerMainWindowPrivate > d_ptr