PythonQt.Qt.QAction
QAction
PythonQtInstanceWrapper object
Native bases: PythonQtInstanceWrapper
Supplemental documentation: Qt 5 reference:
Detailed Description
In applications many common commands can be invoked via menus, toolbar buttons, and keyboard shortcuts. Since the user expects each command to be performed in the same way, regardless of the user interface used, it is useful to represent each command as an action.
Actions can be added to menus and toolbars, and will automatically keep them in sync. For example, in a word processor, if the user presses a Bold toolbar button, the Bold menu item will automatically be checked.
Actions can be created as independent objects, but they may also be created during the construction of menus; the QMenu class contains convenience functions for creating actions suitable for use as menu items.
A QAction may contain an icon, menu text, a shortcut, status text, "What's This?" text, and a tooltip. Most of these can be set in the constructor. They can also be set independently with setIcon(), setText(), setIconText(), setShortcut(), setStatusTip(), setWhatsThis(), and setToolTip(). For menu items, it is possible to set an individual font with setFont().
Actions are added to widgets using QWidget::addAction() or QGraphicsWidget::addAction(). Note that an action must be added to a widget before it can be used; this is also true when the shortcut should be global (i.e., Qt::ApplicationShortcut as Qt::ShortcutContext).
Once a QAction has been created it should be added to the relevant menu and toolbar, then connected to the slot which will perform the action. For example:
const QIcon openIcon = QIcon::fromTheme("document-open", QIcon(":/images/open.png"));
QAction *openAct = new QAction(openIcon, tr("&Open..."), this);
openAct->setShortcuts(QKeySequence::Open);
openAct->setStatusTip(tr("Open an existing file"));
connect(openAct, &QAction::triggered, this, &MainWindow::open);
fileMenu->addAction(openAct);
fileToolBar->addAction(openAct);
We recommend that actions are created as children of the window they are used in. In most cases actions will be children of the application's main window.
Source: https://doc.qt.io/archives/qt-5.15/qaction.html
Complete member index
Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.
| Member | Kind | Signature | Summary |
|---|---|---|---|
AboutQtRole |
attribute | Any |
(shared captured text) |
AboutRole |
attribute | Any |
(shared captured text) |
ActionEvent |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text) |
ApplicationSpecificRole |
attribute | Any |
(shared captured text) |
HighPriority |
attribute | Any |
(shared captured text) |
Hover |
attribute | Any |
(shared captured text) |
LowPriority |
attribute | Any |
(shared captured text) |
MenuRole |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text) |
NoRole |
attribute | Any |
(shared captured text) |
NormalPriority |
attribute | Any |
(shared captured text) |
PreferencesRole |
attribute | Any |
(shared captured text) |
Priority |
attribute | type |
Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text) |
QuitRole |
attribute | Any |
(shared captured text) |
TextHeuristicRole |
attribute | Any |
(shared captured text) |
Trigger |
attribute | Any |
(shared captured text) |
__init__ |
function | (self, *args: Any, **kwargs: Any) -> None |
Native constructor; consult class documentation for supported overloads. (shared captured text) |
actionGroup |
function | (self) -> Any |
X.actionGroup() -> PythonQt.QtGui.QActionGroup (shared captured text) |
activate |
function | (self, event: Any) -> None |
Sends the relevant signals for [ActionEvent](https://doc.qt.io/archives/qt-5.15/qaction.html#ActionEvent-enum) event. (shared captured text) |
associatedGraphicsWidgets |
function | (self) -> tuple |
X.associatedGraphicsWidgets() -> tuple (shared captured text) |
associatedWidgets |
function | (self) -> tuple |
X.associatedWidgets() -> tuple (shared captured text) |
autoRepeat |
attribute | bool |
This property holds whether the action can auto repeat (shared captured text) |
blockSignals |
function | (self, b: Any) -> bool |
X.blockSignals(b) -> bool (shared captured text) |
changed |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.Qt.QAction.changed; argument details are not documented. |
checkable |
attribute | Any |
This property holds whether the action is a checkable action (shared captured text) |
checked |
attribute | Any |
This property holds whether the action is checked. (shared captured text) |
childEvent |
function | (self, event: Any) -> Any |
(shared captured text) |
children |
function | (self) -> tuple |
X.children() -> tuple (shared captured text) |
className |
function | (self, *args: Any, **kwargs: Any) -> Any |
Return the classname of the object (shared captured text) |
connect |
function | (self, signal: Any, receiver: Any, slot: Any, type: Any) -> bool |
X.connect(signal, receiver, slot, type) -> bool (shared captured text) |
customEvent |
function | (self, event: Any) -> Any |
(shared captured text) |
data |
function | (self) -> Any |
X.data() -> object (shared captured text) |
delete |
function | (self, *args: Any, **kwargs: Any) -> Any |
Deletes the C++ object (at your own risk, my friend!) (shared captured text) |
deleteLater |
function | (self) -> Any |
(shared captured text) |
destroyed |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.Qt.QAction.destroyed; argument details are not documented. |
disconnect |
function | (self, signal: Any, receiver: Any, slot: Any) -> bool |
X.disconnect(signal, receiver, slot) -> bool (shared captured text) |
dumpObjectInfo |
function | (self) -> Any |
(shared captured text) |
dumpObjectTree |
function | (self) -> Any |
(shared captured text) |
dynamicPropertyNames |
function | (self) -> Any |
(shared captured text) |
enabled |
attribute | Any |
This property holds whether the action is enabled (shared captured text) |
event |
function | (self, arg__1: Any) -> bool |
X.event(arg__1) -> bool (shared captured text) |
eventFilter |
function | (self, watched: Any, event: Any) -> bool |
X.eventFilter(watched, event) -> bool (shared captured text) |
findChild |
function | (self, type: Any, name: Any) -> Any |
X.findChild(type, name) -> PythonQt.private.QObject (shared captured text) |
findChildren |
function | (self, type: Any, name: Any) -> tuple |
X.findChildren(type, name) -> tuple (shared captured text) |
font |
attribute | QFont |
This property holds the action's font (shared captured text) |
help |
function | (self, *args: Any, **kwargs: Any) -> Any |
Shows the help of available methods for this class (shared captured text) |
hover |
function | (self) -> None |
This is a convenience slot that calls activate(Hover). (shared captured text) |
hovered |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.Qt.QAction.hovered; argument details are not documented. |
icon |
attribute | QIcon |
This property holds the action's icon (shared captured text) |
iconText |
attribute | str |
This property holds the action's descriptive icon text (shared captured text) |
iconVisibleInMenu |
attribute | Any |
This property holds whether or not an action should show an icon in a menu (shared captured text) |
inherits |
function | (self, *args: Any, **kwargs: Any) -> Any |
Returns if the class inherits or is of given type name (shared captured text) |
installEventFilter |
function | (self, filterObj: Any) -> Any |
(shared captured text) |
isCheckable |
function | (self) -> bool |
X.isCheckable() -> bool (shared captured text) |
isChecked |
function | (self) -> bool |
X.isChecked() -> bool (shared captured text) |
isEnabled |
function | (self) -> bool |
X.isEnabled() -> bool (shared captured text) |
isIconVisibleInMenu |
function | (self) -> bool |
X.isIconVisibleInMenu() -> bool (shared captured text) |
isSeparator |
function | (self) -> bool |
X.isSeparator() -> bool (shared captured text) |
isSignalConnected |
function | (self, signal: Any) -> bool |
X.isSignalConnected(signal) -> bool (shared captured text) |
isVisible |
function | (self) -> bool |
X.isVisible() -> bool (shared captured text) |
isWidgetType |
function | (self) -> bool |
X.isWidgetType() -> bool (shared captured text) |
isWindowType |
function | (self) -> bool |
X.isWindowType() -> bool (shared captured text) |
killTimer |
function | (self, id: Any) -> Any |
(shared captured text) |
menu |
function | (self) -> Any |
X.menu() -> PythonQt.QtGui.QMenu (shared captured text) |
menuRole |
attribute | Any |
This property holds the action's menu role (shared captured text) |
metaObject |
function | (self) -> Any |
X.metaObject() -> PythonQt.QtCore.QMetaObject (shared captured text) |
moveToThread |
function | (self, thread: Any) -> Any |
(shared captured text) |
objectName |
attribute | Any |
(shared captured text) |
objectNameChanged |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.Qt.QAction.objectNameChanged; argument details are not documented. |
parent |
function | (self) -> Any |
X.parent() -> PythonQt.private.QObject (shared captured text) |
parentWidget |
function | (self) -> Any |
X.parentWidget() -> PythonQt.QtGui.QWidget (shared captured text) |
priority |
attribute | Any |
This property holds the actions's priority in the user interface. (shared captured text) |
property |
function | (self, name: Any) -> Any |
X.property(name) -> object (shared captured text) |
removeEventFilter |
function | (self, obj: Any) -> Any |
(shared captured text) |
sender |
function | (self) -> Any |
X.sender() -> PythonQt.private.QObject (shared captured text) |
senderSignalIndex |
function | (self) -> int |
X.senderSignalIndex() -> int (shared captured text) |
setActionGroup |
function | (self, group: Any) -> None |
Sets this action group to group. (shared captured text) |
setAutoRepeat |
function | (self, arg__1: bool) -> None |
(shared captured text) |
setCheckable |
function | (self, arg__1: bool) -> None |
(shared captured text) |
setChecked |
function | (self, a: Any) -> None |
(shared captured text) |
setData |
function | (self, var: Any) -> None |
Sets the action's internal data to the given userData. (shared captured text) |
setDisabled |
function | (self, b: bool) -> None |
This is a convenience function for the [enabled](https://doc.qt.io/archives/qt-5.15/qaction.html#enabled-prop) property, that is useful for signals--slots connections. (shared captured text) |
setEnabled |
function | (self, a: Any) -> None |
(shared captured text) |
setFont |
function | (self, font: Any) -> None |
(shared captured text) |
setIcon |
function | (self, icon: Any) -> None |
(shared captured text) |
setIconText |
function | (self, text: str) -> None |
(shared captured text) |
setIconVisibleInMenu |
function | (self, visible: bool) -> None |
(shared captured text) |
setMenu |
function | (self, menu: Any) -> None |
Sets the menu contained by this action to the specified menu. (shared captured text) |
setMenuRole |
function | (self, menuRole: Any) -> None |
(shared captured text) |
setObjectName |
function | (self, name: Any) -> Any |
(shared captured text) |
setParent |
function | (self, parent: Any) -> Any |
(shared captured text) |
setPriority |
function | (self, priority: Any) -> None |
(shared captured text) |
setProperty |
function | (self, name: Any, value: Any) -> bool |
X.setProperty(name, value) -> bool (shared captured text) |
setSeparator |
function | (self, b: bool) -> None |
If b is true then this action will be considered a separator. (shared captured text) |
setShortcut |
function | (self, shortcut: Any) -> None |
(shared captured text) |
setShortcutContext |
function | (self, context: Any) -> None |
(shared captured text) |
setShortcuts |
function | (self, arg__1: Any) -> None |
Sets shortcuts as the list of shortcuts that trigger the action. (shared captured text) |
setStatusTip |
function | (self, statusTip: str) -> None |
(shared captured text) |
setText |
function | (self, text: str) -> None |
(shared captured text) |
setToolTip |
function | (self, tip: str) -> None |
(shared captured text) |
setVisible |
function | (self, a: Any) -> None |
(shared captured text) |
setWhatsThis |
function | (self, what: str) -> None |
(shared captured text) |
shortcut |
attribute | QKeySequence |
This property holds the action's primary shortcut key (shared captured text) |
shortcutContext |
attribute | Any |
This property holds the context for the action's shortcut (shared captured text) |
shortcutVisibleInContextMenu |
attribute | Any |
This property holds whether or not an action should show a shortcut in a context menu (shared captured text) |
shortcuts |
function | (self) -> tuple |
X.shortcuts() -> tuple (shared captured text) |
showStatusText |
function | (self, widget: Any) -> bool |
X.showStatusText(widget) -> bool (shared captured text) |
signalsBlocked |
function | (self) -> bool |
X.signalsBlocked() -> bool (shared captured text) |
startTimer |
function | (self, interval: Any, timerType: Any) -> int |
X.startTimer(interval, timerType) -> int (shared captured text) |
statusTip |
attribute | str |
This property holds the action's status tip (shared captured text) |
text |
attribute | str |
This property holds the action's descriptive text (shared captured text) |
thread |
function | (self) -> Any |
(shared captured text) |
timerEvent |
function | (self, event: Any) -> Any |
(shared captured text) |
toggle |
function | (self) -> None |
This is a convenience function for the [checked](https://doc.qt.io/archives/qt-5.15/qaction.html#checked-prop) property. (shared captured text) |
toggled |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.Qt.QAction.toggled; argument details are not documented. |
toolTip |
attribute | str |
This property holds the action's tooltip (shared captured text) |
tr |
function | (self, text: Any, ambig: Any, n: Any) -> str |
X.tr(text, ambig, n) -> str (shared captured text) |
trigger |
function | (self) -> None |
This is a convenience slot that calls activate(Trigger). (shared captured text) |
triggered |
function | (self, *args: Any, **kwargs: Any) -> Any |
Native PythonQt.Qt.QAction.triggered; argument details are not documented. |
visible |
attribute | Any |
This property holds whether the action can be seen (e.g. in menus and toolbars) (shared captured text) |
whatsThis |
attribute | str |
This property holds the action's "What's This?" help text (shared captured text) |