Class SBGUIPushButtonHover#
ClassList > SBGUIPushButtonHover
The SBGUIPushButtonHover class extends QPushButton to create a transparent (without background) button with an icon that changes on hover.More...
#include <SBGUIPushButtonHover.hpp>
Inherits the following classes: QPushButton, QPushButton
Public Types#
| Type | Name |
|---|---|
| enum | IconType Available icon types. |
Public Functions#
| Type | Name |
|---|---|
| SBGUIPushButtonHover (QWidget * parent=nullptr) Constructs a SBGUIPushButtonHover with an optional parent widget. |
|
| SBGUIPushButtonHover (const QString & text, QWidget * parent=nullptr) Constructs a SBGUIPushButtonHover with a given text label and optional parent widget. |
|
| IconType | getIconType () const Returns the icon type. |
| void | setIconType (IconType iconType) Sets the icon type. This will also set the icons to the standard ones for the non Custom and non Undefined icon types. |
| void | setIcons (const QString & iconPath, const QString & hoverIconPath) Sets two icons: non-hover and on-hover icons. The icon type is set to Custom. |
| void | setIcons (const QIcon & icon, const QIcon & hoverIcon) Sets two icons: non-hover and on-hover icons. The icon type is set to Custom. |
| ~SBGUIPushButtonHover () Destroys the SBGUIPushButtonHover and releases any custom icons. |
Protected Functions#
| Type | Name |
|---|---|
| void | enterEvent (QEnterEvent * event) override Handles enter events. |
| void | leaveEvent (QEvent * event) override Handles leave events. |
Detailed Description#
Short name: SBPushButtonHover
Public Types Documentation#
enum IconType#
Available icon types.
enum SBGUIPushButtonHover::IconType {
Undefined,
Add,
Edit,
Remove,
Delete,
Clear,
Reset,
Copy,
Custom
};
Public Functions Documentation#
function SBGUIPushButtonHover [1/2]#
Constructs a SBGUIPushButtonHover with an optional parent widget.
This overload forwards to the constructor taking a text string with an empty string.
Parameters:
parentParent widget (optional). If nullptr, the button has no parent.
function SBGUIPushButtonHover [2/2]#
Constructs a SBGUIPushButtonHover with a given text label and optional parent widget.
explicit SBGUIPushButtonHover::SBGUIPushButtonHover (
const QString & text,
QWidget * parent=nullptr
)
Parameters:
textThe text label for the button.parentThe parent widget (optional). If nullptr, the button has no parent.
function getIconType#
Returns the icon type.
Returns the current icon type of the button.
Returns:
The icon type.
function setIconType#
Sets the icon type. This will also set the icons to the standard ones for the non Custom and non Undefined icon types.
Sets the button's icon type, loading standard icons for the specified type.
Parameters:
iconTypeThe icon type to set.
function setIcons [1/2]#
Sets two icons: non-hover and on-hover icons. The icon type is set to Custom.
Sets custom icons for the button using file paths for the normal and hover states.
Parameters:
iconPathFile path to the normal state icon.hoverIconPathFile path to the hover state icon.
function setIcons [2/2]#
Sets two icons: non-hover and on-hover icons. The icon type is set to Custom.
Sets custom icons for the button using QIcon objects for the normal and hover states.
Parameters:
iconThe QIcon for the normal state.hoverIconThe QIcon for the hover state.
function ~SBGUIPushButtonHover#
Destroys the SBGUIPushButtonHover and releases any custom icons.
Protected Functions Documentation#
function enterEvent#
Handles enter events.
Handles the mouse enter event, updating the button icon to the hover version if applicable.
Parameters:
eventThe enter event.
function leaveEvent#
Handles leave events.
Handles the mouse leave event, restoring the button icon to the normal version if applicable.
Parameters:
eventThe leave event.