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

Composite widget showing a text label alongside an icon. More...

#include <iconlabel.h>

+ Inheritance diagram for IconLabel:
+ Collaboration diagram for IconLabel:

Public Member Functions

 IconLabel (QWidget *parent=nullptr)
 Construct an empty IconLabel.
 
 IconLabel (const QString &text, QWidget *parent=nullptr)
 Construct with text only.
 
 IconLabel (const QString &text, const QIcon &icon, QWidget *parent=nullptr)
 Construct with text and an icon.
 
QString text () const
 Return the current label text.
 
void setText (const QString &text)
 Set the label text.
 
QIcon icon () const
 Return the current icon.
 
void setIcon (const QIcon &icon)
 Set the icon.
 
void setIconAlignment (Qt::Alignment alignment)
 Set the alignment of the icon within the layout.
 

Detailed Description

Composite widget showing a text label alongside an icon.

IconLabel places a QLabel for text and a QLabel for a QIcon side by side. The icon alignment within the layout can be controlled independently of the text alignment.

Definition at line 16 of file iconlabel.h.

Constructor & Destructor Documentation

◆ IconLabel() [1/3]

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

Construct an empty IconLabel.

Parameters
parentOptional QWidget parent

◆ IconLabel() [2/3]

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

Construct with text only.

Parameters
textInitial label text
parentOptional QWidget parent

◆ IconLabel() [3/3]

IconLabel::IconLabel ( const QString &  text,
const QIcon &  icon,
QWidget *  parent = nullptr 
)
explicit

Construct with text and an icon.

Parameters
textInitial label text
iconIcon to display alongside the text
parentOptional QWidget parent

Member Function Documentation

◆ icon()

QIcon IconLabel::icon ( ) const

Return the current icon.

Returns
Icon displayed in the widget

◆ setIcon()

void IconLabel::setIcon ( const QIcon &  icon)

Set the icon.

Parameters
iconNew icon to display

◆ setIconAlignment()

void IconLabel::setIconAlignment ( Qt::Alignment  alignment)

Set the alignment of the icon within the layout.

Parameters
alignmentQt alignment flags

◆ setText()

void IconLabel::setText ( const QString &  text)

Set the label text.

Parameters
textNew text string

◆ text()

QString IconLabel::text ( ) const

Return the current label text.

Returns
Text string

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