The Action class is the link between Qt's QAction class and FreeCAD's command classes (Command). More...
#include <Action.h>
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 |
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.
Definition at line 42 of file Action.h.
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.
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 |
Definition at line 111 of file Action.cpp.
References _action.
Referenced by StdCmdAxisCross::isActive(), StdCmdToggleClipPlane::isActive(), StdPerspectiveCamera::isActive(), and StdOrthographicCamera::isActive().
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 | ) |
Definition at line 93 of file Action.cpp.
References _action, draftlibs::fcgeo::connect(), onActivated(), and onToggled().
Referenced by Gui::StdCmdDescription::createAction(), StdCmdStatusBar::createAction(), StdCmdAxisCross::createAction(), StdCmdToggleClipPlane::createAction(), StdPerspectiveCamera::createAction(), and StdOrthographicCamera::createAction().
void Action::setChecked | ( | bool | b | ) |
Definition at line 106 of file Action.cpp.
References _action.
Referenced by StdCmdStatusBar::createAction(), StdCmdAxisCross::isActive(), StdCmdToggleClipPlane::isActive(), StdPerspectiveCamera::isActive(), and StdOrthographicCamera::isActive().
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 | ) |
Definition at line 139 of file Action.cpp.
References _action.
Referenced by Gui::StdCmdDownloadOnlineHelp::createAction(), StdCmdAbout::createAction(), StdCmdWorkbench::createAction(), StdCmdRedo::createAction(), StdCmdUndo::createAction(), CmdDrawingNewPage::createAction(), Gui::PythonCommand::createAction(), Gui::MacroCommand::createAction(), Gui::Command::createAction(), Gui::MainWindow::event(), and Gui::Dialog::DlgCustomActionsImp::on_buttonReplaceAction_clicked().
void Action::setShortcut | ( | const QString & | key | ) |
Definition at line 129 of file Action.cpp.
References _action.
Referenced by Gui::StdCmdDownloadOnlineHelp::createAction(), StdCmdAbout::createAction(), StdCmdWorkbench::createAction(), StdCmdRedo::createAction(), StdCmdUndo::createAction(), Gui::PythonCommand::createAction(), Gui::MacroCommand::createAction(), Gui::Command::createAction(), Gui::Dialog::DlgCustomKeyboardImp::on_buttonAssign_clicked(), Gui::Dialog::DlgCustomActionsImp::on_buttonReplaceAction_clicked(), and Gui::Dialog::DlgCustomKeyboardImp::on_buttonReset_clicked().
void Action::setStatusTip | ( | const QString & | s | ) |
Definition at line 144 of file Action.cpp.
References _action.
Referenced by Gui::Command::applyCommandData(), Gui::StdCmdDownloadOnlineHelp::createAction(), StdCmdAbout::createAction(), Gui::PythonCommand::createAction(), Gui::MacroCommand::createAction(), Gui::StdCmdDownloadOnlineHelp::languageChange(), StdCmdAbout::languageChange(), Gui::PythonCommand::languageChange(), and Gui::Dialog::DlgCustomActionsImp::on_buttonReplaceAction_clicked().
void Action::setText | ( | const QString & | s | ) |
Definition at line 154 of file Action.cpp.
References _action.
Referenced by Gui::StdCmdDownloadOnlineHelp::activated(), Gui::Command::applyCommandData(), Gui::StdCmdDownloadOnlineHelp::createAction(), StdViewDockUndockFullscreen::createAction(), StdCmdAbout::createAction(), Gui::PythonCommand::createAction(), Gui::MacroCommand::createAction(), Gui::StdCmdDownloadOnlineHelp::languageChange(), StdCmdAbout::languageChange(), Gui::PythonCommand::languageChange(), and Gui::Dialog::DlgCustomActionsImp::on_buttonReplaceAction_clicked().
void Action::setToolTip | ( | const QString & | s | ) |
Definition at line 164 of file Action.cpp.
References _action.
Referenced by Gui::Command::applyCommandData(), Gui::StdCmdDownloadOnlineHelp::createAction(), StdCmdAbout::createAction(), Gui::PythonCommand::createAction(), Gui::MacroCommand::createAction(), Gui::StdCmdDownloadOnlineHelp::languageChange(), StdCmdAbout::languageChange(), Gui::PythonCommand::languageChange(), and Gui::Dialog::DlgCustomActionsImp::on_buttonReplaceAction_clicked().
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 | ) |
Definition at line 174 of file Action.cpp.
References _action.
Referenced by Gui::Command::applyCommandData(), Gui::StdCmdDownloadOnlineHelp::createAction(), StdCmdAbout::createAction(), Gui::PythonCommand::createAction(), Gui::MacroCommand::createAction(), Gui::StdCmdDownloadOnlineHelp::languageChange(), StdCmdAbout::languageChange(), Gui::PythonCommand::languageChange(), and Gui::Dialog::DlgCustomActionsImp::on_buttonReplaceAction_clicked().
QKeySequence Action::shortcut | ( | ) | const |
Definition at line 134 of file Action.cpp.
References _action.
Referenced by Gui::Dialog::DlgCustomKeyboardImp::on_buttonReset_clicked(), Gui::Dialog::DlgCustomKeyboardImp::on_commandTreeWidget_currentItemChanged(), and Gui::Dialog::DlgCustomKeyboardImp::on_editShortcut_textChanged().
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 |
Definition at line 159 of file Action.cpp.
References _action.
Referenced by Gui::WorkbenchGroup::refreshWorkbenchList(), and Gui::WorkbenchGroup::slotAddWorkbench().
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().
QAction* Gui::Action::_action [protected] |
Definition at line 75 of file Action.h.
Referenced by Action(), Gui::WindowAction::addTo(), Gui::ToolBarAction::addTo(), Gui::DockWidgetAction::addTo(), Gui::RedoAction::addTo(), Gui::UndoAction::addTo(), Gui::WorkbenchGroup::addTo(), Gui::ActionGroup::addTo(), addTo(), isChecked(), setCheckable(), setChecked(), setEnabled(), setIcon(), setShortcut(), setStatusTip(), setText(), setToolTip(), setVisible(), setWhatsThis(), shortcut(), statusTip(), text(), toolTip(), whatsThis(), and ~Action().
Command* Gui::Action::_pcCmd [protected] |
Definition at line 76 of file Action.h.
Referenced by Action(), Gui::ActionGroup::onActivated(), onActivated(), and onToggled().