Rev | Line | |
---|
[4271] | 1 | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
|
---|
| 2 | * Qwt Widget Library
|
---|
| 3 | * Copyright (C) 1997 Josef Wilgen
|
---|
| 4 | * Copyright (C) 2002 Uwe Rathmann
|
---|
| 5 | *
|
---|
| 6 | * This library is free software; you can redistribute it and/or
|
---|
| 7 | * modify it under the terms of the Qwt License, Version 1.0
|
---|
| 8 | *****************************************************************************/
|
---|
| 9 |
|
---|
| 10 | #ifndef QWT_TEXT_LABEL_H
|
---|
| 11 | #define QWT_TEXT_LABEL_H
|
---|
| 12 |
|
---|
| 13 | #include "qwt_global.h"
|
---|
| 14 | #include "qwt_text.h"
|
---|
| 15 | #include <qframe.h>
|
---|
| 16 |
|
---|
| 17 | class QString;
|
---|
| 18 | class QPaintEvent;
|
---|
| 19 | class QPainter;
|
---|
| 20 |
|
---|
| 21 | /*!
|
---|
| 22 | \brief A Widget which displays a QwtText
|
---|
| 23 | */
|
---|
| 24 |
|
---|
| 25 | class QWT_EXPORT QwtTextLabel : public QFrame
|
---|
| 26 | {
|
---|
| 27 | Q_OBJECT
|
---|
| 28 |
|
---|
| 29 | Q_PROPERTY( int indent READ indent WRITE setIndent )
|
---|
| 30 | Q_PROPERTY( int margin READ margin WRITE setMargin )
|
---|
| 31 |
|
---|
| 32 | public:
|
---|
| 33 | explicit QwtTextLabel( QWidget *parent = NULL );
|
---|
| 34 | explicit QwtTextLabel( const QwtText &, QWidget *parent = NULL );
|
---|
| 35 | virtual ~QwtTextLabel();
|
---|
| 36 |
|
---|
| 37 | public Q_SLOTS:
|
---|
| 38 | void setText( const QString &,
|
---|
| 39 | QwtText::TextFormat textFormat = QwtText::AutoText );
|
---|
| 40 | virtual void setText( const QwtText & );
|
---|
| 41 |
|
---|
| 42 | void clear();
|
---|
| 43 |
|
---|
| 44 | public:
|
---|
| 45 | const QwtText &text() const;
|
---|
| 46 |
|
---|
| 47 | int indent() const;
|
---|
| 48 | void setIndent( int );
|
---|
| 49 |
|
---|
| 50 | int margin() const;
|
---|
| 51 | void setMargin( int );
|
---|
| 52 |
|
---|
| 53 | virtual QSize sizeHint() const;
|
---|
| 54 | virtual QSize minimumSizeHint() const;
|
---|
| 55 | virtual int heightForWidth( int ) const;
|
---|
| 56 |
|
---|
| 57 | QRect textRect() const;
|
---|
| 58 |
|
---|
| 59 | protected:
|
---|
| 60 | virtual void paintEvent( QPaintEvent *e );
|
---|
| 61 | virtual void drawContents( QPainter * );
|
---|
| 62 | virtual void drawText( QPainter *, const QRect & );
|
---|
| 63 |
|
---|
| 64 | private:
|
---|
| 65 | void init();
|
---|
| 66 | int defaultIndent() const;
|
---|
| 67 |
|
---|
| 68 | class PrivateData;
|
---|
| 69 | PrivateData *d_data;
|
---|
| 70 | };
|
---|
| 71 |
|
---|
| 72 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.