00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef QWT_TEXT_LABEL_H
00011 #define QWT_TEXT_LABEL_H
00012
00013 #include "qwt_global.h"
00014 #include "qwt_text.h"
00015 #include <qframe.h>
00016
00017 class QString;
00018 class QPaintEvent;
00019 class QPainter;
00020
00025 class QWT_EXPORT QwtTextLabel : public QFrame
00026 {
00027 Q_OBJECT
00028
00029 Q_PROPERTY( int indent READ indent WRITE setIndent )
00030 Q_PROPERTY( int margin READ margin WRITE setMargin )
00031
00032 public:
00033 explicit QwtTextLabel(QWidget *parent = NULL);
00034 explicit QwtTextLabel(const QwtText &, QWidget *parent = NULL);
00035 virtual ~QwtTextLabel();
00036
00037 public Q_SLOTS:
00038 void setText(const QString &,
00039 QwtText::TextFormat textFormat = QwtText::AutoText);
00040 virtual void setText(const QwtText &);
00041
00042 void clear();
00043
00044 public:
00045 const QwtText &text() const;
00046
00047 int indent() const;
00048 void setIndent(int);
00049
00050 int margin() const;
00051 void setMargin(int);
00052
00053 virtual QSize sizeHint() const;
00054 virtual QSize minimumSizeHint() const;
00055 virtual int heightForWidth(int) const;
00056
00057 QRect textRect() const;
00058
00059 protected:
00060 virtual void paintEvent(QPaintEvent *e);
00061 virtual void drawContents(QPainter *);
00062 virtual void drawText(QPainter *, const QRect &);
00063
00064 private:
00065 void init();
00066 int defaultIndent() const;
00067
00068 class PrivateData;
00069 PrivateData *d_data;
00070 };
00071
00072 #endif