summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativetext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativetext.cpp')
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext.cpp96
1 files changed, 54 insertions, 42 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
index 2b8da8e..4e7e0fd 100644
--- a/src/declarative/graphicsitems/qdeclarativetext.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
@@ -116,7 +116,7 @@ QSet<QUrl> QTextDocumentWithImageResources::errors;
\brief The Text item allows you to add formatted text to a scene.
\inherits Item
- It can display both plain and rich text. For example:
+ A Text item can display both plain and rich text. For example:
\qml
Text { text: "Hello World!"; font.family: "Helvetica"; font.pointSize: 24; color: "red" }
@@ -132,8 +132,8 @@ QSet<QUrl> QTextDocumentWithImageResources::errors;
The \c elide property can alternatively be used to fit a single line of
plain text to a set width.
- Note that the \l{Supported HTML Subset} is limited, and that if IMG tags
- load remote images, the text reloads (see resourcesLoading).
+ Note that the \l{Supported HTML Subset} is limited. Also, if the text contains
+ HTML img tags that load remote images, the text is reloaded.
Text provides read-only text. For editable text, see \l TextEdit.
*/
@@ -142,7 +142,6 @@ QSet<QUrl> QTextDocumentWithImageResources::errors;
\internal
\class QDeclarativeText
\qmlclass Text
- \ingroup group_coreitems
\brief The QDeclarativeText class provides a formatted text item that you can add to a QDeclarativeView.
@@ -191,7 +190,7 @@ QDeclarativeTextPrivate::~QDeclarativeTextPrivate()
/*!
\qmlproperty bool Text::font.bold
- Sets the font's weight to bold.
+ Sets whether the font weight is bold.
*/
/*!
@@ -201,11 +200,11 @@ QDeclarativeTextPrivate::~QDeclarativeTextPrivate()
The weight can be one of:
\list
- \o Light
- \o Normal - the default
- \o DemiBold
- \o Bold
- \o Black
+ \o Font.Light
+ \o Font.Normal - the default
+ \o Font.DemiBold
+ \o Font.Bold
+ \o Font.Black
\endlist
\qml
@@ -216,25 +215,25 @@ QDeclarativeTextPrivate::~QDeclarativeTextPrivate()
/*!
\qmlproperty bool Text::font.italic
- Sets the style of the text to italic.
+ Sets whether the font has an italic style.
*/
/*!
\qmlproperty bool Text::font.underline
- Set the style of the text to underline.
+ Sets whether the text is underlined.
*/
/*!
\qmlproperty bool Text::font.outline
- Set the style of the text to outline.
+ Sets whether the font has an outline style.
*/
/*!
\qmlproperty bool Text::font.strikeout
- Set the style of the text to strikeout.
+ Sets whether the font has a strikeout style.
*/
/*!
@@ -278,11 +277,11 @@ QDeclarativeTextPrivate::~QDeclarativeTextPrivate()
Sets the capitalization for the text.
\list
- \o MixedCase - This is the normal text rendering option where no capitalization change is applied.
- \o AllUppercase - This alters the text to be rendered in all uppercase type.
- \o AllLowercase - This alters the text to be rendered in all lowercase type.
- \o SmallCaps - This alters the text to be rendered in small-caps type.
- \o Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character.
+ \o Font.MixedCase - This is the normal text rendering option where no capitalization change is applied.
+ \o Font.AllUppercase - This alters the text to be rendered in all uppercase type.
+ \o Font.AllLowercase - This alters the text to be rendered in all lowercase type.
+ \o Font.SmallCaps - This alters the text to be rendered in small-caps type.
+ \o Font.Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character.
\endlist
\qml
@@ -381,10 +380,10 @@ QColor QDeclarativeText::color() const
Supported text styles are:
\list
- \o Normal - the default
- \o Outline
- \o Raised
- \o Sunken
+ \o Text.Normal - the default
+ \o Text.Outline
+ \o Text.Raised
+ \o Text.Sunken
\endlist
\qml
@@ -452,9 +451,14 @@ QColor QDeclarativeText::styleColor() const
Sets the horizontal and vertical alignment of the text within the Text items
width and height. By default, the text is top-left aligned.
- The valid values for \c horizontalAlignment are \c AlignLeft, \c AlignRight and
- \c AlignHCenter. The valid values for \c verticalAlignment are \c AlignTop, \c AlignBottom
- and \c AlignVCenter.
+ The valid values for \c horizontalAlignment are \c Text.AlignLeft, \c Text.AlignRight and
+ \c Text.AlignHCenter. The valid values for \c verticalAlignment are \c Text.AlignTop, \c Text.AlignBottom
+ and \c Text.AlignVCenter.
+
+ Note that for a single line of text, the size of the text is the area of the text. In this common case,
+ all alignments are equivalent. If you want the text to be, say, centered in it parent, then you will
+ need to either modify the Item::anchors, or set horizontalAlignment to Text.AlignHCenter and bind the width to
+ that of the parent.
*/
QDeclarativeText::HAlignment QDeclarativeText::hAlign() const
{
@@ -495,16 +499,16 @@ void QDeclarativeText::setVAlign(VAlignment align)
wrap if an explicit width has been set. wrapMode can be one of:
\list
- \o NoWrap - no wrapping will be performed.
- \o WordWrap - wrapping is done on word boundaries. If the text cannot be
+ \o Text.NoWrap - no wrapping will be performed.
+ \o Text.WordWrap - wrapping is done on word boundaries. If the text cannot be
word-wrapped to the specified width it will be partially drawn outside of the item's bounds.
If this is undesirable then enable clipping on the item (Item::clip).
- \o WrapAnywhere - Text can be wrapped at any point on a line, even if it occurs in the middle of a word.
- \o WrapAtWordBoundaryOrAnywhere - If possible, wrapping occurs at a word boundary; otherwise it
+ \o Text.WrapAnywhere - Text can be wrapped at any point on a line, even if it occurs in the middle of a word.
+ \o Text.WrapAtWordBoundaryOrAnywhere - If possible, wrapping occurs at a word boundary; otherwise it
will occur at the appropriate point on the line, even in the middle of a word.
\endlist
- The default is NoWrap.
+ The default is Text.NoWrap.
*/
QDeclarativeText::WrapMode QDeclarativeText::wrapMode() const
{
@@ -531,13 +535,20 @@ void QDeclarativeText::setWrapMode(WrapMode mode)
The way the text property should be displayed.
- Supported text formats are \c AutoText, \c PlainText, \c RichText and \c StyledText
+ Supported text formats are:
+
+ \list
+ \o Text.AutoText
+ \o Text.PlainText
+ \o Text.RichText
+ \o Text.StyledText
+ \endlist
- The default is AutoText. If the text format is AutoText the text element
+ The default is Text.AutoText. If the text format is Text.AutoText the text element
will automatically determine whether the text should be treated as
rich text. This determination is made using Qt::mightBeRichText().
- StyledText is an optimized format supporting some basic text
+ Text.StyledText is an optimized format supporting some basic text
styling markup, in the style of html 3.2:
\code
@@ -548,7 +559,7 @@ void QDeclarativeText::setWrapMode(WrapMode mode)
&gt; &lt; &amp;
\endcode
- \c StyledText parser is strict, requiring tags to be correctly nested.
+ \c Text.StyledText parser is strict, requiring tags to be correctly nested.
\table
\row
@@ -616,13 +627,13 @@ void QDeclarativeText::setTextFormat(TextFormat format)
Eliding can be:
\list
- \o ElideNone - the default
- \o ElideLeft
- \o ElideMiddle
- \o ElideRight
+ \o Text.ElideNone - the default
+ \o Text.ElideLeft
+ \o Text.ElideMiddle
+ \o Text.ElideRight
\endlist
- If the text is a multi-length string, and the mode is not \c ElideNone,
+ If the text is a multi-length string, and the mode is not \c Text.ElideNone,
the first string that fits will be used, otherwise the last will be elided.
Multi-length strings are ordered from longest to shortest, separated by the
@@ -1069,8 +1080,9 @@ void QDeclarativeText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWid
/*!
\qmlproperty bool Text::smooth
- Set this property if you want the text to be smoothly scaled or
- transformed. Smooth filtering gives better visual quality, but is slower. If
+ This property holds whether the text is smoothly scaled or transformed.
+
+ Smooth filtering gives better visual quality, but is slower. If
the item is displayed at its natural size, this property has no visual or
performance effect.