summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qstatictext.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-02-16 11:52:07 (GMT)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-02-16 11:52:07 (GMT)
commite4d2a4bffa94bac919d2e0b0ad245b917b69b4d5 (patch)
tree0fd504fea70544c8eb11b93dd843243615ce8875 /src/gui/text/qstatictext.cpp
parente5a277fdd539c0de5e533b49a038e22929ace1dc (diff)
downloadQt-e4d2a4bffa94bac919d2e0b0ad245b917b69b4d5.zip
Qt-e4d2a4bffa94bac919d2e0b0ad245b917b69b4d5.tar.gz
Qt-e4d2a4bffa94bac919d2e0b0ad245b917b69b4d5.tar.bz2
doc: Update documentation for QStaticText
Make some smaller modifications, fixes and additions. Remove \internal because the API is public now, and add documentation for QPainter::drawStaticText() since this was missing. Reviewed-by: TrustMe
Diffstat (limited to 'src/gui/text/qstatictext.cpp')
-rw-r--r--src/gui/text/qstatictext.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp
index 6cf7022..e3f1d26 100644
--- a/src/gui/text/qstatictext.cpp
+++ b/src/gui/text/qstatictext.cpp
@@ -50,7 +50,6 @@ QT_BEGIN_NAMESPACE
/*!
\class QStaticText
- \internal
\brief The QStaticText class enables optimized drawing of text when the text and its layout
is updated rarely.
\since 4.7
@@ -63,11 +62,13 @@ QT_BEGIN_NAMESPACE
more efficiently than by using QPainter::drawText() in which the layout information is
recalculated with every call.
- The class primarily provides an optimization for cases where text and the transformations on
- the painter are static over several paint events. If the text or its layout is changed
- regularly, QPainter::drawText() is the more efficient alternative. Translating the painter
- will not cause the layout of the text to be recalculated, but will cause a very small
- performance impact on drawStaticText(). Altering any other parts of the painter's
+ The class primarily provides an optimization for cases where the text, its font and the
+ transformations on the painter are static over several paint events. If the text or its layout
+ is changed for every iteration, QPainter::drawText() is the more efficient alternative, since
+ the static text's layout would have to be recalculated to take the new state into consideration.
+
+ Translating the painter will not cause the layout of the text to be recalculated, but will cause
+ a very small performance impact on drawStaticText(). Altering any other parts of the painter's
transformation or the painter's font will cause the layout of the static text to be
recalculated. This should be avoided as often as possible to maximize the performance
benefit of using QStaticText.
@@ -107,6 +108,11 @@ QT_BEGIN_NAMESPACE
passed to QPainter::drawStaticText() and can change from call to call with a minimal impact
on performance.
+ QStaticText will attempt to guess the format of the input text using Qt::mightBeRichText().
+ To force QStaticText to display its contents as either plain text or rich text, use the
+ function QStaticText::setTextFormat() and pass in, respectively, Qt::PlainText and
+ Qt::RichText.
+
\sa QPainter::drawText(), QPainter::drawStaticText(), QTextLayout, QTextDocument
*/
@@ -119,11 +125,9 @@ QStaticText::QStaticText()
}
/*!
- \fn QStaticText::QStaticText(const QString &text, const QFont &font, const QSizeF &maximumSize)
+ Constructs a QStaticText object with the given \a text and bounded by the given \a size.
- Constructs a QStaticText object with the given \a text which is to be rendered in the given
- \a font and bounded by the given \a maximumSize. If an invalid size is passed for \a maximumSize
- the text will be unbounded.
+ If an invalid size is passed for \a size the text will be unbounded.
*/
QStaticText::QStaticText(const QString &text, const QSizeF &size)
: data(new QStaticTextPrivate)
@@ -302,11 +306,11 @@ bool QStaticText::useBackendOptimizations() const
}
/*!
- Sets the maximum size of the QStaticText to \a maximumSize.
+ Sets the maximum size of the QStaticText to \a size.
\note This function will cause the layout of the text to be recalculated.
- \sa maximumSize()
+ \sa maximumSize(), size()
*/
void QStaticText::setMaximumSize(const QSizeF &size)
{