Qwt User's Guide: qwt_text_label.h Source File

- Main Page
- Classes
- Files
- Related Pages

- File List
- File Members

# qwt_text_label.h

    00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
    00002  * Qwt Widget Library
    00003  * Copyright (C) 1997   Josef Wilgen
    00004  * Copyright (C) 2002   Uwe Rathmann
    00005  *
    00006  * This library is free software; you can redistribute it and/or
    00007  * modify it under the terms of the Qwt License, Version 1.0
    00008  *****************************************************************************/
    00009
    00010 #ifndef QWT_TEXT_LABEL_H
    00011 #define QWT_TEXT_LABEL_H
    00012
    00013 #include <qframe.h>
    00014 #include "qwt_global.h"
    00015 #include "qwt_text.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 #if QT_VERSION < 0x040000
    00035     explicit QwtTextLabel(QWidget *parent, const char *name);
    00036 #endif
    00037     explicit QwtTextLabel(const QwtText &, QWidget *parent = NULL);
    00038     virtual ~QwtTextLabel();
    00039
    00040 public slots:
    00041     void setText(const QString &,
    00042         QwtText::TextFormat textFormat = QwtText::AutoText);
    00043     virtual void setText(const QwtText &);
    00044
    00045     void clear();
    00046
    00047 public:
    00048     const QwtText &text() const;
    00049
    00050     int indent() const;
    00051     void setIndent(int);
    00052
    00053     int margin() const;
    00054     void setMargin(int);
    00055
    00056     virtual QSize sizeHint() const;
    00057     virtual QSize minimumSizeHint() const;
    00058     virtual int heightForWidth(int) const;
    00059
    00060     QRect textRect() const;
    00061
    00062 protected:
    00063     virtual void paintEvent(QPaintEvent *e);
    00064     virtual void drawContents(QPainter *);
    00065     virtual void drawText(QPainter *, const QRect &);
    00066
    00067 private:
    00068     void init();
    00069     int defaultIndent() const;
    00070
    00071     class PrivateData;
    00072     PrivateData *d_data;
    00073 };
    00074
    00075 #endif