Qwt User's Guide 6.2.0

qwt_text_label.h
1 /******************************************************************************
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
16 #include <qframe.h>
17
18 class QString;
19 class QPaintEvent;
20 class QPainter;
21
26 class QWT_EXPORT QwtTextLabel : public QFrame
27 {
28 Q_OBJECT
29
30 Q_PROPERTY( int indent READ indent WRITE setIndent )
31 Q_PROPERTY( int margin READ margin WRITE setMargin )
32 Q_PROPERTY( QString plainText READ plainText WRITE setPlainText )
33
34 public:
35 explicit QwtTextLabel( QWidget* parent = NULL );
36 explicit QwtTextLabel( const QwtText&, QWidget* parent = NULL );
37 virtual ~QwtTextLabel();
38
39 void setPlainText( const QString& );
40 QString plainText() const;
41
42 public Q_SLOTS:
43 void setText( const QString&,
44 QwtText::TextFormat textFormat = QwtText::AutoText );
45 virtual void setText( const QwtText& );
46
47 void clear();
48
49 public:
50 const QwtText& text() const;
51
52 int indent() const;
53 void setIndent( int );
54
55 int margin() const;
56 void setMargin( int );
57
58 virtual QSize sizeHint() const QWT_OVERRIDE;
59 virtual QSize minimumSizeHint() const QWT_OVERRIDE;
60 virtual int heightForWidth( int ) const QWT_OVERRIDE;
61
62 QRect textRect() const;
63
64 virtual void drawText( QPainter*, const QRectF& );
65
66 protected:
67 virtual void paintEvent( QPaintEvent* ) QWT_OVERRIDE;
68 virtual void drawContents( QPainter* );
69
70 private:
71 void init();
72 int defaultIndent() const;
73
74 class PrivateData;
75 PrivateData* m_data;
76 };
77
78 #endif
QwtText
A class representing a text.
Definition: qwt_text.h:52
QwtText::TextFormat
TextFormat
Text format.
Definition: qwt_text.h:65
QwtText::AutoText
@ AutoText
Definition: qwt_text.h:72
QwtTextLabel
A Widget which displays a QwtText.
Definition: qwt_text_label.h:27