QLabel subclass with font size and color Q_PROPERTYs.
More...
#include <label.h>
|
| | Label (QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags()) |
| | Construct with optional parent and window flags.
|
| |
| | Label (const QString &text, QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags()) |
| | Construct with initial text, optional parent and window flags.
|
| |
| void | setFontPointSize (int size) |
| | Set the font size in points.
|
| |
| void | setFontPixelSize (int size) |
| | Set the font size in pixels.
|
| |
| QColor | foregroundColor () const |
| | Return the current foreground color.
|
| |
| QColor | backgroundColor () const |
| | Return the current background color.
|
| |
|
void | setDefaultForegroundColor () |
| | Reset the foreground color to the palette default.
|
| |
|
void | setDefaultBackgroundColor () |
| | Reset the background color to the palette default.
|
| |
|
|
virtual void | applyStylesheet () |
| | Rebuild and apply the stylesheet from current color properties.
|
| |
QLabel subclass with font size and color Q_PROPERTYs.
Label exposes foregroundColor and backgroundColor as Qt properties, allowing them to be set from Qt Designer or stylesheets. It also provides setFontPointSize() and setFontPixelSize() for quick font-size changes without manual QFont manipulation.
Definition at line 15 of file label.h.
◆ Label() [1/2]
| Label::Label |
( |
QWidget * |
parent = nullptr, |
|
|
Qt::WindowFlags |
f = Qt::WindowFlags() |
|
) |
| |
|
explicit |
Construct with optional parent and window flags.
- Parameters
-
| parent | Optional QWidget parent |
| f | Optional window flags |
◆ Label() [2/2]
| Label::Label |
( |
const QString & |
text, |
|
|
QWidget * |
parent = nullptr, |
|
|
Qt::WindowFlags |
f = Qt::WindowFlags() |
|
) |
| |
|
explicit |
Construct with initial text, optional parent and window flags.
- Parameters
-
| text | Initial label text |
| parent | Optional QWidget parent |
| f | Optional window flags |
◆ backgroundColor()
| QColor Label::backgroundColor |
( |
| ) |
const |
|
inline |
Return the current background color.
- Returns
- Background color
Definition at line 61 of file label.h.
◆ foregroundColor()
| QColor Label::foregroundColor |
( |
| ) |
const |
|
inline |
Return the current foreground color.
- Returns
- Foreground (text) color
Definition at line 55 of file label.h.
◆ setBackgroundColor
| void Label::setBackgroundColor |
( |
const QColor & |
color | ) |
|
|
slot |
Set the background color and repaint.
- Parameters
-
| color | New background color |
◆ setFontPixelSize()
| void Label::setFontPixelSize |
( |
int |
size | ) |
|
Set the font size in pixels.
- Parameters
-
◆ setFontPointSize()
| void Label::setFontPointSize |
( |
int |
size | ) |
|
Set the font size in points.
- Parameters
-
◆ setForegroundColor
| void Label::setForegroundColor |
( |
const QColor & |
color | ) |
|
|
slot |
Set the foreground (text) color and repaint.
- Parameters
-
| color | New foreground color |
◆ backgroundColor
| QColor Label::backgroundColor |
|
readwrite |
Background color of the label.
Definition at line 22 of file label.h.
◆ foregroundColor
| QColor Label::foregroundColor |
|
readwrite |
Foreground (text) color of the label.
Definition at line 20 of file label.h.
The documentation for this class was generated from the following file: