KanoopGuiQt 1.3.0
Qt GUI utility library
Loading...
Searching...
No Matches
PushButton Class Reference

QPushButton subclass with stylesheet-based color and font customization. More...

#include <pushbutton.h>

+ Inheritance diagram for PushButton:
+ Collaboration diagram for PushButton:

Public Slots

void setForegroundColor (const QColor &color)
 Set the foreground (text) color and rebuild the stylesheet.
 
void setBackgroundColor (const QColor &color)
 Set the background color and rebuild the stylesheet.
 
void setDefaultForegroundColor ()
 Reset the foreground color to the palette default.
 
void setDefaultBackgroundColor ()
 Reset the background color to the palette default.
 

Public Member Functions

 PushButton (QWidget *parent=nullptr)
 Construct a PushButton with an optional parent widget.
 
 PushButton (const QString &text, QWidget *parent=nullptr)
 Construct a PushButton with the given text and optional parent widget.
 
 PushButton (const QIcon &icon, const QString &text, QWidget *parent=nullptr)
 Construct a PushButton with the given icon, text, and optional parent widget.
 
void setFontPointSize (int size)
 Set the font point size.
 
void setFontPixelSize (int size)
 Set the font pixel size.
 
void setBold (bool bold)
 Set the font bold state.
 
void setItalic (bool italic)
 Set the font italic state.
 
QColor foregroundColor () const
 Get the current foreground color.
 
QColor backgroundColor () const
 Get the current background color.
 
void setBorderRadius (int radius)
 Set the border radius in pixels.
 
void setHoverForegroundColor (const QColor &color)
 Set the foreground color when the mouse hovers over the button.
 
void setHoverBackgroundColor (const QColor &color)
 Set the background color when the mouse hovers over the button.
 
void setPressedForegroundColor (const QColor &color)
 Set the foreground color when the button is pressed.
 
void setPressedBackgroundColor (const QColor &color)
 Set the background color when the button is pressed.
 
void setDisabledForegroundColor (const QColor &color)
 Set the foreground color when the button is disabled.
 
void setDisabledBackgroundColor (const QColor &color)
 Set the background color when the button is disabled.
 

Properties

QColor foregroundColor
 The current foreground (text) color of the button.
 
QColor backgroundColor
 The current background color of the button.
 

Detailed Description

QPushButton subclass with stylesheet-based color and font customization.

PushButton extends QPushButton to provide programmatic control over foreground, background, hover, pressed, and disabled state colors via Qt stylesheets. It also offers convenience methods for font size, weight, and style changes.

Definition at line 14 of file pushbutton.h.

Member Function Documentation

◆ backgroundColor()

QColor PushButton::backgroundColor ( ) const
inline

Get the current background color.

Definition at line 43 of file pushbutton.h.

◆ foregroundColor()

QColor PushButton::foregroundColor ( ) const
inline

Get the current foreground color.

Definition at line 41 of file pushbutton.h.

Property Documentation

◆ backgroundColor

QColor PushButton::backgroundColor
readwrite

The current background color of the button.

Definition at line 21 of file pushbutton.h.

◆ foregroundColor

QColor PushButton::foregroundColor
readwrite

The current foreground (text) color of the button.

Definition at line 19 of file pushbutton.h.


The documentation for this class was generated from the following file: