Slicer  5.0
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qMRMLMarkupsOptionsWidgetsFactory.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Copyright (c) The Intervention Centre
4  Oslo University Hospital, Oslo, Norway. All Rights Reserved.
5 
6  See COPYRIGHT.txt
7  or http://www.slicer.org/copyright/copyright.txt for details.
8 
9  Unless required by applicable law or agreed to in writing, software
10  distributed under the License is distributed on an "AS IS" BASIS,
11  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  See the License for the specific language governing permissions and
13  limitations under the License.
14 
15  This file was originally developed by Rafael Palomar (The Intervention Centre,
16  Oslo University Hospital), based on qMRMLMarkupsOptionsWidgetsFactory.h by
17  Csaba Pinter (Perklab, Queen's University), and was supported by The Research
18  Council of Norway through the ALive project (grant nr. 311393).
19 
20  ==============================================================================*/
21 
22 #ifndef __qslicermarkupsfactory_h_
23 #define __qslicermarkupsfactory_h_
24 
25 // Markups widgets includes
27 #include "qSlicerMarkupsModuleWidgetsExport.h"
28 
29 // Qt includes
30 #include <QObject>
31 #include <QMap>
32 #include <QPointer>
33 #include <QWidget>
34 
35 // -----------------------------------------------------------------------------------------
37 class qMRMLMarkupsOptionsWidgetsFactoryCleanup;
38 
42 class Q_SLICER_MODULE_MARKUPS_WIDGETS_EXPORT qMRMLMarkupsOptionsWidgetsFactory : public QObject
43 {
44  Q_OBJECT
45 
46 public:
49  Q_INVOKABLE static qMRMLMarkupsOptionsWidgetsFactory* instance();
50 
51 public:
56  Q_INVOKABLE bool registerOptionsWidget(qMRMLMarkupsAbstractOptionsWidget* widget);
57 
59  Q_INVOKABLE bool unregisterOptionsWidget(const QString& className);
60 
62  Q_INVOKABLE bool unregisterOptionsWidget(qMRMLMarkupsAbstractOptionsWidget* widget);
63 
65  Q_INVOKABLE void unregisterAll();
66 
69  { return this->RegisteredWidgets.keys(); }
70 
73  Q_INVOKABLE qMRMLMarkupsAbstractOptionsWidget* createWidget(const QString& widgetClassName);
74 
75 signals:
76  void optionsWidgetRegistered();
77  void optionsWidgetUnregistered();
78 
79 protected:
81 
82 private:
84  static void cleanup();
85 
86 private:
87  qMRMLMarkupsOptionsWidgetsFactory(QObject* parent=nullptr);
89 
90  Q_DISABLE_COPY(qMRMLMarkupsOptionsWidgetsFactory);
91  friend class qMRMLMarkupsOptionsWidgetsFactoryCleanup;
92  friend class PythonQtWrapper_qMRMLMarkupsOptionsWidgetsFactory; // Allow Python wrapping without enabling direct instantiation
93 
94 private:
96  static qMRMLMarkupsOptionsWidgetsFactory* Instance;
97 };
98 
99 #endif // __qslicermarkupsfactory_h_
QMap< QString, QPointer< qMRMLMarkupsAbstractOptionsWidget > > RegisteredWidgets
Q_INVOKABLE const QList< QString > registeredOptionsWidgetsClassNames() const
Returns the list of additional options widgets registered.
Singleton class managing segment editor effect plugins.