Slicer  4.11
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
List of all members | Public Types | Properties | Public Slots | Signals | Public Member Functions | Protected Slots | Protected Attributes
qSlicerModulesMenu Class Reference

#include <Base/QTGUI/qSlicerModulesMenu.h>

Inheritance diagram for qSlicerModulesMenu:
Inheritance graph
[legend]
Collaboration diagram for qSlicerModulesMenu:
Collaboration graph
[legend]

Public Types

typedef QMenu Superclass
 

Properties

bool allModulesCategoryVisible
 
QString currentModule
 
bool duplicateActions
 
bool showHiddenModules
 
QStringList topLevelCategoryOrder
 

Public Slots

void addModule (const QString &moduleName)
 
void addModule (qSlicerAbstractCoreModule *)
 Add a module into the menu. More...
 
bool removeModule (const QString &moduleName, bool removeFromAllModules=true)
 
bool removeModule (qSlicerAbstractCoreModule *, bool removeFromAllModules=true)
 
void setCurrentModule (const QString &moduleName)
 
void setCurrentModuleByTitle (const QString &title)
 

Signals

void currentModuleChanged (const QString &name)
 

Public Member Functions

void addModules (const QStringList &moduleNames)
 Add a list of module available for selection. More...
 
Q_INVOKABLE QMenu * allModulesCategory () const
 Return menu associated with the special "All Modules" category. More...
 
QString currentModule () const
 Return the last selected module name. More...
 
bool duplicateActions () const
 
bool isAllModulesCategoryVisible () const
 
Q_INVOKABLE QAction * moduleAction (const QString &moduleName) const
 
qSlicerModuleManagermoduleManager () const
 
 qSlicerModulesMenu (const QString &title, QWidget *parent=nullptr)
 
 qSlicerModulesMenu (QWidget *parent=nullptr)
 
Q_INVOKABLE bool removeCategory (const QString &categoryName)
 
void removeModules (const QStringList &moduleNames)
 Add a list of module available for selection. More...
 
void setAllModulesCategoryVisible (bool visible)
 
void setDuplicateActions (bool duplicate)
 
void setModuleManager (qSlicerModuleManager *moduleManager)
 Set the module manager to retrieve the modules from. More...
 
void setShowHiddenModules (bool show)
 
void setTopLevelCategoryOrder (const QStringList &categories)
 
bool showHiddenModules () const
 
QStringList topLevelCategoryOrder () const
 
 ~qSlicerModulesMenu () override
 

Protected Slots

void actionSelected (QAction *action)
 
void onActionTriggered ()
 

Protected Attributes

QScopedPointer< qSlicerModulesMenuPrivate > d_ptr
 

Detailed Description

qSlicerModulesMenu supports a tree hierarchy of modules (based on module->category() )

Definition at line 37 of file qSlicerModulesMenu.h.

Member Typedef Documentation

◆ Superclass

Definition at line 64 of file qSlicerModulesMenu.h.

Property Documentation

◆ allModulesCategoryVisible

bool qSlicerModulesMenu::allModulesCategoryVisible
readwrite

By default (isAllModulesCategoryVisible = true), setting this property controls the visibility of the "All Modules" category.

Definition at line 60 of file qSlicerModulesMenu.h.

◆ currentModule

QString qSlicerModulesMenu::currentModule
readwrite

Definition at line 40 of file qSlicerModulesMenu.h.

◆ duplicateActions

bool qSlicerModulesMenu::duplicateActions
readwrite

By default (duplicateActions = false), multiple instances of qSlicerModulesMenu share the same QActions. When a module QAction is fired from a menu, all the qSlicerModulesMenu would make it the current module. When duplicateActions is true, the QActions populating the menu are duplicates from the original module QAction. That way the qSlicerModulesMenu behaves independently from the other qSlicerModulesMenus. Note: this property should be set before modules are added (addModule()).

Definition at line 48 of file qSlicerModulesMenu.h.

◆ showHiddenModules

bool qSlicerModulesMenu::showHiddenModules
readwrite

By default (showHiddenModules == false), modules with the hidden property set to true are not shown. If showHiddenModules is true, all the modules are visible. Note: this property should be set before modules are added (addModule), changing its value won't change the visibility of the current volumes but only the future added modules

Definition at line 56 of file qSlicerModulesMenu.h.

◆ topLevelCategoryOrder

QStringList qSlicerModulesMenu::topLevelCategoryOrder
readwrite

Definition at line 62 of file qSlicerModulesMenu.h.

Constructor & Destructor Documentation

◆ qSlicerModulesMenu() [1/2]

qSlicerModulesMenu::qSlicerModulesMenu ( const QString &  title,
QWidget *  parent = nullptr 
)

Constructor title is the name of the menu (can appear using right click on the toolbar area)

◆ qSlicerModulesMenu() [2/2]

qSlicerModulesMenu::qSlicerModulesMenu ( QWidget *  parent = nullptr)

◆ ~qSlicerModulesMenu()

qSlicerModulesMenu::~qSlicerModulesMenu ( )
override

Member Function Documentation

◆ actionSelected

void qSlicerModulesMenu::actionSelected ( QAction *  action)
protectedslot

◆ addModule [1/2]

void qSlicerModulesMenu::addModule ( const QString &  moduleName)
slot

Add a module by name into the menu.

The category property of the module is used to assign a submenu to the module action. If a module is hidden and showHiddenModules is false (default), the module is ignored and not added into the list

See also
qSlicerAbstractCoreModule::category()
qSlicerAbstractCoreModule::action()
qSlicerAbstractCoreModule::isHidden()

◆ addModule [2/2]

void qSlicerModulesMenu::addModule ( qSlicerAbstractCoreModule )
slot

Add a module into the menu.

◆ addModules()

void qSlicerModulesMenu::addModules ( const QStringList &  moduleNames)
inline

Add a list of module available for selection.

Definition at line 177 of file qSlicerModulesMenu.h.

◆ allModulesCategory()

Q_INVOKABLE QMenu* qSlicerModulesMenu::allModulesCategory ( ) const

Return menu associated with the special "All Modules" category.

◆ currentModule()

QString qSlicerModulesMenu::currentModule ( ) const

Return the last selected module name.

◆ currentModuleChanged

void qSlicerModulesMenu::currentModuleChanged ( const QString &  name)
signal

The signal is fired every time a module is selected. The QAction of the module is triggered.

◆ duplicateActions()

bool qSlicerModulesMenu::duplicateActions ( ) const

◆ isAllModulesCategoryVisible()

bool qSlicerModulesMenu::isAllModulesCategoryVisible ( ) const

◆ moduleAction()

Q_INVOKABLE QAction* qSlicerModulesMenu::moduleAction ( const QString &  moduleName) const

◆ moduleManager()

qSlicerModuleManager* qSlicerModulesMenu::moduleManager ( ) const

◆ onActionTriggered

void qSlicerModulesMenu::onActionTriggered ( )
protectedslot

◆ removeCategory()

Q_INVOKABLE bool qSlicerModulesMenu::removeCategory ( const QString &  categoryName)

Remove a top-level category or sub-category. Return true if it was found and removed.

Sub-category can be specified using a "dot" separator (i.e. "CategoryName.SubCategoryName")

Note
The special catergory "All Modules" can not be removed with this function. Instead consider setting allModulesCategoryVisible property.
See also
removeModule(), setAllModulesCategoryVisible()

◆ removeModule [1/2]

bool qSlicerModulesMenu::removeModule ( const QString &  moduleName,
bool  removeFromAllModules = true 
)
slot

Remove the module from the menu.

Return true if the module was found and removed.

By default, matching module entries are removed from the top-level category, the custom and pre-defined categories as well as the "All Modules" special category. Setting removeFromAllModules to false allows to change this.

removeFromAllModules to false allows to change this.

◆ removeModule [2/2]

bool qSlicerModulesMenu::removeModule ( qSlicerAbstractCoreModule ,
bool  removeFromAllModules = true 
)
slot

Remove the module from the menu.

By default, matching module entries are removed from the top-level category, the custom and pre-defined categories as well as the "All Modules" special category. Setting removeFromAllModules to false allows to change this.

Return true if the module was found and removed.

◆ removeModules()

void qSlicerModulesMenu::removeModules ( const QStringList &  moduleNames)
inline

Add a list of module available for selection.

Definition at line 186 of file qSlicerModulesMenu.h.

◆ setAllModulesCategoryVisible()

void qSlicerModulesMenu::setAllModulesCategoryVisible ( bool  visible)

◆ setCurrentModule

void qSlicerModulesMenu::setCurrentModule ( const QString &  moduleName)
slot

Select a module by name. It looks for the module action and triggers it.

See also
setCurrentModuleByTitle()

◆ setCurrentModuleByTitle

void qSlicerModulesMenu::setCurrentModuleByTitle ( const QString &  title)
slot

Select a module by title. It looks for the module action and triggers it.

See also
setCurrentModule()

◆ setDuplicateActions()

void qSlicerModulesMenu::setDuplicateActions ( bool  duplicate)

◆ setModuleManager()

void qSlicerModulesMenu::setModuleManager ( qSlicerModuleManager moduleManager)

Set the module manager to retrieve the modules from.

◆ setShowHiddenModules()

void qSlicerModulesMenu::setShowHiddenModules ( bool  show)

If true, modules with the hidden property set to true are still visible in the module.

◆ setTopLevelCategoryOrder()

void qSlicerModulesMenu::setTopLevelCategoryOrder ( const QStringList &  categories)

◆ showHiddenModules()

bool qSlicerModulesMenu::showHiddenModules ( ) const

◆ topLevelCategoryOrder()

QStringList qSlicerModulesMenu::topLevelCategoryOrder ( ) const

Member Data Documentation

◆ d_ptr

QScopedPointer<qSlicerModulesMenuPrivate> qSlicerModulesMenu::d_ptr
protected

Definition at line 169 of file qSlicerModulesMenu.h.


The documentation for this class was generated from the following file: