Gui::Action Class Reference

The Action class is the link between Qt's QAction class and FreeCAD's command classes (Command). More...

#include <Action.h>

Inheritance diagram for Gui::Action:
Gui::ActionGroup Gui::DockWidgetAction Gui::RedoAction Gui::ToolBarAction Gui::UndoAction Gui::RecentFilesAction Gui::WindowAction Gui::WorkbenchGroup

List of all members.

Public Slots

virtual void onActivated ()
 Activates the command.
virtual void onToggled (bool)
 Sets whether the command is toggled.

Public Member Functions

 Action (Command *pcCmd, QObject *parent=0)
 Constructs an action called name with parent parent.
virtual void addTo (QWidget *w)
 Adds this action to widget w.
bool isChecked () const
void setCheckable (bool)
void setChecked (bool)
virtual void setEnabled (bool)
 Sets whether the action is enabled.
void setIcon (const QIcon &)
void setShortcut (const QString &)
void setStatusTip (const QString &)
void setText (const QString &)
void setToolTip (const QString &)
virtual void setVisible (bool)
void setWhatsThis (const QString &)
QKeySequence shortcut () const
QString statusTip () const
QString text () const
QString toolTip () const
QString whatsThis () const
virtual ~Action ()

Protected Attributes

QAction * _action
Command_pcCmd

Detailed Description

The Action class is the link between Qt's QAction class and FreeCAD's command classes (Command).

So, it is possible to have all actions (from toolbars, menus, ...) implemented in classes instead of many slot methods in the class MainWindow.

Author:
Werner Mayer

Definition at line 42 of file Action.h.


Constructor & Destructor Documentation

Action::Action ( Command pcCmd,
QObject *  parent = 0 
)

Constructs an action called name with parent parent.

It also stores a pointer to the command object.

Definition at line 57 of file Action.cpp.

References _action, _pcCmd, draftlibs::fcgeo::connect(), Gui::Command::getName(), and onActivated().

Action::~Action (  )  [virtual]

Definition at line 64 of file Action.cpp.

References _action.


Member Function Documentation

void Action::addTo ( QWidget *  w  )  [virtual]

Adds this action to widget w.

Reimplemented in Gui::ActionGroup, Gui::WorkbenchGroup, Gui::UndoAction, Gui::RedoAction, Gui::DockWidgetAction, Gui::ToolBarAction, and Gui::WindowAction.

Definition at line 72 of file Action.cpp.

References _action.

Referenced by Gui::Command::addTo().

bool Action::isChecked (  )  const
void Action::onActivated (  )  [virtual, slot]

Activates the command.

Reimplemented in Gui::ActionGroup.

Definition at line 80 of file Action.cpp.

References _pcCmd, and Gui::Command::invoke().

Referenced by Action(), Gui::RedoAction::RedoAction(), setCheckable(), and Gui::UndoAction::UndoAction().

void Action::onToggled ( bool  b  )  [virtual, slot]

Sets whether the command is toggled.

Definition at line 88 of file Action.cpp.

References _pcCmd, and Gui::Command::invoke().

Referenced by setCheckable().

void Action::setCheckable ( bool  b  ) 
void Action::setChecked ( bool  b  ) 
void Action::setEnabled ( bool  b  )  [virtual]

Sets whether the action is enabled.

Reimplemented in Gui::ActionGroup, Gui::UndoAction, and Gui::RedoAction.

Definition at line 119 of file Action.cpp.

References _action.

Referenced by Gui::Command::testActive().

void Action::setIcon ( const QIcon &  icon  ) 
void Action::setShortcut ( const QString &  key  ) 
void Action::setStatusTip ( const QString &  s  ) 
void Action::setText ( const QString &  s  ) 
void Action::setToolTip ( const QString &  s  ) 
void Action::setVisible ( bool  b  )  [virtual]

Reimplemented in Gui::ActionGroup, Gui::UndoAction, and Gui::RedoAction.

Definition at line 124 of file Action.cpp.

References _action.

void Action::setWhatsThis ( const QString &  s  ) 
QKeySequence Action::shortcut (  )  const
QString Action::statusTip (  )  const

Definition at line 149 of file Action.cpp.

References _action.

Referenced by Gui::PythonCommand::createAction(), and Gui::PythonCommand::languageChange().

QString Action::text (  )  const
QString Action::toolTip (  )  const

Definition at line 169 of file Action.cpp.

References _action.

QString Action::whatsThis (  )  const

Definition at line 179 of file Action.cpp.

References _action.

Referenced by Gui::DockWnd::TextBrowser::dropEvent().


Member Data Documentation

QAction* Gui::Action::_action [protected]

Definition at line 76 of file Action.h.

Referenced by Action(), Gui::ActionGroup::onActivated(), onActivated(), and onToggled().


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

Generated on Wed Nov 23 19:01:58 2011 for FreeCAD by  doxygen 1.6.1