Web Analytics Made Easy - Statcounter
Skip to content

Class SBGUIPushButtonPixmap#

ClassList > SBGUIPushButtonPixmap

The SBGUIPushButtonPixmap class extends QPushButton to have a button that is fully.More...

  • #include <SBGUIPushButtonPixmap.hpp>

Inherits the following classes: QPushButton, QPushButton

Public Functions#

Type Name
SBGUIPushButtonPixmap (QWidget * parent=nullptr)
Constructs the pixmap push button.
SBGUIPushButtonPixmap (const QString & text, QWidget * parent=nullptr)
Constructs the pixmap push button, discards the text.
QPixmap getScaledPixmap () const
Returns the pixmap scaled to the size of the button with the margin subtracted from each side.
void setIcon (const QPixmap & pixmap)
Sets pixmap as the icon.
void setMargin (unsigned int margin)
Sets the margin between the button border and the icon border.
virtual ~SBGUIPushButtonPixmap ()
Destructs the button.

Protected Attributes#

Type Name
unsigned int margin
The margin between the button border and the icon border.
QPixmap originalPixmap
The original pixmap.

Protected Functions#

Type Name
void resizeEvent (QResizeEvent * event)
Handles resize events by updating the button icon if a pixmap is set.

Detailed Description#

Short name: SBPushButtonPixmap

Public Functions Documentation#

function SBGUIPushButtonPixmap [1/2]#

Constructs the pixmap push button.

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

Parameters:

  • parent Parent widget, or nullptr if none.

function SBGUIPushButtonPixmap [2/2]#

Constructs the pixmap push button, discards the text.

explicit SBGUIPushButtonPixmap::SBGUIPushButtonPixmap (
    const QString & text,
    QWidget * parent=nullptr
) 

Constructs the pixmap push button, discarding the provided text.

Parameters:

  • text Ignored text string.
  • parent Parent widget, or nullptr if none.

function getScaledPixmap#

Returns the pixmap scaled to the size of the button with the margin subtracted from each side.

QPixmap SBGUIPushButtonPixmap::getScaledPixmap () const

Returns the pixmap scaled to the size of the button, subtracting the margin from each side.

Returns:

The scaled pixmap.


function setIcon#

Sets pixmap as the icon.

void SBGUIPushButtonPixmap::setIcon (
    const QPixmap & pixmap
) 

Sets the specified pixmap as the button's icon.

Parameters:

  • pixmap The pixmap to use as the button's icon.

function setMargin#

Sets the margin between the button border and the icon border.

void SBGUIPushButtonPixmap::setMargin (
    unsigned int margin
) 

Parameters:

  • margin The margin in pixels.

function ~SBGUIPushButtonPixmap#

Destructs the button.

virtual SBGUIPushButtonPixmap::~SBGUIPushButtonPixmap () 


Protected Attributes Documentation#

variable margin#

The margin between the button border and the icon border.

unsigned int SBGUIPushButtonPixmap::margin;


variable originalPixmap#

The original pixmap.

QPixmap SBGUIPushButtonPixmap::originalPixmap;


Protected Functions Documentation#

function resizeEvent#

Handles resize events by updating the button icon if a pixmap is set.

void SBGUIPushButtonPixmap::resizeEvent (
    QResizeEvent * event
) 

Parameters:

  • event The resize event, may be nullptr if called manually.