From 614c2252d1e1b1ff17c386aa51624fb2bad36468 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 23 Dec 2008 20:39:59 +0000 Subject: [PATCH] add alignment/setAlignment wrapping in the api svn path=/trunk/KDE/kdelibs/; revision=900868 --- widgets/label.cpp | 10 ++++++++++ widgets/label.h | 13 +++++++++++++ 2 files changed, 23 insertions(+) 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 *