Class QArrowToolButton
A custom tool button with an arrow indicator in the bottom right corner. More...
#include <widgets.h>
Inherits the following classes: QToolButton
Public Signals
| Type | Name |
|---|---|
| signal void | ArrowClicked Signal emitted when the arrow on the button is clicked. |
Public Functions
| Type | Name |
|---|---|
| QArrowToolButton (QWidget * parent=nullptr) Constructor for QArrowToolButton . |
Protected Functions
| Type | Name |
|---|---|
| void | mousePressEvent (QMouseEvent * event) override Handles mouse press events. |
| void | paintEvent (QPaintEvent * event) override Custom paint event for drawing the arrow on the button. |
Detailed Description
A specialized tool button designed for use in interfaces where an arrow indication is required. This button can handle arrow orientation and visual styles to assist user interactions in directional or expandable UI elements.
Public Signals Documentation
signal ArrowClicked
Signal emitted when the arrow on the button is clicked.
This signal is emitted whenever the user clicks on the arrow portion of the button. It is primarily used to notify connected slots of this specific interaction, allowing for custom handling or behavior in response to the arrow click.
Public Functions Documentation
function QArrowToolButton
Constructor for QArrowToolButton .
Initializes a QArrowToolButton instance with a custom arrow functionality, inheriting from QToolButton. This constructor sets the parent widget of the button for proper widget hierarchy management.
Parameters:
parentThe parent widget for this button. If null, the button has no parent and acts as a top-level widget.
Protected Functions Documentation
function mousePressEvent
Handles mouse press events.
This method processes mouse press events and checks if the click occurs within the rectangle occupied by the arrow. If the arrow is clicked, it emits an arrowClicked signal and prevents the default button behavior. Otherwise, the event is passed to the parent class for standard processing.
Parameters:
eventThe pointer to the QMouseEvent containing information about the mouse press.
function paintEvent
Custom paint event for drawing the arrow on the button.
This method overrides the default paint event to draw a custom arrow on the button. The arrow's color changes dynamically based on the button's state, such as whether it is enabled, hovered, or pressed. The arrow is drawn using a QPainter instance and takes into account the visual states obtained through QStyleOptionToolButton.
Parameters:
eventA pointer to the QPaintEvent object providing details about the paint event.
The documentation for this class was generated from the following file src/widgets.h