Composite widget combining a QLabel with a QToolButton.
More...
#include <buttonlabel.h>
|
|
void | clicked () |
| | Emitted when the tool button is clicked.
|
| |
|
void | activeChanged () |
| | Emitted when the active state changes.
|
| |
|
| | ButtonLabel (QWidget *parent=nullptr) |
| | Construct an empty ButtonLabel.
|
| |
| | ButtonLabel (const QString &text, QWidget *parent=nullptr) |
| | Construct with initial label text.
|
| |
| QString | text () const |
| | Return the current label text.
|
| |
| void | setText (const QString &text) |
| | Set the label text.
|
| |
| void | setIcon (const QIcon &activeIcon, const QIcon &inactiveIcon=QIcon()) |
| | Set the button icons for active and inactive states.
|
| |
| void | setButtonAlignment (Qt::Alignment alignment) |
| | Set the horizontal alignment of the button within the layout.
|
| |
| void | setActive (bool active) |
| | Set the active state and update the displayed icon.
|
| |
| bool | isActive () const |
| | Return whether the button is in the active state.
|
| |
| void | setForegroundColor (const QColor &color) |
| | Set the foreground (text) color.
|
| |
| void | setBackgroundColor (const QColor &color) |
| | Set the background color.
|
| |
Composite widget combining a QLabel with a QToolButton.
ButtonLabel places a text label and a tool button side-by-side. The button can carry separate active and inactive icons and fires a clicked() signal. Colors and alignment are customizable.
Definition at line 18 of file buttonlabel.h.
◆ ButtonLabel() [1/2]
| ButtonLabel::ButtonLabel |
( |
QWidget * |
parent = nullptr | ) |
|
|
explicit |
Construct an empty ButtonLabel.
- Parameters
-
| parent | Optional QWidget parent |
◆ ButtonLabel() [2/2]
| ButtonLabel::ButtonLabel |
( |
const QString & |
text, |
|
|
QWidget * |
parent = nullptr |
|
) |
| |
|
explicit |
Construct with initial label text.
- Parameters
-
| text | Initial label text |
| parent | Optional QWidget parent |
◆ isActive()
| bool ButtonLabel::isActive |
( |
| ) |
const |
|
inline |
Return whether the button is in the active state.
- Returns
- true if active
Definition at line 70 of file buttonlabel.h.
◆ setActive()
| void ButtonLabel::setActive |
( |
bool |
active | ) |
|
Set the active state and update the displayed icon.
- Parameters
-
| active | true to show the active icon |
◆ setBackgroundColor()
| void ButtonLabel::setBackgroundColor |
( |
const QColor & |
color | ) |
|
Set the background color.
- Parameters
-
◆ setButtonAlignment()
| void ButtonLabel::setButtonAlignment |
( |
Qt::Alignment |
alignment | ) |
|
Set the horizontal alignment of the button within the layout.
- Parameters
-
| alignment | Qt alignment flags |
◆ setForegroundColor()
| void ButtonLabel::setForegroundColor |
( |
const QColor & |
color | ) |
|
Set the foreground (text) color.
- Parameters
-
◆ setIcon()
| void ButtonLabel::setIcon |
( |
const QIcon & |
activeIcon, |
|
|
const QIcon & |
inactiveIcon = QIcon() |
|
) |
| |
Set the button icons for active and inactive states.
- Parameters
-
| activeIcon | Icon shown when isActive() is true |
| inactiveIcon | Icon shown when isActive() is false (optional) |
◆ setText()
| void ButtonLabel::setText |
( |
const QString & |
text | ) |
|
Set the label text.
- Parameters
-
◆ text()
| QString ButtonLabel::text |
( |
| ) |
const |
|
inline |
Return the current label text.
- Returns
- Label text string
Definition at line 39 of file buttonlabel.h.
The documentation for this class was generated from the following file: