[][src]Struct qt_widgets::QToolButton

#[repr(C)]
pub struct QToolButton { /* fields omitted */ }

The QToolButton class provides a quick-access button to commands or options, usually used inside a QToolBar.

C++ class: QToolButton.

C++ documentation:

The QToolButton class provides a quick-access button to commands or options, usually used inside a QToolBar.

A tool button is a special button that provides quick-access to specific commands or options. As opposed to a normal command button, a tool button usually doesn't show a text label, but shows an icon instead.

Tool buttons are normally created when new QAction instances are created with QToolBar::addAction() or existing actions are added to a toolbar with QToolBar::addAction(). It is also possible to construct tool buttons in the same way as any other widget, and arrange them alongside other widgets in layouts.

One classic use of a tool button is to select tools; for example, the "pen" tool in a drawing program. This would be implemented by using a QToolButton as a toggle button (see setCheckable()).

QToolButton supports auto-raising. In auto-raise mode, the button draws a 3D frame only when the mouse points at it. The feature is automatically turned on when a button is used inside a QToolBar. Change it with setAutoRaise().

A tool button's icon is set as QIcon. This makes it possible to specify different pixmaps for the disabled and active state. The disabled pixmap is used when the button's functionality is not available. The active pixmap is displayed when the button is auto-raised because the mouse pointer is hovering over it.

The button's look and dimension is adjustable with setToolButtonStyle() and setIconSize(). When used inside a QToolBar in a QMainWindow, the button automatically adjusts to QMainWindow's settings (see QMainWindow::setToolButtonStyle() and QMainWindow::setIconSize()). Instead of an icon, a tool button can also display an arrow symbol, specified with arrowType.

A tool button can offer additional choices in a popup menu. The popup menu can be set using setMenu(). Use setPopupMode() to configure the different modes available for tool buttons with a menu set. The default mode is DelayedPopupMode which is sometimes used with the "Back" button in a web browser. After pressing and holding the button down for a while, a menu pops up showing a list of possible pages to jump to. The timeout is style dependent, see QStyle::SH_ToolButton_PopupDelay.

Qt Assistant's toolbar with tool buttons
Qt Assistant's toolbar contains tool buttons that are associated with actions used in other parts of the main window.

Methods

impl QToolButton[src]

pub fn slot_show_menu(&self) -> Receiver<()>[src]

Shows (pops up) the associated popup menu. If there is no such menu, this function does nothing. This function does not return until the popup menu has been closed by the user.

Returns a built-in Qt slot QToolButton::showMenu that can be passed to qt_core::Signal::connect.

C++ documentation:

Shows (pops up) the associated popup menu. If there is no such menu, this function does nothing. This function does not return until the popup menu has been closed by the user.

pub fn slot_set_tool_button_style(&self) -> Receiver<(ToolButtonStyle,)>[src]

This property holds whether the tool button displays an icon only, text only, or text beside/below the icon.

Returns a built-in Qt slot QToolButton::setToolButtonStyle that can be passed to qt_core::Signal::connect.

C++ documentation:

This property holds whether the tool button displays an icon only, text only, or text beside/below the icon.

The default is Qt::ToolButtonIconOnly.

To have the style of toolbuttons follow the system settings, set this property to Qt::ToolButtonFollowStyle. On Unix, the user settings from the desktop environment will be used. On other platforms, Qt::ToolButtonFollowStyle means icon only.

QToolButton automatically connects this slot to the relevant signal in the QMainWindow in which is resides.

Access functions:

Qt::ToolButtonStyle toolButtonStyle() const
void setToolButtonStyle(Qt::ToolButtonStyle style)

pub fn slot_set_default_action(&self) -> Receiver<(*mut QAction,)>[src]

Sets the default action to action.

Returns a built-in Qt slot QToolButton::setDefaultAction that can be passed to qt_core::Signal::connect.

C++ documentation:

Sets the default action to action.

If a tool button has a default action, the action defines the button's properties like text, icon, tool tip, etc.

See also defaultAction().

pub fn triggered(&self) -> Signal<(*mut QAction,)>[src]

This signal is emitted when the given action is triggered.

Returns a built-in Qt signal QToolButton::triggered that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted when the given action is triggered.

The action may also be associated with other parts of the user interface, such as menu items and keyboard shortcuts. Sharing actions in this way helps make the user interface more consistent and is often less work to implement.

pub unsafe fn arrow_type(&self) -> ArrowType[src]

This property holds whether the button displays an arrow instead of a normal icon

Calls C++ function: Qt::ArrowType QToolButton::arrowType() const.

C++ documentation:

This property holds whether the button displays an arrow instead of a normal icon

This displays an arrow as the icon for the QToolButton.

By default, this property is set to Qt::NoArrow.

Access functions:

Qt::ArrowType arrowType() const
void setArrowType(Qt::ArrowType type)

pub unsafe fn auto_raise(&self) -> bool[src]

This property holds whether auto-raising is enabled or not.

Calls C++ function: bool QToolButton::autoRaise() const.

C++ documentation:

This property holds whether auto-raising is enabled or not.

The default is disabled (i.e. false).

This property is currently ignored on macOS when using QMacStyle.

Access functions:

bool autoRaise() const
void setAutoRaise(bool enable)

pub unsafe fn default_action(&self) -> MutPtr<QAction>[src]

Returns the default action.

Calls C++ function: QAction* QToolButton::defaultAction() const.

C++ documentation:

Returns the default action.

See also setDefaultAction().

pub unsafe fn menu(&self) -> MutPtr<QMenu>[src]

Returns the associated menu, or 0 if no menu has been defined.

Calls C++ function: QMenu* QToolButton::menu() const.

C++ documentation:

Returns the associated menu, or 0 if no menu has been defined.

See also setMenu().

pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>[src]

Calls C++ function: virtual const QMetaObject* QToolButton::metaObject() const.

pub unsafe fn minimum_size_hint(&self) -> CppBox<QSize>[src]

Reimplemented from QWidget::minimumSizeHint().

Calls C++ function: virtual QSize QToolButton::minimumSizeHint() const.

C++ documentation:

Reimplemented from QWidget::minimumSizeHint().

pub unsafe fn new_1a(
    parent: impl CastInto<MutPtr<QWidget>>
) -> CppBox<QToolButton>
[src]

Constructs an empty tool button with parent parent.

Calls C++ function: [constructor] void QToolButton::QToolButton(QWidget* parent = …).

C++ documentation:

Constructs an empty tool button with parent parent.

pub unsafe fn new_0a() -> CppBox<QToolButton>[src]

The QToolButton class provides a quick-access button to commands or options, usually used inside a QToolBar.

Calls C++ function: [constructor] void QToolButton::QToolButton().

C++ documentation:

The QToolButton class provides a quick-access button to commands or options, usually used inside a QToolBar.

A tool button is a special button that provides quick-access to specific commands or options. As opposed to a normal command button, a tool button usually doesn't show a text label, but shows an icon instead.

Tool buttons are normally created when new QAction instances are created with QToolBar::addAction() or existing actions are added to a toolbar with QToolBar::addAction(). It is also possible to construct tool buttons in the same way as any other widget, and arrange them alongside other widgets in layouts.

One classic use of a tool button is to select tools; for example, the "pen" tool in a drawing program. This would be implemented by using a QToolButton as a toggle button (see setCheckable()).

QToolButton supports auto-raising. In auto-raise mode, the button draws a 3D frame only when the mouse points at it. The feature is automatically turned on when a button is used inside a QToolBar. Change it with setAutoRaise().

A tool button's icon is set as QIcon. This makes it possible to specify different pixmaps for the disabled and active state. The disabled pixmap is used when the button's functionality is not available. The active pixmap is displayed when the button is auto-raised because the mouse pointer is hovering over it.

The button's look and dimension is adjustable with setToolButtonStyle() and setIconSize(). When used inside a QToolBar in a QMainWindow, the button automatically adjusts to QMainWindow's settings (see QMainWindow::setToolButtonStyle() and QMainWindow::setIconSize()). Instead of an icon, a tool button can also display an arrow symbol, specified with arrowType.

A tool button can offer additional choices in a popup menu. The popup menu can be set using setMenu(). Use setPopupMode() to configure the different modes available for tool buttons with a menu set. The default mode is DelayedPopupMode which is sometimes used with the "Back" button in a web browser. After pressing and holding the button down for a while, a menu pops up showing a list of possible pages to jump to. The timeout is style dependent, see QStyle::SH_ToolButton_PopupDelay.

Qt Assistant's toolbar with tool buttons
Qt Assistant's toolbar contains tool buttons that are associated with actions used in other parts of the main window.

pub unsafe fn popup_mode(&self) -> ToolButtonPopupMode[src]

describes the way that popup menus are used with tool buttons

Calls C++ function: QToolButton::ToolButtonPopupMode QToolButton::popupMode() const.

C++ documentation:

describes the way that popup menus are used with tool buttons

By default, this property is set to DelayedPopup.

Access functions:

ToolButtonPopupMode popupMode() const
void setPopupMode(ToolButtonPopupMode mode)

pub unsafe fn qt_metacall(
    &mut self,
    arg1: Call,
    arg2: c_int,
    arg3: impl CastInto<MutPtr<*mut c_void>>
) -> c_int
[src]

Calls C++ function: virtual int QToolButton::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3).

pub unsafe fn qt_metacast(
    &mut self,
    arg1: impl CastInto<Ptr<c_char>>
) -> MutPtr<c_void>
[src]

Calls C++ function: virtual void* QToolButton::qt_metacast(const char* arg1).

pub unsafe fn set_arrow_type(&mut self, type_: ArrowType)[src]

This property holds whether the button displays an arrow instead of a normal icon

Calls C++ function: void QToolButton::setArrowType(Qt::ArrowType type).

C++ documentation:

This property holds whether the button displays an arrow instead of a normal icon

This displays an arrow as the icon for the QToolButton.

By default, this property is set to Qt::NoArrow.

Access functions:

Qt::ArrowType arrowType() const
void setArrowType(Qt::ArrowType type)

pub unsafe fn set_auto_raise(&mut self, enable: bool)[src]

This property holds whether auto-raising is enabled or not.

Calls C++ function: void QToolButton::setAutoRaise(bool enable).

C++ documentation:

This property holds whether auto-raising is enabled or not.

The default is disabled (i.e. false).

This property is currently ignored on macOS when using QMacStyle.

Access functions:

bool autoRaise() const
void setAutoRaise(bool enable)

pub unsafe fn set_default_action(
    &mut self,
    arg1: impl CastInto<MutPtr<QAction>>
)
[src]

Sets the default action to action.

Calls C++ function: [slot] void QToolButton::setDefaultAction(QAction* arg1).

C++ documentation:

Sets the default action to action.

If a tool button has a default action, the action defines the button's properties like text, icon, tool tip, etc.

See also defaultAction().

pub unsafe fn set_menu(&mut self, menu: impl CastInto<MutPtr<QMenu>>)[src]

Associates the given menu with this tool button.

Calls C++ function: void QToolButton::setMenu(QMenu* menu).

C++ documentation:

Associates the given menu with this tool button.

The menu will be shown according to the button's popupMode.

Ownership of the menu is not transferred to the tool button.

See also menu().

pub unsafe fn set_popup_mode(&mut self, mode: ToolButtonPopupMode)[src]

describes the way that popup menus are used with tool buttons

Calls C++ function: void QToolButton::setPopupMode(QToolButton::ToolButtonPopupMode mode).

C++ documentation:

describes the way that popup menus are used with tool buttons

By default, this property is set to DelayedPopup.

Access functions:

ToolButtonPopupMode popupMode() const
void setPopupMode(ToolButtonPopupMode mode)

pub unsafe fn set_tool_button_style(&mut self, style: ToolButtonStyle)[src]

This property holds whether the tool button displays an icon only, text only, or text beside/below the icon.

Calls C++ function: [slot] void QToolButton::setToolButtonStyle(Qt::ToolButtonStyle style).

C++ documentation:

This property holds whether the tool button displays an icon only, text only, or text beside/below the icon.

The default is Qt::ToolButtonIconOnly.

To have the style of toolbuttons follow the system settings, set this property to Qt::ToolButtonFollowStyle. On Unix, the user settings from the desktop environment will be used. On other platforms, Qt::ToolButtonFollowStyle means icon only.

QToolButton automatically connects this slot to the relevant signal in the QMainWindow in which is resides.

Access functions:

Qt::ToolButtonStyle toolButtonStyle() const
void setToolButtonStyle(Qt::ToolButtonStyle style)

pub unsafe fn show_menu(&mut self)[src]

Shows (pops up) the associated popup menu. If there is no such menu, this function does nothing. This function does not return until the popup menu has been closed by the user.

Calls C++ function: [slot] void QToolButton::showMenu().

C++ documentation:

Shows (pops up) the associated popup menu. If there is no such menu, this function does nothing. This function does not return until the popup menu has been closed by the user.

pub unsafe fn size_hint(&self) -> CppBox<QSize>[src]

Reimplemented from QWidget::sizeHint().

Calls C++ function: virtual QSize QToolButton::sizeHint() const.

C++ documentation:

Reimplemented from QWidget::sizeHint().

pub unsafe fn static_meta_object() -> Ref<QMetaObject>[src]

Returns a reference to the staticMetaObject field.

pub unsafe fn tool_button_style(&self) -> ToolButtonStyle[src]

This property holds whether the tool button displays an icon only, text only, or text beside/below the icon.

Calls C++ function: Qt::ToolButtonStyle QToolButton::toolButtonStyle() const.

C++ documentation:

This property holds whether the tool button displays an icon only, text only, or text beside/below the icon.

The default is Qt::ToolButtonIconOnly.

To have the style of toolbuttons follow the system settings, set this property to Qt::ToolButtonFollowStyle. On Unix, the user settings from the desktop environment will be used. On other platforms, Qt::ToolButtonFollowStyle means icon only.

QToolButton automatically connects this slot to the relevant signal in the QMainWindow in which is resides.

Access functions:

Qt::ToolButtonStyle toolButtonStyle() const
void setToolButtonStyle(Qt::ToolButtonStyle style)

pub unsafe fn tr(
    s: impl CastInto<Ptr<c_char>>,
    c: impl CastInto<Ptr<c_char>>,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QToolButton::tr(const char* s, const char* c, int n).

pub unsafe fn tr_utf8(
    s: impl CastInto<Ptr<c_char>>,
    c: impl CastInto<Ptr<c_char>>,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QToolButton::trUtf8(const char* s, const char* c, int n).

Methods from Deref<Target = QAbstractButton>

pub fn slot_set_icon_size(&self) -> Receiver<(*const QSize,)>[src]

This property holds the icon size used for this button.

Returns a built-in Qt slot QAbstractButton::setIconSize that can be passed to qt_core::Signal::connect.

C++ documentation:

This property holds the icon size used for this button.

The default size is defined by the GUI style. This is a maximum size for the icons. Smaller icons will not be scaled up.

Access functions:

QSize iconSize() const
void setIconSize(const QSize &size)

pub fn slot_animate_click(&self) -> Receiver<(c_int,)>[src]

Performs an animated click: the button is pressed immediately, and released msec milliseconds later (the default is 100 ms).

Returns a built-in Qt slot QAbstractButton::animateClick that can be passed to qt_core::Signal::connect.

C++ documentation:

Performs an animated click: the button is pressed immediately, and released msec milliseconds later (the default is 100 ms).

Calling this function again before the button is released resets the release timer.

All signals associated with a click are emitted as appropriate.

This function does nothing if the button is disabled.

See also click().

pub fn slot_click(&self) -> Receiver<()>[src]

Performs a click.

Returns a built-in Qt slot QAbstractButton::click that can be passed to qt_core::Signal::connect.

C++ documentation:

Performs a click.

All the usual signals associated with a click are emitted as appropriate. If the button is checkable, the state of the button is toggled.

This function does nothing if the button is disabled.

See also animateClick().

pub fn slot_toggle(&self) -> Receiver<()>[src]

Toggles the state of a checkable button.

Returns a built-in Qt slot QAbstractButton::toggle that can be passed to qt_core::Signal::connect.

C++ documentation:

Toggles the state of a checkable button.

See also checked.

pub fn slot_set_checked(&self) -> Receiver<(bool,)>[src]

This property holds whether the button is checked

Returns a built-in Qt slot QAbstractButton::setChecked that can be passed to qt_core::Signal::connect.

C++ documentation:

This property holds whether the button is checked

Only checkable buttons can be checked. By default, the button is unchecked.

Access functions:

bool isChecked() const
void setChecked(bool)

Notifier signal:

void toggled(bool checked)

See also checkable.

pub fn pressed(&self) -> Signal<()>[src]

This signal is emitted when the button is pressed down.

Returns a built-in Qt signal QAbstractButton::pressed that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted when the button is pressed down.

See also released() and clicked().

pub fn released(&self) -> Signal<()>[src]

This signal is emitted when the button is released.

Returns a built-in Qt signal QAbstractButton::released that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted when the button is released.

See also pressed(), clicked(), and toggled().

pub fn clicked(&self) -> Signal<(bool,)>[src]

This signal is emitted when the button is activated (i.e., pressed down then released while the mouse cursor is inside the button), when the shortcut key is typed, or when click() or animateClick() is called. Notably, this signal is not emitted if you call setDown(), setChecked() or toggle().

Returns a built-in Qt signal QAbstractButton::clicked that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted when the button is activated (i.e., pressed down then released while the mouse cursor is inside the button), when the shortcut key is typed, or when click() or animateClick() is called. Notably, this signal is not emitted if you call setDown(), setChecked() or toggle().

If the button is checkable, checked is true if the button is checked, or false if the button is unchecked.

See also pressed(), released(), and toggled().

pub fn toggled(&self) -> Signal<(bool,)>[src]

This signal is emitted whenever a checkable button changes its state. checked is true if the button is checked, or false if the button is unchecked.

Returns a built-in Qt signal QAbstractButton::toggled that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted whenever a checkable button changes its state. checked is true if the button is checked, or false if the button is unchecked.

This may be the result of a user action, click() slot activation, or because setChecked() is called.

The states of buttons in exclusive button groups are updated before this signal is emitted. This means that slots can act on either the "off" signal or the "on" signal emitted by the buttons in the group whose states have changed.

For example, a slot that reacts to signals emitted by newly checked buttons but which ignores signals from buttons that have been unchecked can be implemented using the following pattern:

void MyWidget::reactToToggle(bool checked) { if (checked) { // Examine the new button states. ... } }

Button groups can be created using the QButtonGroup class, and updates to the button states monitored with the QButtonGroup::buttonClicked() signal.

Note: Notifier signal for property checked.

See also checked and clicked().

pub unsafe fn animate_click_1a(&mut self, msec: c_int)[src]

Performs an animated click: the button is pressed immediately, and released msec milliseconds later (the default is 100 ms).

Calls C++ function: [slot] void QAbstractButton::animateClick(int msec = …).

C++ documentation:

Performs an animated click: the button is pressed immediately, and released msec milliseconds later (the default is 100 ms).

Calling this function again before the button is released resets the release timer.

All signals associated with a click are emitted as appropriate.

This function does nothing if the button is disabled.

See also click().

pub unsafe fn animate_click_0a(&mut self)[src]

Performs an animated click: the button is pressed immediately, and released msec milliseconds later (the default is 100 ms).

Calls C++ function: [slot] void QAbstractButton::animateClick().

C++ documentation:

Performs an animated click: the button is pressed immediately, and released msec milliseconds later (the default is 100 ms).

Calling this function again before the button is released resets the release timer.

All signals associated with a click are emitted as appropriate.

This function does nothing if the button is disabled.

See also click().

pub unsafe fn auto_exclusive(&self) -> bool[src]

This property holds whether auto-exclusivity is enabled

Calls C++ function: bool QAbstractButton::autoExclusive() const.

C++ documentation:

This property holds whether auto-exclusivity is enabled

If auto-exclusivity is enabled, checkable buttons that belong to the same parent widget behave as if they were part of the same exclusive button group. In an exclusive button group, only one button can be checked at any time; checking another button automatically unchecks the previously checked one.

The property has no effect on buttons that belong to a button group.

autoExclusive is off by default, except for radio buttons.

Access functions:

bool autoExclusive() const
void setAutoExclusive(bool)

See also QRadioButton.

pub unsafe fn auto_repeat(&self) -> bool[src]

This property holds whether autoRepeat is enabled

Calls C++ function: bool QAbstractButton::autoRepeat() const.

C++ documentation:

This property holds whether autoRepeat is enabled

If autoRepeat is enabled, then the pressed(), released(), and clicked() signals are emitted at regular intervals when the button is down. autoRepeat is off by default. The initial delay and the repetition interval are defined in milliseconds by autoRepeatDelay and autoRepeatInterval.

Note: If a button is pressed down by a shortcut key, then auto-repeat is enabled and timed by the system and not by this class. The pressed(), released(), and clicked() signals will be emitted like in the normal case.

Access functions:

bool autoRepeat() const
void setAutoRepeat(bool)

pub unsafe fn auto_repeat_delay(&self) -> c_int[src]

This property holds the initial delay of auto-repetition

Calls C++ function: int QAbstractButton::autoRepeatDelay() const.

C++ documentation:

This property holds the initial delay of auto-repetition

If autoRepeat is enabled, then autoRepeatDelay defines the initial delay in milliseconds before auto-repetition kicks in.

This property was introduced in Qt 4.2.

Access functions:

int autoRepeatDelay() const
void setAutoRepeatDelay(int)

See also autoRepeat and autoRepeatInterval.

pub unsafe fn auto_repeat_interval(&self) -> c_int[src]

This property holds the interval of auto-repetition

Calls C++ function: int QAbstractButton::autoRepeatInterval() const.

C++ documentation:

This property holds the interval of auto-repetition

If autoRepeat is enabled, then autoRepeatInterval defines the length of the auto-repetition interval in millisecons.

This property was introduced in Qt 4.2.

Access functions:

int autoRepeatInterval() const
void setAutoRepeatInterval(int)

See also autoRepeat and autoRepeatDelay.

pub unsafe fn click(&mut self)[src]

Performs a click.

Calls C++ function: [slot] void QAbstractButton::click().

C++ documentation:

Performs a click.

All the usual signals associated with a click are emitted as appropriate. If the button is checkable, the state of the button is toggled.

This function does nothing if the button is disabled.

See also animateClick().

pub unsafe fn group(&self) -> MutPtr<QButtonGroup>[src]

Returns the group that this button belongs to.

Calls C++ function: QButtonGroup* QAbstractButton::group() const.

C++ documentation:

Returns the group that this button belongs to.

If the button is not a member of any QButtonGroup, this function returns 0.

See also QButtonGroup.

pub unsafe fn icon(&self) -> CppBox<QIcon>[src]

This property holds the icon shown on the button

Calls C++ function: QIcon QAbstractButton::icon() const.

C++ documentation:

This property holds the icon shown on the button

The icon's default size is defined by the GUI style, but can be adjusted by setting the iconSize property.

Access functions:

QIcon icon() const
void setIcon(const QIcon &icon)

pub unsafe fn icon_size(&self) -> CppBox<QSize>[src]

This property holds the icon size used for this button.

Calls C++ function: QSize QAbstractButton::iconSize() const.

C++ documentation:

This property holds the icon size used for this button.

The default size is defined by the GUI style. This is a maximum size for the icons. Smaller icons will not be scaled up.

Access functions:

QSize iconSize() const
void setIconSize(const QSize &size)

pub unsafe fn is_checkable(&self) -> bool[src]

This property holds whether the button is checkable

Calls C++ function: bool QAbstractButton::isCheckable() const.

C++ documentation:

This property holds whether the button is checkable

By default, the button is not checkable.

Access functions:

bool isCheckable() const
void setCheckable(bool)

See also checked.

pub unsafe fn is_checked(&self) -> bool[src]

This property holds whether the button is checked

Calls C++ function: bool QAbstractButton::isChecked() const.

C++ documentation:

This property holds whether the button is checked

Only checkable buttons can be checked. By default, the button is unchecked.

Access functions:

bool isChecked() const
void setChecked(bool)

Notifier signal:

void toggled(bool checked)

See also checkable.

pub unsafe fn is_down(&self) -> bool[src]

This property holds whether the button is pressed down

Calls C++ function: bool QAbstractButton::isDown() const.

C++ documentation:

This property holds whether the button is pressed down

If this property is true, the button is pressed down. The signals pressed() and clicked() are not emitted if you set this property to true. The default is false.

Access functions:

bool isDown() const
void setDown(bool)

pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>[src]

Calls C++ function: virtual const QMetaObject* QAbstractButton::metaObject() const.

pub unsafe fn qt_metacall(
    &mut self,
    arg1: Call,
    arg2: c_int,
    arg3: impl CastInto<MutPtr<*mut c_void>>
) -> c_int
[src]

Calls C++ function: virtual int QAbstractButton::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3).

pub unsafe fn qt_metacast(
    &mut self,
    arg1: impl CastInto<Ptr<c_char>>
) -> MutPtr<c_void>
[src]

Calls C++ function: virtual void* QAbstractButton::qt_metacast(const char* arg1).

pub unsafe fn set_auto_exclusive(&mut self, arg1: bool)[src]

This property holds whether auto-exclusivity is enabled

Calls C++ function: void QAbstractButton::setAutoExclusive(bool arg1).

C++ documentation:

This property holds whether auto-exclusivity is enabled

If auto-exclusivity is enabled, checkable buttons that belong to the same parent widget behave as if they were part of the same exclusive button group. In an exclusive button group, only one button can be checked at any time; checking another button automatically unchecks the previously checked one.

The property has no effect on buttons that belong to a button group.

autoExclusive is off by default, except for radio buttons.

Access functions:

bool autoExclusive() const
void setAutoExclusive(bool)

See also QRadioButton.

pub unsafe fn set_auto_repeat(&mut self, arg1: bool)[src]

This property holds whether autoRepeat is enabled

Calls C++ function: void QAbstractButton::setAutoRepeat(bool arg1).

C++ documentation:

This property holds whether autoRepeat is enabled

If autoRepeat is enabled, then the pressed(), released(), and clicked() signals are emitted at regular intervals when the button is down. autoRepeat is off by default. The initial delay and the repetition interval are defined in milliseconds by autoRepeatDelay and autoRepeatInterval.

Note: If a button is pressed down by a shortcut key, then auto-repeat is enabled and timed by the system and not by this class. The pressed(), released(), and clicked() signals will be emitted like in the normal case.

Access functions:

bool autoRepeat() const
void setAutoRepeat(bool)

pub unsafe fn set_auto_repeat_delay(&mut self, arg1: c_int)[src]

This property holds the initial delay of auto-repetition

Calls C++ function: void QAbstractButton::setAutoRepeatDelay(int arg1).

C++ documentation:

This property holds the initial delay of auto-repetition

If autoRepeat is enabled, then autoRepeatDelay defines the initial delay in milliseconds before auto-repetition kicks in.

This property was introduced in Qt 4.2.

Access functions:

int autoRepeatDelay() const
void setAutoRepeatDelay(int)

See also autoRepeat and autoRepeatInterval.

pub unsafe fn set_auto_repeat_interval(&mut self, arg1: c_int)[src]

This property holds the interval of auto-repetition

Calls C++ function: void QAbstractButton::setAutoRepeatInterval(int arg1).

C++ documentation:

This property holds the interval of auto-repetition

If autoRepeat is enabled, then autoRepeatInterval defines the length of the auto-repetition interval in millisecons.

This property was introduced in Qt 4.2.

Access functions:

int autoRepeatInterval() const
void setAutoRepeatInterval(int)

See also autoRepeat and autoRepeatDelay.

pub unsafe fn set_checkable(&mut self, arg1: bool)[src]

This property holds whether the button is checkable

Calls C++ function: void QAbstractButton::setCheckable(bool arg1).

C++ documentation:

This property holds whether the button is checkable

By default, the button is not checkable.

Access functions:

bool isCheckable() const
void setCheckable(bool)

See also checked.

pub unsafe fn set_checked(&mut self, arg1: bool)[src]

This property holds whether the button is checked

Calls C++ function: [slot] void QAbstractButton::setChecked(bool arg1).

C++ documentation:

This property holds whether the button is checked

Only checkable buttons can be checked. By default, the button is unchecked.

Access functions:

bool isChecked() const
void setChecked(bool)

Notifier signal:

void toggled(bool checked)

See also checkable.

pub unsafe fn set_down(&mut self, arg1: bool)[src]

This property holds whether the button is pressed down

Calls C++ function: void QAbstractButton::setDown(bool arg1).

C++ documentation:

This property holds whether the button is pressed down

If this property is true, the button is pressed down. The signals pressed() and clicked() are not emitted if you set this property to true. The default is false.

Access functions:

bool isDown() const
void setDown(bool)

pub unsafe fn set_icon(&mut self, icon: impl CastInto<Ref<QIcon>>)[src]

This property holds the icon shown on the button

Calls C++ function: void QAbstractButton::setIcon(const QIcon& icon).

C++ documentation:

This property holds the icon shown on the button

The icon's default size is defined by the GUI style, but can be adjusted by setting the iconSize property.

Access functions:

QIcon icon() const
void setIcon(const QIcon &icon)

pub unsafe fn set_icon_size(&mut self, size: impl CastInto<Ref<QSize>>)[src]

This property holds the icon size used for this button.

Calls C++ function: [slot] void QAbstractButton::setIconSize(const QSize& size).

C++ documentation:

This property holds the icon size used for this button.

The default size is defined by the GUI style. This is a maximum size for the icons. Smaller icons will not be scaled up.

Access functions:

QSize iconSize() const
void setIconSize(const QSize &size)

pub unsafe fn set_shortcut(&mut self, key: impl CastInto<Ref<QKeySequence>>)[src]

This property holds the mnemonic associated with the button

Calls C++ function: void QAbstractButton::setShortcut(const QKeySequence& key).

C++ documentation:

This property holds the mnemonic associated with the button

Access functions:

QKeySequence shortcut() const
void setShortcut(const QKeySequence &key)

pub unsafe fn set_text(&mut self, text: impl CastInto<Ref<QString>>)[src]

This property holds the text shown on the button

Calls C++ function: void QAbstractButton::setText(const QString& text).

C++ documentation:

This property holds the text shown on the button

If the button has no text, the text() function will return an empty string.

If the text contains an ampersand character ('&'), a shortcut is automatically created for it. The character that follows the '&' will be used as the shortcut key. Any previous shortcut will be overwritten or cleared if no shortcut is defined by the text. See the QShortcut documentation for details. To display an actual ampersand, use '&&'.

There is no default text.

Access functions:

QString text() const
void setText(const QString &text)

pub unsafe fn shortcut(&self) -> CppBox<QKeySequence>[src]

This property holds the mnemonic associated with the button

Calls C++ function: QKeySequence QAbstractButton::shortcut() const.

C++ documentation:

This property holds the mnemonic associated with the button

Access functions:

QKeySequence shortcut() const
void setShortcut(const QKeySequence &key)

pub unsafe fn text(&self) -> CppBox<QString>[src]

This property holds the text shown on the button

Calls C++ function: QString QAbstractButton::text() const.

C++ documentation:

This property holds the text shown on the button

If the button has no text, the text() function will return an empty string.

If the text contains an ampersand character ('&'), a shortcut is automatically created for it. The character that follows the '&' will be used as the shortcut key. Any previous shortcut will be overwritten or cleared if no shortcut is defined by the text. See the QShortcut documentation for details. To display an actual ampersand, use '&&'.

There is no default text.

Access functions:

QString text() const
void setText(const QString &text)

pub unsafe fn toggle(&mut self)[src]

Toggles the state of a checkable button.

Calls C++ function: [slot] void QAbstractButton::toggle().

C++ documentation:

Toggles the state of a checkable button.

See also checked.

Trait Implementations

impl CppDeletable for QToolButton[src]

unsafe fn delete(&mut self)[src]

Destroys the object and frees any allocated resources.

Calls C++ function: virtual [destructor] void QToolButton::~QToolButton().

C++ documentation:

Destroys the object and frees any allocated resources.

impl Deref for QToolButton[src]

type Target = QAbstractButton

The resulting type after dereferencing.

fn deref(&self) -> &QAbstractButton[src]

Calls C++ function: QAbstractButton* static_cast<QAbstractButton*>(QToolButton* ptr).

impl DerefMut for QToolButton[src]

fn deref_mut(&mut self) -> &mut QAbstractButton[src]

Calls C++ function: QAbstractButton* static_cast<QAbstractButton*>(QToolButton* ptr).

impl DynamicCast<QToolButton> for QAbstractButton[src]

unsafe fn dynamic_cast(ptr: Ptr<QAbstractButton>) -> Ptr<QToolButton>[src]

Calls C++ function: QToolButton* dynamic_cast<QToolButton*>(QAbstractButton* ptr).

unsafe fn dynamic_cast_mut(ptr: MutPtr<QAbstractButton>) -> MutPtr<QToolButton>[src]

Calls C++ function: QToolButton* dynamic_cast<QToolButton*>(QAbstractButton* ptr).

impl DynamicCast<QToolButton> for QWidget[src]

unsafe fn dynamic_cast(ptr: Ptr<QWidget>) -> Ptr<QToolButton>[src]

Calls C++ function: QToolButton* dynamic_cast<QToolButton*>(QWidget* ptr).

unsafe fn dynamic_cast_mut(ptr: MutPtr<QWidget>) -> MutPtr<QToolButton>[src]

Calls C++ function: QToolButton* dynamic_cast<QToolButton*>(QWidget* ptr).

impl DynamicCast<QToolButton> for QObject[src]

unsafe fn dynamic_cast(ptr: Ptr<QObject>) -> Ptr<QToolButton>[src]

Calls C++ function: QToolButton* dynamic_cast<QToolButton*>(QObject* ptr).

unsafe fn dynamic_cast_mut(ptr: MutPtr<QObject>) -> MutPtr<QToolButton>[src]

Calls C++ function: QToolButton* dynamic_cast<QToolButton*>(QObject* ptr).

impl DynamicCast<QToolButton> for QPaintDevice[src]

unsafe fn dynamic_cast(ptr: Ptr<QPaintDevice>) -> Ptr<QToolButton>[src]

Calls C++ function: QToolButton* dynamic_cast<QToolButton*>(QPaintDevice* ptr).

unsafe fn dynamic_cast_mut(ptr: MutPtr<QPaintDevice>) -> MutPtr<QToolButton>[src]

Calls C++ function: QToolButton* dynamic_cast<QToolButton*>(QPaintDevice* ptr).

impl StaticDowncast<QToolButton> for QAbstractButton[src]

unsafe fn static_downcast(ptr: Ptr<QAbstractButton>) -> Ptr<QToolButton>[src]

Calls C++ function: QToolButton* static_cast<QToolButton*>(QAbstractButton* ptr).

unsafe fn static_downcast_mut(
    ptr: MutPtr<QAbstractButton>
) -> MutPtr<QToolButton>
[src]

Calls C++ function: QToolButton* static_cast<QToolButton*>(QAbstractButton* ptr).

impl StaticDowncast<QToolButton> for QWidget[src]

unsafe fn static_downcast(ptr: Ptr<QWidget>) -> Ptr<QToolButton>[src]

Calls C++ function: QToolButton* static_cast<QToolButton*>(QWidget* ptr).

unsafe fn static_downcast_mut(ptr: MutPtr<QWidget>) -> MutPtr<QToolButton>[src]

Calls C++ function: QToolButton* static_cast<QToolButton*>(QWidget* ptr).

impl StaticDowncast<QToolButton> for QObject[src]

unsafe fn static_downcast(ptr: Ptr<QObject>) -> Ptr<QToolButton>[src]

Calls C++ function: QToolButton* static_cast<QToolButton*>(QObject* ptr).

unsafe fn static_downcast_mut(ptr: MutPtr<QObject>) -> MutPtr<QToolButton>[src]

Calls C++ function: QToolButton* static_cast<QToolButton*>(QObject* ptr).

impl StaticDowncast<QToolButton> for QPaintDevice[src]

unsafe fn static_downcast(ptr: Ptr<QPaintDevice>) -> Ptr<QToolButton>[src]

Calls C++ function: QToolButton* static_cast<QToolButton*>(QPaintDevice* ptr).

unsafe fn static_downcast_mut(ptr: MutPtr<QPaintDevice>) -> MutPtr<QToolButton>[src]

Calls C++ function: QToolButton* static_cast<QToolButton*>(QPaintDevice* ptr).

impl StaticUpcast<QAbstractButton> for QToolButton[src]

unsafe fn static_upcast(ptr: Ptr<QToolButton>) -> Ptr<QAbstractButton>[src]

Calls C++ function: QAbstractButton* static_cast<QAbstractButton*>(QToolButton* ptr).

unsafe fn static_upcast_mut(ptr: MutPtr<QToolButton>) -> MutPtr<QAbstractButton>[src]

Calls C++ function: QAbstractButton* static_cast<QAbstractButton*>(QToolButton* ptr).

impl StaticUpcast<QObject> for QToolButton[src]

unsafe fn static_upcast(ptr: Ptr<QToolButton>) -> Ptr<QObject>[src]

Calls C++ function: QObject* static_cast<QObject*>(QToolButton* ptr).

unsafe fn static_upcast_mut(ptr: MutPtr<QToolButton>) -> MutPtr<QObject>[src]

Calls C++ function: QObject* static_cast<QObject*>(QToolButton* ptr).

impl StaticUpcast<QPaintDevice> for QToolButton[src]

unsafe fn static_upcast(ptr: Ptr<QToolButton>) -> Ptr<QPaintDevice>[src]

Calls C++ function: QPaintDevice* static_cast<QPaintDevice*>(QToolButton* ptr).

unsafe fn static_upcast_mut(ptr: MutPtr<QToolButton>) -> MutPtr<QPaintDevice>[src]

Calls C++ function: QPaintDevice* static_cast<QPaintDevice*>(QToolButton* ptr).

impl StaticUpcast<QWidget> for QToolButton[src]

unsafe fn static_upcast(ptr: Ptr<QToolButton>) -> Ptr<QWidget>[src]

Calls C++ function: QWidget* static_cast<QWidget*>(QToolButton* ptr).

unsafe fn static_upcast_mut(ptr: MutPtr<QToolButton>) -> MutPtr<QWidget>[src]

Calls C++ function: QWidget* static_cast<QWidget*>(QToolButton* ptr).

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.