Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
qSlicerModulesMenu.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 Julien Finet, Kitware Inc.
17 and was partially funded by NIH grant 3P41RR013218-12S1
18
19==============================================================================*/
20
21#ifndef __qSlicerModulesMenu_h
22#define __qSlicerModulesMenu_h
23
24// Qt includes
25#include <QMenu>
26
27// CTK includes
28#include "qSlicerBaseQTGUIExport.h"
29
31class qSlicerModulesMenuPrivate;
33
37class Q_SLICER_BASE_QTGUI_EXPORT qSlicerModulesMenu: public QMenu
38{
39 Q_OBJECT
49
57
59public:
60 typedef QMenu Superclass;
61
65 qSlicerModulesMenu(const QString& title, QWidget* parent = nullptr);
66 qSlicerModulesMenu(QWidget* parent = nullptr);
67 ~qSlicerModulesMenu() override;
68
70 Q_INVOKABLE QAction* moduleAction(const QString& moduleName)const;
71
73 inline void addModules(const QStringList& moduleNames);
74
76 inline void removeModules(const QStringList& moduleNames);
77
79 QString currentModule()const;
80
84
85 void setDuplicateActions(bool duplicate);
86 bool duplicateActions()const;
87
90 void setShowHiddenModules(bool show);
91 bool showHiddenModules()const;
92
93 void setTopLevelCategoryOrder(const QStringList& categories);
94 QStringList topLevelCategoryOrder()const;
95
101 Q_INVOKABLE bool removeCategory(const QString& categoryName);
102
103public slots:
113 void addModule(const QString& moduleName);
114
123 bool removeModule(const QString& moduleName);
124
127 void setCurrentModuleByTitle(const QString& title);
128
131 void setCurrentModule(const QString& moduleName);
132
135
144
145signals:
148 void currentModuleChanged(const QString& name);
149
150protected slots:
152 void actionSelected(QAction* action);
153
154protected:
155 QScopedPointer<qSlicerModulesMenuPrivate> d_ptr;
156
157private:
158 Q_DECLARE_PRIVATE(qSlicerModulesMenu);
159 Q_DISABLE_COPY(qSlicerModulesMenu);
160};
161
162//---------------------------------------------------------------------------
163void qSlicerModulesMenu::addModules(const QStringList& moduleNames)
164{
165 foreach(const QString& moduleName, moduleNames)
166 {
167 this->addModule(moduleName);
168 }
169}
170
171//---------------------------------------------------------------------------
172void qSlicerModulesMenu::removeModules(const QStringList& moduleNames)
173{
174 foreach(const QString& moduleName, moduleNames)
175 {
176 this->removeModule(moduleName);
177 }
178}
179
180#endif
qSlicerAbstractCoreModule is the base class of any module in Slicer.
void currentModuleChanged(const QString &name)
QStringList topLevelCategoryOrder
void removeModules(const QStringList &moduleNames)
Add a list of module available for selection.
void setShowHiddenModules(bool show)
void setTopLevelCategoryOrder(const QStringList &categories)
qSlicerModulesMenu(const QString &title, QWidget *parent=nullptr)
void setModuleManager(qSlicerModuleManager *moduleManager)
Set the module manager to retrieve the modules from.
void addModule(const QString &moduleName)
QScopedPointer< qSlicerModulesMenuPrivate > d_ptr
void setDuplicateActions(bool duplicate)
void setCurrentModuleByTitle(const QString &title)
void setCurrentModule(const QString &moduleName)
Q_INVOKABLE bool removeCategory(const QString &categoryName)
void actionSelected(QAction *action)
qSlicerModuleManager * moduleManager() const
bool removeModule(const QString &moduleName)
void addModules(const QStringList &moduleNames)
Add a list of module available for selection.
Q_INVOKABLE QAction * moduleAction(const QString &moduleName) const