[−][src]Struct qt_widgets::QAction
The QAction class provides an abstract user interface action that can be inserted into widgets.
C++ class: QAction
.
The QAction class provides an abstract user interface action that can be inserted into widgets.
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);
fileMenu->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.
Methods
impl QAction
[src]
pub fn slot_trigger(&self) -> Receiver<()>
[src]
This is a convenience slot that calls activate(Trigger).
Returns a built-in Qt slot QAction::trigger
that can be passed to qt_core::Signal::connect
.
This is a convenience slot that calls activate(Trigger).
pub fn slot_hover(&self) -> Receiver<()>
[src]
This is a convenience slot that calls activate(Hover).
Returns a built-in Qt slot QAction::hover
that can be passed to qt_core::Signal::connect
.
This is a convenience slot that calls activate(Hover).
pub fn slot_set_checked(&self) -> Receiver<(bool,)>
[src]
This property holds whether the action is checked.
Returns a built-in Qt slot QAction::setChecked
that can be passed to qt_core::Signal::connect
.
pub fn slot_toggle(&self) -> Receiver<()>
[src]
This is a convenience function for the checked property. Connect to it to change the checked state to its opposite state.
Returns a built-in Qt slot QAction::toggle
that can be passed to qt_core::Signal::connect
.
This is a convenience function for the checked property. Connect to it to change the checked state to its opposite state.
pub fn slot_set_enabled(&self) -> Receiver<(bool,)>
[src]
This property holds whether the action is enabled
Returns a built-in Qt slot QAction::setEnabled
that can be passed to qt_core::Signal::connect
.
This property holds whether the action is enabled
Disabled actions cannot be chosen by the user. They do not disappear from menus or toolbars, but they are displayed in a way which indicates that they are unavailable. For example, they might be displayed using only shades of gray.
What's This? help on disabled actions is still available, provided that the QAction::whatsThis property is set.
An action will be disabled when all widgets to which it is added (with QWidget::addAction()) are disabled or not visible. When an action is disabled, it is not possible to trigger it through its shortcut.
By default, this property is true
(actions are enabled).
Access functions:
bool | isEnabled() const |
void | setEnabled(bool) |
Notifier signal:
void | changed() |
See also text.
pub fn slot_set_disabled(&self) -> Receiver<(bool,)>
[src]
This is a convenience function for the enabled property, that is useful for signals--slots connections. If b is true the action is disabled; otherwise it is enabled.
Returns a built-in Qt slot QAction::setDisabled
that can be passed to qt_core::Signal::connect
.
This is a convenience function for the enabled property, that is useful for signals--slots connections. If b is true the action is disabled; otherwise it is enabled.
pub fn slot_set_visible(&self) -> Receiver<(bool,)>
[src]
This property holds whether the action can be seen (e.g. in menus and toolbars)
Returns a built-in Qt slot QAction::setVisible
that can be passed to qt_core::Signal::connect
.
This property holds whether the action can be seen (e.g. in menus and toolbars)
If visible is true the action can be seen (e.g. in menus and toolbars) and chosen by the user; if visible is false the action cannot be seen or chosen by the user.
Actions which are not visible are not grayed out; they do not appear at all.
By default, this property is true
(actions are visible).
Access functions:
bool | isVisible() const |
void | setVisible(bool) |
Notifier signal:
void | changed() |
pub fn changed(&self) -> Signal<()>
[src]
This signal is emitted when an action has changed. If you are only interested in actions in a given widget, you can watch for QWidget::actionEvent() sent with an QEvent::ActionChanged.
Returns a built-in Qt signal QAction::changed
that can be passed to qt_core::Signal::connect
.
This signal is emitted when an action has changed. If you are only interested in actions in a given widget, you can watch for QWidget::actionEvent() sent with an QEvent::ActionChanged.
Note: Notifier signal for property autoRepeat. Notifier signal for property checkable. Notifier signal for property enabled. Notifier signal for property font. Notifier signal for property icon. Notifier signal for property iconText. Notifier signal for property iconVisibleInMenu. Notifier signal for property menuRole. Notifier signal for property shortcut. Notifier signal for property shortcutContext. Notifier signal for property statusTip. Notifier signal for property text. Notifier signal for property toolTip. Notifier signal for property visible. Notifier signal for property whatsThis.
See also QWidget::actionEvent().
pub fn triggered(&self) -> Signal<(bool,)>
[src]
This signal is emitted when an action is activated by the user; for example, when the user clicks a menu option, toolbar button, or presses an action's shortcut key combination, or when trigger() was called. Notably, it is not emitted when setChecked() or toggle() is called.
Returns a built-in Qt signal QAction::triggered
that can be passed to qt_core::Signal::connect
.
This signal is emitted when an action is activated by the user; for example, when the user clicks a menu option, toolbar button, or presses an action's shortcut key combination, or when trigger() was called. Notably, it is not emitted when setChecked() or toggle() is called.
If the action is checkable, checked is true if the action is checked, or false if the action is unchecked.
See also QAction::activate(), QAction::toggled(), and checked.
pub fn hovered(&self) -> Signal<()>
[src]
This signal is emitted when an action is highlighted by the user; for example, when the user pauses with the cursor over a menu option, toolbar button, or presses an action's shortcut key combination.
Returns a built-in Qt signal QAction::hovered
that can be passed to qt_core::Signal::connect
.
This signal is emitted when an action is highlighted by the user; for example, when the user pauses with the cursor over a menu option, toolbar button, or presses an action's shortcut key combination.
See also QAction::activate().
pub fn toggled(&self) -> Signal<(bool,)>
[src]
This signal is emitted whenever a checkable action changes its isChecked() status. This can be the result of a user interaction, or because setChecked() was called.
Returns a built-in Qt signal QAction::toggled
that can be passed to qt_core::Signal::connect
.
This signal is emitted whenever a checkable action changes its isChecked() status. This can be the result of a user interaction, or because setChecked() was called.
checked is true if the action is checked, or false if the action is unchecked.
Note: Notifier signal for property checked.
See also QAction::activate(), QAction::triggered(), and checked.
pub unsafe fn action_group(&self) -> QPtr<QActionGroup>
[src]
Returns the action group for this action. If no action group manages this action then 0 will be returned.
Calls C++ function: QActionGroup* QAction::actionGroup() const
.
Returns the action group for this action. If no action group manages this action then 0 will be returned.
See also QActionGroup and QAction::setActionGroup().
pub unsafe fn activate(&self, event: ActionEvent)
[src]
Sends the relevant signals for ActionEvent event.
Calls C++ function: void QAction::activate(QAction::ActionEvent event)
.
Sends the relevant signals for ActionEvent event.
Action based widgets use this API to cause the QAction to emit signals as well as emitting their own.
pub unsafe fn associated_graphics_widgets(
&self
) -> CppBox<QListOfQGraphicsWidget>
[src]
&self
) -> CppBox<QListOfQGraphicsWidget>
Returns a list of widgets this action has been added to.
Calls C++ function: QList<QGraphicsWidget*> QAction::associatedGraphicsWidgets() const
.
Returns a list of widgets this action has been added to.
This function was introduced in Qt 4.5.
See also QWidget::addAction() and associatedWidgets().
pub unsafe fn associated_widgets(&self) -> CppBox<QListOfQWidget>
[src]
Returns a list of widgets this action has been added to.
Calls C++ function: QList<QWidget*> QAction::associatedWidgets() const
.
Returns a list of widgets this action has been added to.
This function was introduced in Qt 4.2.
See also QWidget::addAction() and associatedGraphicsWidgets().
pub unsafe fn auto_repeat(&self) -> bool
[src]
This property holds whether the action can auto repeat
Calls C++ function: bool QAction::autoRepeat() const
.
This property holds whether the action can auto repeat
If true, the action will auto repeat when the keyboard shortcut combination is held down, provided that keyboard auto repeat is enabled on the system. The default value is true.
This property was introduced in Qt 4.2.
Access functions:
bool | autoRepeat() const |
void | setAutoRepeat(bool) |
Notifier signal:
void | changed() |
pub unsafe fn data(&self) -> CppBox<QVariant>
[src]
Returns the user data as set in QAction::setData.
Calls C++ function: QVariant QAction::data() const
.
Returns the user data as set in QAction::setData.
See also setData().
pub unsafe fn font(&self) -> CppBox<QFont>
[src]
This property holds the action's font
Calls C++ function: QFont QAction::font() const
.
This property holds the action's font
The font property is used to render the text set on the QAction. The font will can be considered a hint as it will not be consulted in all cases based upon application and style.
By default, this property contains the application's default font.
Access functions:
QFont | font() const |
void | setFont(const QFont &font) |
Notifier signal:
void | changed() |
See also QAction::setText() and QStyle.
pub unsafe fn hover(&self)
[src]
This is a convenience slot that calls activate(Hover).
Calls C++ function: [slot] void QAction::hover()
.
This is a convenience slot that calls activate(Hover).
pub unsafe fn icon(&self) -> CppBox<QIcon>
[src]
This property holds the action's icon
Calls C++ function: QIcon QAction::icon() const
.
This property holds the action's icon
In toolbars, the icon is used as the tool button icon; in menus, it is displayed to the left of the menu text. There is no default icon.
If a null icon (QIcon::isNull()) is passed into this function, the icon of the action is cleared.
Access functions:
QIcon | icon() const |
void | setIcon(const QIcon &icon) |
Notifier signal:
void | changed() |
pub unsafe fn icon_text(&self) -> CppBox<QString>
[src]
This property holds the action's descriptive icon text
Calls C++ function: QString QAction::iconText() const
.
This property holds the action's descriptive icon text
If QToolBar::toolButtonStyle is set to a value that permits text to be displayed, the text defined held in this property appears as a label in the relevant tool button.
It also serves as the default text in menus and tooltips if the action has not been defined with setText() or setToolTip(), and will also be used in toolbar buttons if no icon has been defined using setIcon().
If the icon text is not explicitly set, the action's normal text will be used for the icon text.
By default, this property contains an empty string.
Access functions:
QString | iconText() const |
void | setIconText(const QString &text) |
Notifier signal:
void | changed() |
See also setToolTip() and setStatusTip().
pub unsafe fn is_checkable(&self) -> bool
[src]
This property holds whether the action is a checkable action
Calls C++ function: bool QAction::isCheckable() const
.
This property holds whether the action is a checkable action
A checkable action is one which has an on/off state. For example, in a word processor, a Bold toolbar button may be either on or off. An action which is not a toggle action is a command action; a command action is simply executed, e.g. file save. By default, this property is false
.
In some situations, the state of one toggle action should depend on the state of others. For example, "Left Align", "Center" and "Right Align" toggle actions are mutually exclusive. To achieve exclusive toggling, add the relevant toggle actions to a QActionGroup with the QActionGroup::exclusive property set to true.
Access functions:
bool | isCheckable() const |
void | setCheckable(bool) |
Notifier signal:
void | changed() |
See also QAction::setChecked().
pub unsafe fn is_checked(&self) -> bool
[src]
This property holds whether the action is checked.
Calls C++ function: bool QAction::isChecked() const
.
pub unsafe fn is_enabled(&self) -> bool
[src]
This property holds whether the action is enabled
Calls C++ function: bool QAction::isEnabled() const
.
This property holds whether the action is enabled
Disabled actions cannot be chosen by the user. They do not disappear from menus or toolbars, but they are displayed in a way which indicates that they are unavailable. For example, they might be displayed using only shades of gray.
What's This? help on disabled actions is still available, provided that the QAction::whatsThis property is set.
An action will be disabled when all widgets to which it is added (with QWidget::addAction()) are disabled or not visible. When an action is disabled, it is not possible to trigger it through its shortcut.
By default, this property is true
(actions are enabled).
Access functions:
bool | isEnabled() const |
void | setEnabled(bool) |
Notifier signal:
void | changed() |
See also text.
pub unsafe fn is_icon_visible_in_menu(&self) -> bool
[src]
This property holds whether or not an action should show an icon in a menu
Calls C++ function: bool QAction::isIconVisibleInMenu() const
.
This property holds whether or not an action should show an icon in a menu
In some applications, it may make sense to have actions with icons in the toolbar, but not in menus. If true, the icon (if valid) is shown in the menu, when it is false, it is not shown.
The default is to follow whether the Qt::AA_DontShowIconsInMenus attribute is set for the application. Explicitly settings this property overrides the presence (or abscence) of the attribute.
For example:
QApplication app(argc, argv); app.setAttribute(Qt::AA_DontShowIconsInMenus); // Icons are no longer shown in menus // ... QAction *myAction = new QAction(); // ... myAction->setIcon(SomeIcon); myAction->setIconVisibleInMenu(true); // Icon will be shown in menus for this action.
This property was introduced in Qt 4.4.
Access functions:
bool | isIconVisibleInMenu() const |
void | setIconVisibleInMenu(bool visible) |
Notifier signal:
void | changed() |
See also QAction::icon and QCoreApplication::setAttribute().
pub unsafe fn is_separator(&self) -> bool
[src]
Returns true
if this action is a separator action; otherwise it returns false
.
Calls C++ function: bool QAction::isSeparator() const
.
Returns true
if this action is a separator action; otherwise it returns false
.
See also QAction::setSeparator().
pub unsafe fn is_shortcut_visible_in_context_menu(&self) -> bool
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.This property holds whether or not an action should show a shortcut in a context menu
Calls C++ function: bool QAction::isShortcutVisibleInContextMenu() const
.
This property holds whether or not an action should show a shortcut in a context menu
In some applications, it may make sense to have actions with shortcuts in context menus. If true, the shortcut (if valid) is shown when the action is shown via a context menu, when it is false, it is not shown.
The default is to follow whether the Qt::AA_DontShowShortcutsInContextMenus attribute is set for the application, falling back to the widget style hint. Explicitly setting this property overrides the presence (or abscence) of the attribute.
This property was introduced in Qt 5.10.
Access functions:
bool | isShortcutVisibleInContextMenu() const |
void | setShortcutVisibleInContextMenu(bool show) |
Notifier signal:
void | changed() |
See also QAction::shortcut and QCoreApplication::setAttribute().
pub unsafe fn is_visible(&self) -> bool
[src]
This property holds whether the action can be seen (e.g. in menus and toolbars)
Calls C++ function: bool QAction::isVisible() const
.
This property holds whether the action can be seen (e.g. in menus and toolbars)
If visible is true the action can be seen (e.g. in menus and toolbars) and chosen by the user; if visible is false the action cannot be seen or chosen by the user.
Actions which are not visible are not grayed out; they do not appear at all.
By default, this property is true
(actions are visible).
Access functions:
bool | isVisible() const |
void | setVisible(bool) |
Notifier signal:
void | changed() |
pub unsafe fn menu(&self) -> QPtr<QMenu>
[src]
Returns the menu contained by this action. Actions that contain menus can be used to create menu items with submenus, or inserted into toolbars to create buttons with popup menus.
Calls C++ function: QMenu* QAction::menu() const
.
Returns the menu contained by this action. Actions that contain menus can be used to create menu items with submenus, or inserted into toolbars to create buttons with popup menus.
See also setMenu() and QMenu::addAction().
pub unsafe fn menu_role(&self) -> MenuRole
[src]
This property holds the action's menu role
Calls C++ function: QAction::MenuRole QAction::menuRole() const
.
This property holds the action's menu role
This indicates what role the action serves in the application menu on macOS. By default all actions have the TextHeuristicRole, which means that the action is added based on its text (see QMenuBar for more information).
The menu role can only be changed before the actions are put into the menu bar in macOS (usually just before the first application window is shown).
This property was introduced in Qt 4.2.
Access functions:
MenuRole | menuRole() const |
void | setMenuRole(MenuRole menuRole) |
Notifier signal:
void | changed() |
pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>
[src]
Calls C++ function: virtual const QMetaObject* QAction::metaObject() const
.
pub unsafe fn from_q_object(
parent: impl CastInto<Ptr<QObject>>
) -> QBox<QAction>
[src]
parent: impl CastInto<Ptr<QObject>>
) -> QBox<QAction>
Constructs an action with parent. If parent is an action group the action will be automatically inserted into the group.
Calls C++ function: [constructor] void QAction::QAction(QObject* parent = …)
.
Constructs an action with parent. If parent is an action group the action will be automatically inserted into the group.
Note: The parent argument is optional since Qt 5.7.
pub unsafe fn from_q_string_q_object(
text: impl CastInto<Ref<QString>>,
parent: impl CastInto<Ptr<QObject>>
) -> QBox<QAction>
[src]
text: impl CastInto<Ref<QString>>,
parent: impl CastInto<Ptr<QObject>>
) -> QBox<QAction>
Constructs an action with some text and parent. If parent is an action group the action will be automatically inserted into the group.
Calls C++ function: [constructor] void QAction::QAction(const QString& text, QObject* parent = …)
.
Constructs an action with some text and parent. If parent is an action group the action will be automatically inserted into the group.
The action uses a stripped version of text (e.g. "&Menu Option..." becomes "Menu Option") as descriptive text for tool buttons. You can override this by setting a specific description with setText(). The same text will be used for tooltips unless you specify a different text using setToolTip().
pub unsafe fn from_q_icon_q_string_q_object(
icon: impl CastInto<Ref<QIcon>>,
text: impl CastInto<Ref<QString>>,
parent: impl CastInto<Ptr<QObject>>
) -> QBox<QAction>
[src]
icon: impl CastInto<Ref<QIcon>>,
text: impl CastInto<Ref<QString>>,
parent: impl CastInto<Ptr<QObject>>
) -> QBox<QAction>
Constructs an action with an icon and some text and parent. If parent is an action group the action will be automatically inserted into the group.
Calls C++ function: [constructor] void QAction::QAction(const QIcon& icon, const QString& text, QObject* parent = …)
.
Constructs an action with an icon and some text and parent. If parent is an action group the action will be automatically inserted into the group.
The action uses a stripped version of text (e.g. "&Menu Option..." becomes "Menu Option") as descriptive text for tool buttons. You can override this by setting a specific description with setText(). The same text will be used for tooltips unless you specify a different text using setToolTip().
pub unsafe fn new() -> QBox<QAction>
[src]
The QAction class provides an abstract user interface action that can be inserted into widgets.
Calls C++ function: [constructor] void QAction::QAction()
.
The QAction class provides an abstract user interface action that can be inserted into widgets.
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);
fileMenu->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.
pub unsafe fn from_q_string(text: impl CastInto<Ref<QString>>) -> QBox<QAction>
[src]
Constructs an action with some text and parent. If parent is an action group the action will be automatically inserted into the group.
Calls C++ function: [constructor] void QAction::QAction(const QString& text)
.
Constructs an action with some text and parent. If parent is an action group the action will be automatically inserted into the group.
The action uses a stripped version of text (e.g. "&Menu Option..." becomes "Menu Option") as descriptive text for tool buttons. You can override this by setting a specific description with setText(). The same text will be used for tooltips unless you specify a different text using setToolTip().
pub unsafe fn from_q_icon_q_string(
icon: impl CastInto<Ref<QIcon>>,
text: impl CastInto<Ref<QString>>
) -> QBox<QAction>
[src]
icon: impl CastInto<Ref<QIcon>>,
text: impl CastInto<Ref<QString>>
) -> QBox<QAction>
Constructs an action with an icon and some text and parent. If parent is an action group the action will be automatically inserted into the group.
Calls C++ function: [constructor] void QAction::QAction(const QIcon& icon, const QString& text)
.
Constructs an action with an icon and some text and parent. If parent is an action group the action will be automatically inserted into the group.
The action uses a stripped version of text (e.g. "&Menu Option..." becomes "Menu Option") as descriptive text for tool buttons. You can override this by setting a specific description with setText(). The same text will be used for tooltips unless you specify a different text using setToolTip().
pub unsafe fn parent_widget(&self) -> QPtr<QWidget>
[src]
Returns the parent widget.
Calls C++ function: QWidget* QAction::parentWidget() const
.
Returns the parent widget.
pub unsafe fn priority(&self) -> Priority
[src]
This property holds the actions's priority in the user interface.
Calls C++ function: QAction::Priority QAction::priority() const
.
This property holds the actions's priority in the user interface.
This property can be set to indicate how the action should be prioritized in the user interface.
For instance, when toolbars have the Qt::ToolButtonTextBesideIcon mode set, then actions with LowPriority will not show the text labels.
This property was introduced in Qt 4.6.
Access functions:
Priority | priority() const |
void | setPriority(Priority priority) |
pub unsafe fn qt_metacall(
&self,
arg1: Call,
arg2: c_int,
arg3: *mut *mut c_void
) -> c_int
[src]
&self,
arg1: Call,
arg2: c_int,
arg3: *mut *mut c_void
) -> c_int
Calls C++ function: virtual int QAction::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3)
.
pub unsafe fn qt_metacast(&self, arg1: *const c_char) -> *mut c_void
[src]
Calls C++ function: virtual void* QAction::qt_metacast(const char* arg1)
.
pub unsafe fn set_action_group(&self, group: impl CastInto<Ptr<QActionGroup>>)
[src]
Sets this action group to group. The action will be automatically added to the group's list of actions.
Calls C++ function: void QAction::setActionGroup(QActionGroup* group)
.
Sets this action group to group. The action will be automatically added to the group's list of actions.
Actions within the group will be mutually exclusive.
See also QActionGroup and QAction::actionGroup().
pub unsafe fn set_auto_repeat(&self, arg1: bool)
[src]
This property holds whether the action can auto repeat
Calls C++ function: void QAction::setAutoRepeat(bool arg1)
.
This property holds whether the action can auto repeat
If true, the action will auto repeat when the keyboard shortcut combination is held down, provided that keyboard auto repeat is enabled on the system. The default value is true.
This property was introduced in Qt 4.2.
Access functions:
bool | autoRepeat() const |
void | setAutoRepeat(bool) |
Notifier signal:
void | changed() |
pub unsafe fn set_checkable(&self, arg1: bool)
[src]
This property holds whether the action is a checkable action
Calls C++ function: void QAction::setCheckable(bool arg1)
.
This property holds whether the action is a checkable action
A checkable action is one which has an on/off state. For example, in a word processor, a Bold toolbar button may be either on or off. An action which is not a toggle action is a command action; a command action is simply executed, e.g. file save. By default, this property is false
.
In some situations, the state of one toggle action should depend on the state of others. For example, "Left Align", "Center" and "Right Align" toggle actions are mutually exclusive. To achieve exclusive toggling, add the relevant toggle actions to a QActionGroup with the QActionGroup::exclusive property set to true.
Access functions:
bool | isCheckable() const |
void | setCheckable(bool) |
Notifier signal:
void | changed() |
See also QAction::setChecked().
pub unsafe fn set_checked(&self, arg1: bool)
[src]
This property holds whether the action is checked.
Calls C++ function: [slot] void QAction::setChecked(bool arg1)
.
pub unsafe fn set_data(&self, var: impl CastInto<Ref<QVariant>>)
[src]
Sets the action's internal data to the given userData.
Calls C++ function: void QAction::setData(const QVariant& var)
.
Sets the action's internal data to the given userData.
See also data().
pub unsafe fn set_disabled(&self, b: bool)
[src]
This is a convenience function for the enabled property, that is useful for signals--slots connections. If b is true the action is disabled; otherwise it is enabled.
Calls C++ function: [slot] void QAction::setDisabled(bool b)
.
This is a convenience function for the enabled property, that is useful for signals--slots connections. If b is true the action is disabled; otherwise it is enabled.
pub unsafe fn set_enabled(&self, arg1: bool)
[src]
This property holds whether the action is enabled
Calls C++ function: [slot] void QAction::setEnabled(bool arg1)
.
This property holds whether the action is enabled
Disabled actions cannot be chosen by the user. They do not disappear from menus or toolbars, but they are displayed in a way which indicates that they are unavailable. For example, they might be displayed using only shades of gray.
What's This? help on disabled actions is still available, provided that the QAction::whatsThis property is set.
An action will be disabled when all widgets to which it is added (with QWidget::addAction()) are disabled or not visible. When an action is disabled, it is not possible to trigger it through its shortcut.
By default, this property is true
(actions are enabled).
Access functions:
bool | isEnabled() const |
void | setEnabled(bool) |
Notifier signal:
void | changed() |
See also text.
pub unsafe fn set_font(&self, font: impl CastInto<Ref<QFont>>)
[src]
This property holds the action's font
Calls C++ function: void QAction::setFont(const QFont& font)
.
This property holds the action's font
The font property is used to render the text set on the QAction. The font will can be considered a hint as it will not be consulted in all cases based upon application and style.
By default, this property contains the application's default font.
Access functions:
QFont | font() const |
void | setFont(const QFont &font) |
Notifier signal:
void | changed() |
See also QAction::setText() and QStyle.
pub unsafe fn set_icon(&self, icon: impl CastInto<Ref<QIcon>>)
[src]
This property holds the action's icon
Calls C++ function: void QAction::setIcon(const QIcon& icon)
.
This property holds the action's icon
In toolbars, the icon is used as the tool button icon; in menus, it is displayed to the left of the menu text. There is no default icon.
If a null icon (QIcon::isNull()) is passed into this function, the icon of the action is cleared.
Access functions:
QIcon | icon() const |
void | setIcon(const QIcon &icon) |
Notifier signal:
void | changed() |
pub unsafe fn set_icon_text(&self, text: impl CastInto<Ref<QString>>)
[src]
This property holds the action's descriptive icon text
Calls C++ function: void QAction::setIconText(const QString& text)
.
This property holds the action's descriptive icon text
If QToolBar::toolButtonStyle is set to a value that permits text to be displayed, the text defined held in this property appears as a label in the relevant tool button.
It also serves as the default text in menus and tooltips if the action has not been defined with setText() or setToolTip(), and will also be used in toolbar buttons if no icon has been defined using setIcon().
If the icon text is not explicitly set, the action's normal text will be used for the icon text.
By default, this property contains an empty string.
Access functions:
QString | iconText() const |
void | setIconText(const QString &text) |
Notifier signal:
void | changed() |
See also setToolTip() and setStatusTip().
pub unsafe fn set_icon_visible_in_menu(&self, visible: bool)
[src]
This property holds whether or not an action should show an icon in a menu
Calls C++ function: void QAction::setIconVisibleInMenu(bool visible)
.
This property holds whether or not an action should show an icon in a menu
In some applications, it may make sense to have actions with icons in the toolbar, but not in menus. If true, the icon (if valid) is shown in the menu, when it is false, it is not shown.
The default is to follow whether the Qt::AA_DontShowIconsInMenus attribute is set for the application. Explicitly settings this property overrides the presence (or abscence) of the attribute.
For example:
QApplication app(argc, argv); app.setAttribute(Qt::AA_DontShowIconsInMenus); // Icons are no longer shown in menus // ... QAction *myAction = new QAction(); // ... myAction->setIcon(SomeIcon); myAction->setIconVisibleInMenu(true); // Icon will be shown in menus for this action.
This property was introduced in Qt 4.4.
Access functions:
bool | isIconVisibleInMenu() const |
void | setIconVisibleInMenu(bool visible) |
Notifier signal:
void | changed() |
See also QAction::icon and QCoreApplication::setAttribute().
pub unsafe fn set_menu(&self, menu: impl CastInto<Ptr<QMenu>>)
[src]
Sets the menu contained by this action to the specified menu.
Calls C++ function: void QAction::setMenu(QMenu* menu)
.
Sets the menu contained by this action to the specified menu.
See also menu().
pub unsafe fn set_menu_role(&self, menu_role: MenuRole)
[src]
This property holds the action's menu role
Calls C++ function: void QAction::setMenuRole(QAction::MenuRole menuRole)
.
This property holds the action's menu role
This indicates what role the action serves in the application menu on macOS. By default all actions have the TextHeuristicRole, which means that the action is added based on its text (see QMenuBar for more information).
The menu role can only be changed before the actions are put into the menu bar in macOS (usually just before the first application window is shown).
This property was introduced in Qt 4.2.
Access functions:
MenuRole | menuRole() const |
void | setMenuRole(MenuRole menuRole) |
Notifier signal:
void | changed() |
pub unsafe fn set_priority(&self, priority: Priority)
[src]
This property holds the actions's priority in the user interface.
Calls C++ function: void QAction::setPriority(QAction::Priority priority)
.
This property holds the actions's priority in the user interface.
This property can be set to indicate how the action should be prioritized in the user interface.
For instance, when toolbars have the Qt::ToolButtonTextBesideIcon mode set, then actions with LowPriority will not show the text labels.
This property was introduced in Qt 4.6.
Access functions:
Priority | priority() const |
void | setPriority(Priority priority) |
pub unsafe fn set_separator(&self, b: bool)
[src]
If b is true then this action will be considered a separator.
Calls C++ function: void QAction::setSeparator(bool b)
.
If b is true then this action will be considered a separator.
How a separator is represented depends on the widget it is inserted into. Under most circumstances the text, submenu, and icon will be ignored for separator actions.
See also QAction::isSeparator().
pub unsafe fn set_shortcut(&self, shortcut: impl CastInto<Ref<QKeySequence>>)
[src]
This property holds the action's primary shortcut key
Calls C++ function: void QAction::setShortcut(const QKeySequence& shortcut)
.
This property holds the action's primary shortcut key
Valid keycodes for this property can be found in Qt::Key and Qt::Modifier. There is no default shortcut key.
Access functions:
QKeySequence | shortcut() const |
void | setShortcut(const QKeySequence &shortcut) |
Notifier signal:
void | changed() |
pub unsafe fn set_shortcut_context(&self, context: ShortcutContext)
[src]
This property holds the context for the action's shortcut
Calls C++ function: void QAction::setShortcutContext(Qt::ShortcutContext context)
.
This property holds the context for the action's shortcut
Valid values for this property can be found in Qt::ShortcutContext. The default value is Qt::WindowShortcut.
Access functions:
Qt::ShortcutContext | shortcutContext() const |
void | setShortcutContext(Qt::ShortcutContext context) |
Notifier signal:
void | changed() |
pub unsafe fn set_shortcut_visible_in_context_menu(&self, show: bool)
[src]
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.This property holds whether or not an action should show a shortcut in a context menu
Calls C++ function: void QAction::setShortcutVisibleInContextMenu(bool show)
.
This property holds whether or not an action should show a shortcut in a context menu
In some applications, it may make sense to have actions with shortcuts in context menus. If true, the shortcut (if valid) is shown when the action is shown via a context menu, when it is false, it is not shown.
The default is to follow whether the Qt::AA_DontShowShortcutsInContextMenus attribute is set for the application, falling back to the widget style hint. Explicitly setting this property overrides the presence (or abscence) of the attribute.
This property was introduced in Qt 5.10.
Access functions:
bool | isShortcutVisibleInContextMenu() const |
void | setShortcutVisibleInContextMenu(bool show) |
Notifier signal:
void | changed() |
See also QAction::shortcut and QCoreApplication::setAttribute().
pub unsafe fn set_shortcuts_q_list_of_q_key_sequence(
&self,
shortcuts: impl CastInto<Ref<QListOfQKeySequence>>
)
[src]
&self,
shortcuts: impl CastInto<Ref<QListOfQKeySequence>>
)
Sets shortcuts as the list of shortcuts that trigger the action. The first element of the list is the primary shortcut.
Calls C++ function: void QAction::setShortcuts(const QList<QKeySequence>& shortcuts)
.
pub unsafe fn set_shortcuts_standard_key(&self, arg1: StandardKey)
[src]
Sets a platform dependent list of shortcuts based on the key. The result of calling this function will depend on the currently running platform. Note that more than one shortcut can assigned by this action. If only the primary shortcut is required, use setShortcut instead.
Calls C++ function: void QAction::setShortcuts(QKeySequence::StandardKey arg1)
.
Sets a platform dependent list of shortcuts based on the key. The result of calling this function will depend on the currently running platform. Note that more than one shortcut can assigned by this action. If only the primary shortcut is required, use setShortcut instead.
This function was introduced in Qt 4.2.
See also QKeySequence::keyBindings().
pub unsafe fn set_status_tip(&self, status_tip: impl CastInto<Ref<QString>>)
[src]
This property holds the action's status tip
Calls C++ function: void QAction::setStatusTip(const QString& statusTip)
.
This property holds the action's status tip
The status tip is displayed on all status bars provided by the action's top-level parent widget.
By default, this property contains an empty string.
Access functions:
QString | statusTip() const |
void | setStatusTip(const QString &statusTip) |
Notifier signal:
void | changed() |
See also setToolTip() and showStatusText().
pub unsafe fn set_text(&self, text: impl CastInto<Ref<QString>>)
[src]
This property holds the action's descriptive text
Calls C++ function: void QAction::setText(const QString& text)
.
This property holds the action's descriptive text
If the action is added to a menu, the menu option will consist of the icon (if there is one), the text, and the shortcut (if there is one). If the text is not explicitly set in the constructor, or by using setText(), the action's description icon text will be used as text. There is no default text.
Access functions:
QString | text() const |
void | setText(const QString &text) |
Notifier signal:
void | changed() |
See also iconText.
pub unsafe fn set_tool_tip(&self, tip: impl CastInto<Ref<QString>>)
[src]
This property holds the action's tooltip
Calls C++ function: void QAction::setToolTip(const QString& tip)
.
This property holds the action's tooltip
This text is used for the tooltip. If no tooltip is specified, the action's text is used.
By default, this property contains the action's text.
Access functions:
QString | toolTip() const |
void | setToolTip(const QString &tip) |
Notifier signal:
void | changed() |
See also setStatusTip() and setShortcut().
pub unsafe fn set_visible(&self, arg1: bool)
[src]
This property holds whether the action can be seen (e.g. in menus and toolbars)
Calls C++ function: [slot] void QAction::setVisible(bool arg1)
.
This property holds whether the action can be seen (e.g. in menus and toolbars)
If visible is true the action can be seen (e.g. in menus and toolbars) and chosen by the user; if visible is false the action cannot be seen or chosen by the user.
Actions which are not visible are not grayed out; they do not appear at all.
By default, this property is true
(actions are visible).
Access functions:
bool | isVisible() const |
void | setVisible(bool) |
Notifier signal:
void | changed() |
pub unsafe fn set_whats_this(&self, what: impl CastInto<Ref<QString>>)
[src]
This property holds the action's "What's This?" help text
Calls C++ function: void QAction::setWhatsThis(const QString& what)
.
This property holds the action's "What's This?" help text
The "What's This?" text is used to provide a brief description of the action. The text may contain rich text. There is no default "What's This?" text.
Access functions:
QString | whatsThis() const |
void | setWhatsThis(const QString &what) |
Notifier signal:
void | changed() |
See also QWhatsThis.
pub unsafe fn shortcut(&self) -> CppBox<QKeySequence>
[src]
This property holds the action's primary shortcut key
Calls C++ function: QKeySequence QAction::shortcut() const
.
This property holds the action's primary shortcut key
Valid keycodes for this property can be found in Qt::Key and Qt::Modifier. There is no default shortcut key.
Access functions:
QKeySequence | shortcut() const |
void | setShortcut(const QKeySequence &shortcut) |
Notifier signal:
void | changed() |
pub unsafe fn shortcut_context(&self) -> ShortcutContext
[src]
This property holds the context for the action's shortcut
Calls C++ function: Qt::ShortcutContext QAction::shortcutContext() const
.
This property holds the context for the action's shortcut
Valid values for this property can be found in Qt::ShortcutContext. The default value is Qt::WindowShortcut.
Access functions:
Qt::ShortcutContext | shortcutContext() const |
void | setShortcutContext(Qt::ShortcutContext context) |
Notifier signal:
void | changed() |
pub unsafe fn shortcuts(&self) -> CppBox<QListOfQKeySequence>
[src]
Returns the list of shortcuts, with the primary shortcut as the first element of the list.
Calls C++ function: QList<QKeySequence> QAction::shortcuts() const
.
Returns the list of shortcuts, with the primary shortcut as the first element of the list.
This function was introduced in Qt 4.2.
See also setShortcuts().
pub unsafe fn show_status_text_1a(
&self,
widget: impl CastInto<Ptr<QWidget>>
) -> bool
[src]
&self,
widget: impl CastInto<Ptr<QWidget>>
) -> bool
Updates the relevant status bar for the widget specified by sending a QStatusTipEvent to its parent widget. Returns true
if an event was sent; otherwise returns false
.
Calls C++ function: bool QAction::showStatusText(QWidget* widget = …)
.
Updates the relevant status bar for the widget specified by sending a QStatusTipEvent to its parent widget. Returns true
if an event was sent; otherwise returns false
.
If a null widget is specified, the event is sent to the action's parent.
See also statusTip.
pub unsafe fn show_status_text_0a(&self) -> bool
[src]
Updates the relevant status bar for the widget specified by sending a QStatusTipEvent to its parent widget. Returns true
if an event was sent; otherwise returns false
.
Calls C++ function: bool QAction::showStatusText()
.
Updates the relevant status bar for the widget specified by sending a QStatusTipEvent to its parent widget. Returns true
if an event was sent; otherwise returns false
.
If a null widget is specified, the event is sent to the action's parent.
See also statusTip.
pub unsafe fn static_meta_object() -> Ref<QMetaObject>
[src]
Returns a reference to the staticMetaObject
field.
pub unsafe fn status_tip(&self) -> CppBox<QString>
[src]
This property holds the action's status tip
Calls C++ function: QString QAction::statusTip() const
.
This property holds the action's status tip
The status tip is displayed on all status bars provided by the action's top-level parent widget.
By default, this property contains an empty string.
Access functions:
QString | statusTip() const |
void | setStatusTip(const QString &statusTip) |
Notifier signal:
void | changed() |
See also setToolTip() and showStatusText().
pub unsafe fn text(&self) -> CppBox<QString>
[src]
This property holds the action's descriptive text
Calls C++ function: QString QAction::text() const
.
This property holds the action's descriptive text
If the action is added to a menu, the menu option will consist of the icon (if there is one), the text, and the shortcut (if there is one). If the text is not explicitly set in the constructor, or by using setText(), the action's description icon text will be used as text. There is no default text.
Access functions:
QString | text() const |
void | setText(const QString &text) |
Notifier signal:
void | changed() |
See also iconText.
pub unsafe fn toggle(&self)
[src]
This is a convenience function for the checked property. Connect to it to change the checked state to its opposite state.
Calls C++ function: [slot] void QAction::toggle()
.
This is a convenience function for the checked property. Connect to it to change the checked state to its opposite state.
pub unsafe fn tool_tip(&self) -> CppBox<QString>
[src]
This property holds the action's tooltip
Calls C++ function: QString QAction::toolTip() const
.
This property holds the action's tooltip
This text is used for the tooltip. If no tooltip is specified, the action's text is used.
By default, this property contains the action's text.
Access functions:
QString | toolTip() const |
void | setToolTip(const QString &tip) |
Notifier signal:
void | changed() |
See also setStatusTip() and setShortcut().
pub unsafe fn tr(
s: *const c_char,
c: *const c_char,
n: c_int
) -> CppBox<QString>
[src]
s: *const c_char,
c: *const c_char,
n: c_int
) -> CppBox<QString>
Calls C++ function: static QString QAction::tr(const char* s, const char* c, int n)
.
pub unsafe fn tr_utf8(
s: *const c_char,
c: *const c_char,
n: c_int
) -> CppBox<QString>
[src]
s: *const c_char,
c: *const c_char,
n: c_int
) -> CppBox<QString>
Calls C++ function: static QString QAction::trUtf8(const char* s, const char* c, int n)
.
pub unsafe fn trigger(&self)
[src]
This is a convenience slot that calls activate(Trigger).
Calls C++ function: [slot] void QAction::trigger()
.
This is a convenience slot that calls activate(Trigger).
pub unsafe fn whats_this(&self) -> CppBox<QString>
[src]
This property holds the action's "What's This?" help text
Calls C++ function: QString QAction::whatsThis() const
.
This property holds the action's "What's This?" help text
The "What's This?" text is used to provide a brief description of the action. The text may contain rich text. There is no default "What's This?" text.
Access functions:
QString | whatsThis() const |
void | setWhatsThis(const QString &what) |
Notifier signal:
void | changed() |
See also QWhatsThis.
Trait Implementations
impl CppDeletable for QAction
[src]
unsafe fn delete(&self)
[src]
Destroys the object and frees allocated resources.
Calls C++ function: virtual [destructor] void QAction::~QAction()
.
Destroys the object and frees allocated resources.
impl Deref for QAction
[src]
type Target = QObject
The resulting type after dereferencing.
fn deref(&self) -> &QObject
[src]
Calls C++ function: QObject* static_cast<QObject*>(QAction* ptr)
.
impl DynamicCast<QAction> for QObject
[src]
unsafe fn dynamic_cast(ptr: Ptr<QObject>) -> Ptr<QAction>
[src]
Calls C++ function: QAction* dynamic_cast<QAction*>(QObject* ptr)
.
impl DynamicCast<QWidgetAction> for QAction
[src]
unsafe fn dynamic_cast(ptr: Ptr<QAction>) -> Ptr<QWidgetAction>
[src]
Calls C++ function: QWidgetAction* dynamic_cast<QWidgetAction*>(QAction* ptr)
.
impl StaticDowncast<QAction> for QObject
[src]
unsafe fn static_downcast(ptr: Ptr<QObject>) -> Ptr<QAction>
[src]
Calls C++ function: QAction* static_cast<QAction*>(QObject* ptr)
.
impl StaticDowncast<QWidgetAction> for QAction
[src]
unsafe fn static_downcast(ptr: Ptr<QAction>) -> Ptr<QWidgetAction>
[src]
Calls C++ function: QWidgetAction* static_cast<QWidgetAction*>(QAction* ptr)
.
impl StaticUpcast<QAction> for QWidgetAction
[src]
unsafe fn static_upcast(ptr: Ptr<QWidgetAction>) -> Ptr<QAction>
[src]
Calls C++ function: QAction* static_cast<QAction*>(QWidgetAction* ptr)
.
impl StaticUpcast<QObject> for QAction
[src]
Auto Trait Implementations
impl RefUnwindSafe for QAction
impl Send for QAction
impl Sync for QAction
impl Unpin for QAction
impl UnwindSafe for QAction
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> CastInto<U> for T where
U: CastFrom<T>,
[src]
U: CastFrom<T>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> StaticUpcast<T> for T
[src]
unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,