Plasma
label.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef PLASMA_LABEL_H
00021 #define PLASMA_LABEL_H
00022
00023 #include <QtGui/QGraphicsProxyWidget>
00024
00025 #include <plasma/plasma_export.h>
00026 #include <plasma/dataengine.h>
00027
00028 class QLabel;
00029
00030 namespace Plasma
00031 {
00032
00033 class LabelPrivate;
00034
00040 class PLASMA_EXPORT Label : public QGraphicsProxyWidget
00041 {
00042 Q_OBJECT
00043
00044 Q_PROPERTY(QGraphicsWidget *parentWidget READ parentWidget)
00045 Q_PROPERTY(QString text READ text WRITE setText)
00046 Q_PROPERTY(QString image READ image WRITE setImage)
00047 Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment)
00048 Q_PROPERTY(bool hasScaledContents READ hasScaledContents WRITE setScaledContents)
00049 Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet)
00050 Q_PROPERTY(QLabel *nativeWidget READ nativeWidget)
00051
00052 public:
00058 explicit Label(QGraphicsWidget *parent = 0);
00059 ~Label();
00060
00066 void setText(const QString &text);
00067
00071 QString text() const;
00072
00078 void setImage(const QString &path);
00079
00083 QString image() const;
00084
00090 void setAlignment(Qt::Alignment alignment);
00091
00095 Qt::Alignment alignment() const;
00096
00102 void setScaledContents(bool scaled);
00103
00107 bool hasScaledContents() const;
00108
00114 void setStyleSheet(const QString &stylesheet);
00115
00119 QString styleSheet();
00120
00124 QLabel *nativeWidget() const;
00125
00126 Q_SIGNALS:
00127 void linkActivated(const QString &link);
00128 void linkHovered(const QString &link);
00129
00130 public Q_SLOTS:
00131 void dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data);
00132
00133 protected:
00134 void resizeEvent(QGraphicsSceneResizeEvent *event);
00135
00136 private:
00137 Q_PRIVATE_SLOT(d, void setPalette())
00138 Q_PRIVATE_SLOT(d, void setPixmap())
00139
00140 LabelPrivate * const d;
00141 };
00142
00143 }
00144
00145 #endif // multiple inclusion guard