1
.TH "QwtText" 3 "24 May 2008" "Version 5.1.1" "Qwt User's Guide" \" -*- nroff -*-
9
.SH "Detailed Description"
11
A class representing a text.
13
A \fBQwtText\fP is a text including a set of attributes how to render it.
18
A text might include control sequences (f.e tags) describing how to render it. Each format (f.e MathML, TeX, Qt Rich Text) has its own set of control sequences, that can be handles by a \fBQwtTextEngine\fP for this format.
22
A text might have a background, defined by a QPen and QBrush to improve its visibility.
26
A text might have an individual font.
30
A text might have an individual color.
34
Flags from Qt::AlignmentFlag and Qt::TextFlag used like in QPainter::drawText.
39
\fBQwtTextEngine\fP, \fBQwtTextLabel\fP
44
Definition at line 51 of file qwt_text.h.
49
.RI "enum \fBTextFormat\fP { \fBAutoText\fP = 0, \fBPlainText\fP, \fBRichText\fP, \fBMathMLText\fP, \fBTeXText\fP, \fBOtherFormat\fP = 100 }"
52
.RI "enum \fBPaintAttribute\fP { \fBPaintCached\fP = 1, \fBPaintPacked\fP = 2, \fBPaintFiltered\fP = 1, \fBClipPolygons\fP = 2, \fBPaintUsingTextFont\fP = 1, \fBPaintUsingTextColor\fP = 2, \fBPaintBackground\fP = 4 }"
55
.RI "enum \fBLayoutAttribute\fP { \fBMinimumLayout\fP = 1 }"
58
.SS "Public Member Functions"
62
.RI "\fBQwtText\fP (const QString &=QString::null, \fBTextFormat\fP textFormat=AutoText)"
65
.RI "\fBQwtText\fP (const \fBQwtText\fP &)"
68
.RI "\fB~QwtText\fP ()"
71
.RI "\fBQwtText\fP & \fBoperator=\fP (const \fBQwtText\fP &)"
74
.RI "int \fBoperator==\fP (const \fBQwtText\fP &) const"
77
.RI "int \fBoperator!=\fP (const \fBQwtText\fP &) const"
80
.RI "void \fBsetText\fP (const QString &, \fBQwtText::TextFormat\fP textFormat=AutoText)"
83
.RI "QString \fBtext\fP () const"
86
.RI "bool \fBisNull\fP () const"
89
.RI "bool \fBisEmpty\fP () const"
92
.RI "void \fBsetFont\fP (const QFont &)"
95
.RI "QFont \fBfont\fP () const"
98
.RI "QFont \fBusedFont\fP (const QFont &) const "
101
.RI "void \fBsetRenderFlags\fP (int flags)"
104
.RI "int \fBrenderFlags\fP () const"
107
.RI "void \fBsetColor\fP (const QColor &)"
110
.RI "QColor \fBcolor\fP () const"
113
.RI "QColor \fBusedColor\fP (const QColor &) const"
116
.RI "void \fBsetBackgroundPen\fP (const QPen &)"
119
.RI "QPen \fBbackgroundPen\fP () const"
122
.RI "void \fBsetBackgroundBrush\fP (const QBrush &)"
125
.RI "QBrush \fBbackgroundBrush\fP () const"
128
.RI "void \fBsetPaintAttribute\fP (\fBPaintAttribute\fP, bool on=true)"
131
.RI "bool \fBtestPaintAttribute\fP (\fBPaintAttribute\fP) const"
134
.RI "void \fBsetLayoutAttribute\fP (\fBLayoutAttribute\fP, bool on=true)"
137
.RI "bool \fBtestLayoutAttribute\fP (\fBLayoutAttribute\fP) const"
140
.RI "int \fBheightForWidth\fP (int width, const QFont &=QFont()) const"
143
.RI "QSize \fBtextSize\fP (const QFont &=QFont()) const"
146
.RI "void \fBdraw\fP (QPainter *painter, const QRect &rect) const"
149
.SS "Static Public Member Functions"
153
.RI "static const \fBQwtTextEngine\fP * \fBtextEngine\fP (const QString &text, \fBQwtText::TextFormat\fP=AutoText)"
156
.RI "static const \fBQwtTextEngine\fP * \fBtextEngine\fP (\fBQwtText::TextFormat\fP)"
159
.RI "static void \fBsetTextEngine\fP (\fBQwtText::TextFormat\fP, \fBQwtTextEngine\fP *)"
162
.SH "Member Enumeration Documentation"
164
.SS "enum \fBQwtText::TextFormat\fP"
168
The text format defines the \fBQwtTextEngine\fP, that is used to render the text.
173
The text format is determined using \fBQwtTextEngine::mightRender\fP for all available text engines in increasing order > PlainText. If none of the text engines can render the text is rendered like PlainText.
177
Draw the text as it is, using a \fBQwtPlainTextEngine\fP.
181
Use the Scribe framework (Qt Rich Text) to render the text.
185
Use a MathML (http://en.wikipedia.org/wiki/MathML) render engine to display the text. The Qwt MathML extension offers such an engine based on the MathML renderer of the Qt solutions package. Unfortunately it is only available for owners of a commercial Qt license.
189
Use a TeX (http://en.wikipedia.org/wiki/TeX) render engine to display the text.
193
The number of text formats can be extended using setTextEngine. Formats >= OtherFormat are not used by Qwt.
198
\fBQwtTextEngine\fP, \fBsetTextEngine\fP
203
Definition at line 85 of file qwt_text.h.
204
.SS "enum \fBQwtText::PaintAttribute\fP"
208
Font and color and background are optional attributes of a \fBQwtText\fP. The paint attributes hold the information, if they are set.
213
The text has an individual font.
217
The text has an individual color.
221
The text has an individual background.
225
Definition at line 111 of file qwt_text.h.
226
.SS "enum \fBQwtText::LayoutAttribute\fP"
230
The layout attributes affects some aspects of the layout of the text.
235
Layout the text without its margins. This mode is useful if a text needs to be aligned accurately, like the tick labels of a scale. If \fBQwtTextEngine::textMargins\fP is not implemented for the format of the text, MinimumLayout has no effect.
239
Definition at line 129 of file qwt_text.h.
240
.SH "Constructor & Destructor Documentation"
242
.SS "QwtText::QwtText (const QString & text = \fCQString::null\fP, \fBQwtText::TextFormat\fP textFormat = \fCAutoText\fP)"
248
\fItext\fP Text content
250
\fItextFormat\fP Text format
255
Definition at line 180 of file qwt_text.cpp.
257
References textEngine().
258
.SS "QwtText::QwtText (const \fBQwtText\fP &)"
262
Definition at line 190 of file qwt_text.cpp.
264
References d_data, and d_layoutCache.
265
.SS "QwtText::~QwtText ()"
269
Definition at line 200 of file qwt_text.cpp.
270
.SH "Member Function Documentation"
272
.SS "\fBQwtText\fP & QwtText::operator= (const \fBQwtText\fP &)"
274
Assignement operator.
276
Definition at line 207 of file qwt_text.cpp.
278
References d_data, and d_layoutCache.
279
.SS "void QwtText::setText (const QString & text, \fBQwtText::TextFormat\fP textFormat = \fCAutoText\fP)"
281
Assign a new text content
285
\fItext\fP Text content
287
\fItextFormat\fP Text format
292
Definition at line 237 of file qwt_text.cpp.
294
References textEngine().
295
.SS "QString QwtText::text () const"
306
Definition at line 249 of file qwt_text.cpp.
308
Referenced by QwtPlot::grabProperties().
309
.SS "bool QwtText::isNull () const\fC [inline]\fP"
313
\fBtext()\fP.\fBisNull()\fP
318
Definition at line 149 of file qwt_text.h.
319
.SS "bool QwtText::isEmpty () const\fC [inline]\fP"
323
\fBtext()\fP.\fBisEmpty()\fP
328
Definition at line 152 of file qwt_text.h.
330
Referenced by QwtScaleDraw::boundingLabelRect(), QwtScaleDraw::drawLabel(), QwtRoundScaleDraw::drawLabel(), QwtPicker::drawTracker(), QwtRoundScaleDraw::extent(), QwtScaleDraw::labelRect(), and QwtPicker::trackerRect().
331
.SS "void QwtText::setFont (const QFont & font)"
342
Setting the font might have no effect, when the text contains control sequences for setting fonts.
347
Definition at line 289 of file qwt_text.cpp.
349
References setPaintAttribute().
351
Referenced by QwtPlotPrintFilter::apply(), and QwtPicker::drawTracker().
352
.SS "QFont QwtText::font () const"
356
Definition at line 296 of file qwt_text.cpp.
358
Referenced by QwtPlotPrintFilter::apply(), draw(), heightForWidth(), and textSize().
359
.SS "QFont QwtText::usedFont (const QFont & defaultFont) const"
361
Return the font of the text, if it has one. Otherwise return defaultFont.
365
\fIdefaultFont\fP Default font
370
\fBsetFont\fP, \fBfont\fP, PaintAttributes
375
Definition at line 308 of file qwt_text.cpp.
377
Referenced by QwtPicker::drawTracker(), heightForWidth(), and textSize().
378
.SS "void QwtText::setRenderFlags (int renderFlags)"
380
Change the render flags.
382
The default setting is Qt::AlignCenter
386
\fIrenderFlags\fP Bitwise OR of the flags used like in QPainter::drawText
391
\fBrenderFlags\fP, \fBQwtTextEngine::draw\fP
396
Some renderFlags might have no effect, depending on the text format.
401
Definition at line 264 of file qwt_text.cpp.
403
Referenced by QwtScaleWidget::drawTitle(), QwtLegendItem::setText(), QwtScaleWidget::setTitle(), and QwtAbstractScaleDraw::tickLabel().
404
.SS "int QwtText::renderFlags () const"
418
Definition at line 277 of file qwt_text.cpp.
420
Referenced by QwtScaleWidget::setTitle().
421
.SS "void QwtText::setColor (const QColor & color)"
423
Set the pen color used for painting the text.
432
Setting the color might have no effect, when the text contains control sequences for setting colors.
437
Definition at line 323 of file qwt_text.cpp.
439
References setPaintAttribute().
441
Referenced by QwtPlotPrintFilter::apply(), and QwtPlotPrintFilter::reset().
442
.SS "QColor QwtText::color () const"
444
Return the pen color, used for painting the text.
446
Definition at line 330 of file qwt_text.cpp.
448
Referenced by QwtPlotPrintFilter::apply().
449
.SS "QColor QwtText::usedColor (const QColor & defaultColor) const"
451
Return the color of the text, if it has one. Otherwise return defaultColor.
455
\fIdefaultColor\fP Default color
460
\fBsetColor\fP, \fBcolor\fP, PaintAttributes
465
Definition at line 342 of file qwt_text.cpp.
466
.SS "void QwtText::setBackgroundPen (const QPen & pen)"
468
Set the background pen
472
\fIpen\fP Background pen
477
\fBbackgroundPen\fP, \fBsetBackgroundBrush\fP
482
Definition at line 356 of file qwt_text.cpp.
484
References setPaintAttribute().
485
.SS "QPen QwtText::backgroundPen () const"
494
\fBsetBackgroundPen\fP, \fBbackgroundBrush\fP
499
Definition at line 366 of file qwt_text.cpp.
500
.SS "void QwtText::setBackgroundBrush (const QBrush & brush)"
502
Set the background brush
506
\fIbrush\fP Background brush
511
\fBbackgroundBrush\fP, \fBsetBackgroundPen\fP
516
Definition at line 377 of file qwt_text.cpp.
518
References setPaintAttribute().
519
.SS "QBrush QwtText::backgroundBrush () const"
528
\fBsetBackgroundBrush\fP, \fBbackgroundPen\fP
533
Definition at line 387 of file qwt_text.cpp.
534
.SS "void QwtText::setPaintAttribute (\fBPaintAttribute\fP attribute, bool on = \fCtrue\fP)"
536
Change a paint attribute
540
\fIattribute\fP Paint attribute
547
Used by setFont, setColor, setBackgroundPen and setBackgroundBrush
552
\fBtestPaintAttribute\fP
557
Definition at line 401 of file qwt_text.cpp.
559
Referenced by setBackgroundBrush(), setBackgroundPen(), setColor(), and setFont().
560
.SS "bool QwtText::testPaintAttribute (\fBPaintAttribute\fP attribute) const"
562
Test a paint attribute
566
\fIattribute\fP Paint attribute
571
true, if attribute is enabled
576
\fBsetPaintAttribute\fP
581
Definition at line 417 of file qwt_text.cpp.
583
Referenced by QwtPlotPrintFilter::apply().
584
.SS "void QwtText::setLayoutAttribute (\fBLayoutAttribute\fP attribute, bool on = \fCtrue\fP)"
586
Change a layout attribute
590
\fIattribute\fP Layout attribute
597
\fBtestLayoutAttribute\fP
602
Definition at line 429 of file qwt_text.cpp.
603
.SS "bool QwtText::testLayoutAttribute (\fBLayoutAttribute\fP attribute) const"
605
Test a layout attribute
609
\fIattribute\fP Layout attribute
614
true, if attribute is enabled
619
\fBsetLayoutAttribute\fP
624
Definition at line 445 of file qwt_text.cpp.
625
.SS "int QwtText::heightForWidth (int width, const QFont & defaultFont = \fCQFont()\fP) const"
627
Find the height for a given width
631
\fIdefaultFont\fP Font, used for the calculation if the text has no font
643
Definition at line 458 of file qwt_text.cpp.
645
References font(), QwtMetricsMap::layoutToScreenX(), QwtPainter::metricsMap(), QwtMetricsMap::screenToLayoutY(), and usedFont().
646
.SS "QSize QwtText::textSize (const QFont & defaultFont = \fCQFont()\fP) const"
648
Returns the size, that is needed to render text
652
\fIdefaultFont\fP Font of the text
662
Definition at line 510 of file qwt_text.cpp.
664
References font(), QwtMetricsMap::isIdentity(), QwtPainter::metricsMap(), QwtMetricsMap::screenToLayout(), and usedFont().
666
Referenced by QwtScaleDraw::boundingLabelRect(), QwtScaleDraw::drawLabel(), QwtRoundScaleDraw::drawLabel(), QwtRoundScaleDraw::extent(), QwtScaleDraw::labelRect(), and QwtPicker::trackerRect().
667
.SS "void QwtText::draw (QPainter * painter, const QRect & rect) const"
669
Draw a text into a rectangle
673
\fIpainter\fP Painter
680
Definition at line 564 of file qwt_text.cpp.
682
References QwtPainter::drawRect(), font(), QwtPainter::metricsMap(), QwtMetricsMap::screenToLayoutX(), and QwtMetricsMap::screenToLayoutY().
684
Referenced by QwtLegendItem::drawItem(), QwtScaleDraw::drawLabel(), QwtRoundScaleDraw::drawLabel(), QwtScaleWidget::drawTitle(), QwtPicker::drawTracker(), and QwtPlot::printTitle().
685
.SS "const \fBQwtTextEngine\fP * QwtText::textEngine (const QString & text, \fBQwtText::TextFormat\fP format = \fCAutoText\fP)\fC [static]\fP"
687
Find the text engine for a text format
689
In case of QwtText::AutoText the first text engine (beside \fBQwtPlainTextEngine\fP) is returned, where \fBQwtTextEngine::mightRender\fP returns true. If there is none \fBQwtPlainTextEngine\fP is returnd.
691
If no text engine is registered for the format \fBQwtPlainTextEngine\fP is returnd.
695
\fItext\fP Text, needed in case of AutoText
697
\fIformat\fP Text format
702
Definition at line 646 of file qwt_text.cpp.
704
Referenced by QwtText(), and setText().
705
.SS "const \fBQwtTextEngine\fP * QwtText::textEngine (\fBQwtText::TextFormat\fP format)\fC [static]\fP"
707
Find the text engine for a text format.
709
textEngine can be used to find out if a text format is supported. F.e, if one wants to use MathML labels, the MathML renderer from the commercial Qt solutions package might be required, that is not available in Qt Open Source Edition environments.
713
\fIformat\fP Text format
718
The text engine, or NULL if no engine is available.
723
Definition at line 701 of file qwt_text.cpp.
724
.SS "void QwtText::setTextEngine (\fBQwtText::TextFormat\fP format, \fBQwtTextEngine\fP * engine)\fC [static]\fP"
726
Assign/Replace a text engine for a text format
728
With setTextEngine it is possible to extend Qwt with other types of text formats.
730
Owner of a commercial Qt license can build the qwtmathml library, that is based on the MathML renderer, that is included in MML Widget component of the Qt solutions package.
732
For QwtText::PlainText it is not allowed to assign a engine == NULL.
736
\fIformat\fP Text format
738
\fIengine\fP Text engine
743
\fBQwtMathMLTextEngine\fP
748
Using QwtText::AutoText does nothing.
753
Definition at line 681 of file qwt_text.cpp.
757
Generated automatically by Doxygen for Qwt User's Guide from the source code.