CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Public Member Functions | Protected Types | Protected Slots | Protected Attributes | Properties | Friends | List of all members
ctkActionsWidget Class Reference

#include <Libs/Widgets/ctkActionsWidget.h>

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

Public Member Functions

void addAction (QAction *action, const QString &group=QString())
 
void addActions (QList< QAction * > actions, const QString &group=QString())
 Convenient function to add a list of action at once. More...
 
bool areActionsWithNoShortcutVisible () const
 
bool areMenuActionsVisible () const
 
void clear ()
 Remove all the actions and groups. More...
 
 ctkActionsWidget (QWidget *parent=0)
 
QStandardItem * groupItem (const QString &category)
 Return a pointer on a group item (you probably have no use for it) More...
 
QStandardItemModel * model () const
 Return the unsorted/unfiltered model of all the actions. More...
 
void setActionsWithNoShortcutVisible (bool show)
 
void setMenuActionsVisible (bool show)
 
void setSortColumn (int column)
 
int sortColumn () const
 
QTreeView * view () const
 return the view used to display the action model More...
 
virtual ~ctkActionsWidget ()
 

Protected Types

enum  ActionColumn { NameColumn = 0 , ShortcutColumn , ContextColumn , DetailsColumn }
 

Protected Slots

void updateAction ()
 

Protected Attributes

QScopedPointer< ctkActionsWidgetPrivate > d_ptr
 

Properties

bool actionsWithNoShortcutVisible
 
bool menuActionsVisible
 
int sortColumn
 

Friends

class ctkSortFilterActionsProxyModel
 

Detailed Description

ctkActionsWidget presents a list of QAction to the user. The QAction's are displayed in a multi column tree view. The columns contain the QAction's text, shortcut, context and tooltip in that order. The typical use is to show what shortcuts are associated to what commands in an application. ctkActionsWidget internally uses a QStandardItemModel where each item data (QStandardItem::data) contain a pointer to the QAction. QActions can optionally be ordered by group TODO: Add "hide empty group" property to hide empty groups

Definition at line 50 of file ctkActionsWidget.h.

Member Enumeration Documentation

◆ ActionColumn

Enumerator
NameColumn 
ShortcutColumn 
ContextColumn 
DetailsColumn 

Definition at line 105 of file ctkActionsWidget.h.

Constructor & Destructor Documentation

◆ ctkActionsWidget()

ctkActionsWidget::ctkActionsWidget ( QWidget *  parent = 0)
explicit

◆ ~ctkActionsWidget()

virtual ctkActionsWidget::~ctkActionsWidget ( )
virtual

Member Function Documentation

◆ addAction()

void ctkActionsWidget::addAction ( QAction *  action,
const QString &  group = QString() 
)

Add an action into a specified group (or at top level if group is empty) An action can be added multiple times (in a different group). Once added, ctkActionsWidget listens to the QAction and updates the action properties TODO: check that the action hasn't been already added into a group

◆ addActions()

void ctkActionsWidget::addActions ( QList< QAction * >  actions,
const QString &  group = QString() 
)

Convenient function to add a list of action at once.

◆ areActionsWithNoShortcutVisible()

bool ctkActionsWidget::areActionsWithNoShortcutVisible ( ) const

◆ areMenuActionsVisible()

bool ctkActionsWidget::areMenuActionsVisible ( ) const

◆ clear()

void ctkActionsWidget::clear ( )

Remove all the actions and groups.

◆ groupItem()

QStandardItem* ctkActionsWidget::groupItem ( const QString &  category)

Return a pointer on a group item (you probably have no use for it)

◆ model()

QStandardItemModel* ctkActionsWidget::model ( ) const

Return the unsorted/unfiltered model of all the actions.

◆ setActionsWithNoShortcutVisible()

void ctkActionsWidget::setActionsWithNoShortcutVisible ( bool  show)

If true, shows QActions that have an empty shortcut, otherwise hide them. True by default

◆ setMenuActionsVisible()

void ctkActionsWidget::setMenuActionsVisible ( bool  show)

If true, shows QMenus, otherwise hide them. True by default

◆ setSortColumn()

void ctkActionsWidget::setSortColumn ( int  column)

Set the sortColumn property value.

See also
sortColumn

◆ sortColumn()

int ctkActionsWidget::sortColumn ( ) const

Return the sortColumn property value.

See also
sortColumn

◆ updateAction

void ctkActionsWidget::updateAction ( )
protectedslot

◆ view()

QTreeView* ctkActionsWidget::view ( ) const

return the view used to display the action model

Friends And Related Function Documentation

◆ ctkSortFilterActionsProxyModel

friend class ctkSortFilterActionsProxyModel
friend

Definition at line 117 of file ctkActionsWidget.h.

Member Data Documentation

◆ d_ptr

QScopedPointer<ctkActionsWidgetPrivate> ctkActionsWidget::d_ptr
protected

Definition at line 112 of file ctkActionsWidget.h.

Property Documentation

◆ actionsWithNoShortcutVisible

bool ctkActionsWidget::actionsWithNoShortcutVisible
readwrite

Definition at line 1 of file ctkActionsWidget.h.

◆ menuActionsVisible

bool ctkActionsWidget::menuActionsVisible
readwrite

Definition at line 1 of file ctkActionsWidget.h.

◆ sortColumn

int ctkActionsWidget::sortColumn
readwrite

This property controls whether the actions are sorted by column (>=0) or not (-1). Not sorted by default.

See also
sortColumn(), setSortColumn()

Definition at line 1 of file ctkActionsWidget.h.


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