Web Analytics Made Easy - Statcounter
Skip to content

Class SBGUIPushButton#

ClassList > SBGUIPushButton

Inherits the following classes: QPushButton

Public Functions#

Type Name
SBGUIPushButton (QWidget * parent=nullptr)
bool dimBaseIconWhileBusy () const
bool isBusy () const
QPoint overlayOffset () const
qreal overlayScale () const
void setBusy (bool on)
Enable/disable the busy overlay.
void setDimBaseIconWhileBusy (bool on)
If true, draws a subtle shade over the base icon while busy.
bool setOverlayGif (const QString & path)
Load a GIF (from file path or Qt resource) to use as the busy overlay.
void setOverlayMovie (QMovie * movie)
Provide an already-constructed QMovie as the overlay.
void setOverlayOffset (const QPoint & px)
Optional pixel offset to nudge the overlay relative to the icon rect.
void setOverlayScale (qreal s)
Scale overlay relative to the base icon rectangle.
~SBGUIPushButton () override

Protected Functions#

Type Name
void paintEvent (QPaintEvent * e) override
Paints the standard QPushButton then, if busy, draws the animated overlay centered on the button's icon rectangle.

Public Functions Documentation#

function SBGUIPushButton#

explicit SBGUIPushButton::SBGUIPushButton (
    QWidget * parent=nullptr
) 

function dimBaseIconWhileBusy#

inline bool SBGUIPushButton::dimBaseIconWhileBusy () const

function isBusy#

inline bool SBGUIPushButton::isBusy () const

function overlayOffset#

inline QPoint SBGUIPushButton::overlayOffset () const

function overlayScale#

inline qreal SBGUIPushButton::overlayScale () const

function setBusy#

Enable/disable the busy overlay.

void SBGUIPushButton::setBusy (
    bool on
) 

Starts/stops the movie and triggers repaints.


function setDimBaseIconWhileBusy#

If true, draws a subtle shade over the base icon while busy.

void SBGUIPushButton::setDimBaseIconWhileBusy (
    bool on
) 


function setOverlayGif#

Load a GIF (from file path or Qt resource) to use as the busy overlay.

bool SBGUIPushButton::setOverlayGif (
    const QString & path
) 

Parameters:

  • path File path or qrc path to a GIF.

Returns:

true on success, false if the movie is invalid.

Ownership: the created QMovie is parented to this button.


function setOverlayMovie#

Provide an already-constructed QMovie as the overlay.

void SBGUIPushButton::setOverlayMovie (
    QMovie * movie
) 

Ownership is transferred to this button (parent is set to this).

Parameters:

  • movie QMovie to use (may be nullptr to clear).

function setOverlayOffset#

Optional pixel offset to nudge the overlay relative to the icon rect.

void SBGUIPushButton::setOverlayOffset (
    const QPoint & px
) 


function setOverlayScale#

Scale overlay relative to the base icon rectangle.

void SBGUIPushButton::setOverlayScale (
    qreal s
) 

1.0 = same size, 0.8 = 80%, etc. Clamped to [0.2, 2.0].


function ~SBGUIPushButton#

SBGUIPushButton::~SBGUIPushButton () override

Protected Functions Documentation#

function paintEvent#

Paints the standard QPushButton then, if busy, draws the animated overlay centered on the button's icon rectangle.

void SBGUIPushButton::paintEvent (
    QPaintEvent * e
) override