Struct rute::auto::tool_button::ToolButton
source · pub struct ToolButton<'a> { /* private fields */ }
Expand description
Notice these docs are heavy WIP and not very relevent yet
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 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 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 contains tool buttons that are associated with actions used in other parts of the main window.
See also: PushButton
[ToolBar
]
[MainWindow
]
[Action
]
{fowler}{GUI Design Handbook: Push Button}
Licence
The documentation is an adoption of the original Qt Documentation and provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.
Implementations
sourceimpl<'a> ToolButton<'a>
impl<'a> ToolButton<'a>
pub fn new() -> ToolButton<'a>
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.
sourcepub fn arrow_type(&self) -> ArrowType
pub fn arrow_type(&self) -> ArrowType
This displays an arrow as the icon for the QToolButton.
By default, this property is set to Qt::NoArrow.
pub fn set_arrow_type(&self, arrow_type: ArrowType) -> &Self
pub fn set_popup_mode(&self, mode: ToolButtonPopupMode) -> &Self
sourcepub fn popup_mode(&self) -> ToolButtonPopupMode
pub fn popup_mode(&self) -> ToolButtonPopupMode
By default, this property is set to DelayedPopup.
sourcepub fn auto_raise(&self) -> bool
pub fn auto_raise(&self) -> bool
The default is disabled (i.e. false).
This property is currently ignored on MacOS when using QMacStyle.
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.
sourcepub fn set_mouse_press_event_ud<F, T>(&self, data: &'a T, func: F) -> &Selfwhere
F: Fn(&T, &MouseEvent<'_>) + 'a,
T: 'a,
pub fn set_mouse_press_event_ud<F, T>(&self, data: &'a T, func: F) -> &Selfwhere
F: Fn(&T, &MouseEvent<'_>) + 'a,
T: 'a,
pub fn set_mouse_press_event<F>(&self, func: F) -> &Selfwhere
F: Fn(&MouseEvent<'_>) + 'a,
sourcepub fn set_mouse_release_event_ud<F, T>(&self, data: &'a T, func: F) -> &Selfwhere
F: Fn(&T, &MouseEvent<'_>) + 'a,
T: 'a,
pub fn set_mouse_release_event_ud<F, T>(&self, data: &'a T, func: F) -> &Selfwhere
F: Fn(&T, &MouseEvent<'_>) + 'a,
T: 'a,
pub fn set_mouse_release_event<F>(&self, func: F) -> &Selfwhere
F: Fn(&MouseEvent<'_>) + 'a,
sourcepub fn set_paint_event_ud<F, T>(&self, data: &'a T, func: F) -> &Selfwhere
F: Fn(&T, &PaintEvent<'_>) + 'a,
T: 'a,
pub fn set_paint_event_ud<F, T>(&self, data: &'a T, func: F) -> &Selfwhere
F: Fn(&T, &PaintEvent<'_>) + 'a,
T: 'a,
Paints the button in response to the paint event.
pub fn set_paint_event<F>(&self, func: F) -> &Selfwhere
F: Fn(&PaintEvent<'_>) + 'a,
sourcepub fn set_enter_event_ud<F, T>(&self, data: &'a T, func: F) -> &Selfwhere
F: Fn(&T, &Event<'_>) + 'a,
T: 'a,
pub fn set_enter_event_ud<F, T>(&self, data: &'a T, func: F) -> &Selfwhere
F: Fn(&T, &Event<'_>) + 'a,
T: 'a,
pub fn set_enter_event<F>(&self, func: F) -> &Selfwhere
F: Fn(&Event<'_>) + 'a,
sourcepub fn set_leave_event_ud<F, T>(&self, data: &'a T, func: F) -> &Selfwhere
F: Fn(&T, &Event<'_>) + 'a,
T: 'a,
pub fn set_leave_event_ud<F, T>(&self, data: &'a T, func: F) -> &Selfwhere
F: Fn(&T, &Event<'_>) + 'a,
T: 'a,
pub fn set_leave_event<F>(&self, func: F) -> &Selfwhere
F: Fn(&Event<'_>) + 'a,
sourcepub fn set_change_event_ud<F, T>(&self, data: &'a T, func: F) -> &Selfwhere
F: Fn(&T, &Event<'_>) + 'a,
T: 'a,
pub fn set_change_event_ud<F, T>(&self, data: &'a T, func: F) -> &Selfwhere
F: Fn(&T, &Event<'_>) + 'a,
T: 'a,
pub fn set_change_event<F>(&self, func: F) -> &Selfwhere
F: Fn(&Event<'_>) + 'a,
pub fn set_pressed_event<F>(&self, func: F) -> &Selfwhere
F: Fn() + 'a,
pub fn set_released_event<F>(&self, func: F) -> &Selfwhere
F: Fn() + 'a,
pub fn set_clicked_event<F>(&self, func: F) -> &Selfwhere
F: Fn(bool) + 'a,
pub fn set_toggled_event<F>(&self, func: F) -> &Selfwhere
F: Fn(bool) + 'a,
pub fn set_key_press_event<F>(&self, func: F) -> &Selfwhere
F: Fn(&KeyEvent<'_>) + 'a,
pub fn set_key_release_event<F>(&self, func: F) -> &Selfwhere
F: Fn(&KeyEvent<'_>) + 'a,
pub fn set_mouse_move_event<F>(&self, func: F) -> &Selfwhere
F: Fn(&MouseEvent<'_>) + 'a,
pub fn set_focus_in_event<F>(&self, func: F) -> &Selfwhere
F: Fn(&FocusEvent<'_>) + 'a,
pub fn set_focus_out_event<F>(&self, func: F) -> &Selfwhere
F: Fn(&FocusEvent<'_>) + 'a,
pub fn set_window_title_changed_event<F>(&self, func: F) -> &Selfwhere
F: Fn(&str) + 'a,
pub fn set_window_icon_changed_event<F>(&self, func: F) -> &Selfwhere
F: Fn(&Icon<'_>) + 'a,
pub fn set_window_icon_text_changed_event<F>(&self, func: F) -> &Selfwhere
F: Fn(&str) + 'a,
pub fn set_mouse_double_click_event<F>(&self, func: F) -> &Selfwhere
F: Fn(&MouseEvent<'_>) + 'a,
pub fn set_wheel_event<F>(&self, func: F) -> &Selfwhere
F: Fn(&WheelEvent<'_>) + 'a,
pub fn set_move_event<F>(&self, func: F) -> &Selfwhere
F: Fn(&MoveEvent<'_>) + 'a,
pub fn set_resize_event<F>(&self, func: F) -> &Selfwhere
F: Fn(&ResizeEvent<'_>) + 'a,
pub fn set_close_event<F>(&self, func: F) -> &Selfwhere
F: Fn(&CloseEvent<'_>) + 'a,
pub fn set_tablet_event<F>(&self, func: F) -> &Selfwhere
F: Fn(&TabletEvent<'_>) + 'a,
pub fn set_drag_enter_event<F>(&self, func: F) -> &Selfwhere
F: Fn(&DragEnterEvent<'_>) + 'a,
pub fn set_drag_move_event<F>(&self, func: F) -> &Selfwhere
F: Fn(&DragMoveEvent<'_>) + 'a,
pub fn set_drag_leave_event<F>(&self, func: F) -> &Selfwhere
F: Fn(&DragLeaveEvent<'_>) + 'a,
pub fn set_drop_event<F>(&self, func: F) -> &Selfwhere
F: Fn(&DropEvent<'_>) + 'a,
pub fn set_show_event<F>(&self, func: F) -> &Selfwhere
F: Fn(&ShowEvent<'_>) + 'a,
pub fn set_hide_event<F>(&self, func: F) -> &Selfwhere
F: Fn(&HideEvent<'_>) + 'a,
pub fn set_custom_event<F>(&self, func: F) -> &Selfwhere
F: Fn(&Event<'_>) + 'a,
pub fn build(&self) -> Self
Trait Implementations
sourceimpl<'a> Clone for ToolButton<'a>
impl<'a> Clone for ToolButton<'a>
sourcefn clone(&self) -> ToolButton<'a>
fn clone(&self) -> ToolButton<'a>
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more