58
56
The text format defines the QwtTextEngine, that is used to render
62
The text format is determined using QwtTextEngine::mightRender for
63
all available text engines in increasing order > PlainText.
64
If none of the text engines can render the text is rendered
67
Draw the text as it is, using a QwtPlainTextEngine.
69
Use the Scribe framework (Qt Rich Text) to render the text.
71
Use a MathML (http://en.wikipedia.org/wiki/MathML) render engine
72
to display the text. The Qwt MathML extension offers such an engine
73
based on the MathML renderer of the Qt solutions package. Unfortunately
74
it is only available for owners of a commercial Qt license.
76
Use a TeX (http://en.wikipedia.org/wiki/TeX) render engine
79
The number of text formats can be extended using setTextEngine.
80
Formats >= OtherFormat are not used by Qwt.
82
59
\sa QwtTextEngine, setTextEngine()
65
The text format is determined using QwtTextEngine::mightRender for
66
all available text engines in increasing order > PlainText.
67
If none of the text engines can render the text is rendered
68
like QwtText::PlainText.
72
//! Draw the text as it is, using a QwtPlainTextEngine.
75
//! Use the Scribe framework (Qt Rich Text) to render the text.
79
Use a MathML (http://en.wikipedia.org/wiki/MathML) render engine
80
to display the text. The Qwt MathML extension offers such an engine
81
based on the MathML renderer of the Qt solutions package.
82
To enable MathML support the following code needs to be added to the
84
\verbatim QwtText::setTextEngine(QwtText::MathMLText, new QwtMathMLTextEngine()); \endverbatim
89
Use a TeX (http://en.wikipedia.org/wiki/TeX) render engine
90
to display the text ( not implemented yet ).
95
The number of text formats can be extended using setTextEngine.
96
Formats >= QwtText::OtherFormat are not used by Qwt.
99
102
\brief Paint Attributes
101
Font and color and background are optional attributes of a QwtText.
104
Font and color and background are optional attributes of a QwtText.
102
105
The paint attributes hold the information, if they are set.
104
- PaintUsingTextFont\n
105
The text has an individual font.
106
- PaintUsingTextColor\n
107
The text has an individual color.
109
The text has an individual background.
111
107
enum PaintAttribute
113
PaintUsingTextFont = 1,
114
PaintUsingTextColor = 2,
109
//! The text has an individual font.
110
PaintUsingTextFont = 0x01,
112
//! The text has an individual color.
113
PaintUsingTextColor = 0x02,
115
//! The text has an individual background.
116
PaintBackground = 0x04
120
typedef QFlags<PaintAttribute> PaintAttributes;
119
123
\brief Layout Attributes
121
124
The layout attributes affects some aspects of the layout of the text.
124
Layout the text without its margins. This mode is useful if a
125
text needs to be aligned accurately, like the tick labels of a scale.
126
If QwtTextEngine::textMargins is not implemented for the format
127
of the text, MinimumLayout has no effect.
129
126
enum LayoutAttribute
129
Layout the text without its margins. This mode is useful if a
130
text needs to be aligned accurately, like the tick labels of a scale.
131
If QwtTextEngine::textMargins is not implemented for the format
132
of the text, MinimumLayout has no effect.
134
QwtText(const QString & = QString::null,
135
TextFormat textFormat = AutoText);
136
QwtText(const QwtText &);
137
//! Layout attributes
138
typedef QFlags<LayoutAttribute> LayoutAttributes;
140
QwtText( const QString & = QString::null,
141
TextFormat textFormat = AutoText );
142
QwtText( const QwtText & );
139
QwtText &operator=(const QwtText &);
141
int operator==(const QwtText &) const;
142
int operator!=(const QwtText &) const;
144
void setText(const QString &,
145
QwtText::TextFormat textFormat = AutoText);
145
QwtText &operator=( const QwtText & );
147
bool operator==( const QwtText & ) const;
148
bool operator!=( const QwtText & ) const;
150
void setText( const QString &,
151
QwtText::TextFormat textFormat = AutoText );
146
152
QString text() const;
148
154
bool isNull() const;
149
155
bool isEmpty() const;
151
void setFont(const QFont &);
157
void setFont( const QFont & );
152
158
QFont font() const;
154
QFont usedFont(const QFont &) const;
160
QFont usedFont( const QFont & ) const;
156
void setRenderFlags(int flags);
162
void setRenderFlags( int flags );
157
163
int renderFlags() const;
159
void setColor(const QColor &);
165
void setColor( const QColor & );
160
166
QColor color() const;
162
QColor usedColor(const QColor &) const;
168
QColor usedColor( const QColor & ) const;
164
void setBackgroundPen(const QPen &);
170
void setBackgroundPen( const QPen & );
165
171
QPen backgroundPen() const;
167
void setBackgroundBrush(const QBrush &);
173
void setBackgroundBrush( const QBrush & );
168
174
QBrush backgroundBrush() const;
170
void setPaintAttribute(PaintAttribute, bool on = true);
171
bool testPaintAttribute(PaintAttribute) const;
173
void setLayoutAttribute(LayoutAttribute, bool on = true);
174
bool testLayoutAttribute(LayoutAttribute) const;
176
int heightForWidth(int width, const QFont & = QFont()) const;
177
QSize textSize(const QFont & = QFont()) const;
179
void draw(QPainter *painter, const QRect &rect) const;
181
static const QwtTextEngine *textEngine(const QString &text,
182
QwtText::TextFormat = AutoText);
184
static const QwtTextEngine *textEngine(QwtText::TextFormat);
185
static void setTextEngine(QwtText::TextFormat, QwtTextEngine *);
176
void setPaintAttribute( PaintAttribute, bool on = true );
177
bool testPaintAttribute( PaintAttribute ) const;
179
void setLayoutAttribute( LayoutAttribute, bool on = true );
180
bool testLayoutAttribute( LayoutAttribute ) const;
182
double heightForWidth( double width, const QFont & = QFont() ) const;
183
QSizeF textSize( const QFont & = QFont() ) const;
185
void draw( QPainter *painter, const QRectF &rect ) const;
187
static const QwtTextEngine *textEngine(
188
const QString &text, QwtText::TextFormat = AutoText );
190
static const QwtTextEngine *textEngine( QwtText::TextFormat );
191
static void setTextEngine( QwtText::TextFormat, QwtTextEngine * );
188
194
class PrivateData;