diff --git a/widgets/label.cpp b/widgets/label.cpp index 35552c96f..4dcf116c1 100644 --- a/widgets/label.cpp +++ b/widgets/label.cpp @@ -145,6 +145,16 @@ QString Label::image() const return d->imagePath; } +void Label::setAlignment(Qt::Alignment alignment) +{ + nativeWidget()->setAlignment(alignment); +} + +Qt::Alignment Label::alignment() const +{ + return nativeWidget()->alignment(); +} + void Label::setStyleSheet(const QString &stylesheet) { widget()->setStyleSheet(stylesheet); diff --git a/widgets/label.h b/widgets/label.h index c8f9ec6d0..8ede75180 100644 --- a/widgets/label.h +++ b/widgets/label.h @@ -44,6 +44,7 @@ class PLASMA_EXPORT Label : public QGraphicsProxyWidget Q_PROPERTY(QGraphicsWidget *parentWidget READ parentWidget) Q_PROPERTY(QString text READ text WRITE setText) Q_PROPERTY(QString image READ image WRITE setImage) + Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment) Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet) Q_PROPERTY(QLabel *nativeWidget READ nativeWidget) @@ -75,6 +76,18 @@ public: */ QString image() const; + /** + * Sets the alignment for the text + * + * @arg the desired alignment + */ + void setAlignment(Qt::Alignment alignment); + + /** + * @return the alignment for the text used in the labels + */ + Qt::Alignment alignment() const; + /** * Sets the stylesheet used to control the visual display of this Label *