Qwt User's Guide 6.1.1

- Main Page
- Related Pages
- Classes

All Classes Functions Variables Typedefs Enumerations Enumerator Pages
qwt_text_engine.h
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2003 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_ENGINE_H
11 #define QWT_TEXT_ENGINE_H 1
12
13 #include "qwt_global.h"
14 #include <qsize.h>
15
16 class QFont;
17 class QRectF;
18 class QString;
19 class QPainter;
20
35 class QWT_EXPORT QwtTextEngine
36 {
37 public:
38 virtual ~QwtTextEngine();
39
50 virtual double heightForWidth( const QFont &font, int flags,
51 const QString &text, double width ) const = 0;
52
62 virtual QSizeF textSize( const QFont &font, int flags,
63 const QString &text ) const = 0;
64
71 virtual bool mightRender( const QString &text ) const = 0;
72
88 virtual void textMargins( const QFont &font, const QString &text,
89 double &left, double &right, double &top, double &bottom ) const = 0;
90
99 virtual void draw( QPainter *painter, const QRectF &rect,
100 int flags, const QString &text ) const = 0;
101
102 protected:
103 QwtTextEngine();
104 };
105
106
113 class QWT_EXPORT QwtPlainTextEngine: public QwtTextEngine
114 {
115 public:
116 QwtPlainTextEngine();
117 virtual ~QwtPlainTextEngine();
118
119 virtual double heightForWidth( const QFont &font, int flags,
120 const QString &text, double width ) const;
121
122 virtual QSizeF textSize( const QFont &font, int flags,
123 const QString &text ) const;
124
125 virtual void draw( QPainter *painter, const QRectF &rect,
126 int flags, const QString &text ) const;
127
128 virtual bool mightRender( const QString & ) const;
129
130 virtual void textMargins( const QFont &, const QString &,
131 double &left, double &right, double &top, double &bottom ) const;
132
133 private:
134 class PrivateData;
135 PrivateData *d_data;
136 };
137
138
139 #ifndef QT_NO_RICHTEXT
140
147 class QWT_EXPORT QwtRichTextEngine: public QwtTextEngine
148 {
149 public:
150 QwtRichTextEngine();
151
152 virtual double heightForWidth( const QFont &font, int flags,
153 const QString &text, double width ) const;
154
155 virtual QSizeF textSize( const QFont &font, int flags,
156 const QString &text ) const;
157
158 virtual void draw( QPainter *painter, const QRectF &rect,
159 int flags, const QString &text ) const;
160
161 virtual bool mightRender( const QString & ) const;
162
163 virtual void textMargins( const QFont &, const QString &,
164 double &left, double &right, double &top, double &bottom ) const;
165
166 private:
167 QString taggedText( const QString &, int flags ) const;
168 };
169
170 #endif // !QT_NO_RICHTEXT
171
172 #endif
QwtTextEngine::mightRender
virtual bool mightRender(const QString &text) const =0
QwtPlainTextEngine
A text engine for plain texts.
Definition: qwt_text_engine.h:113
QwtTextEngine::draw
virtual void draw(QPainter *painter, const QRectF &rect, int flags, const QString &text) const =0
QwtTextEngine::textSize
virtual QSizeF textSize(const QFont &font, int flags, const QString &text) const =0
QwtTextEngine::heightForWidth
virtual double heightForWidth(const QFont &font, int flags, const QString &text, double width) const =0
QwtRichTextEngine
A text engine for Qt rich texts.
Definition: qwt_text_engine.h:147
QwtTextEngine::textMargins
virtual void textMargins(const QFont &font, const QString &text, double &left, double &right, double &top, double &bottom) const =0
QwtTextEngine
Abstract base class for rendering text strings.
Definition: qwt_text_engine.h:35