// Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only /*! \page qtquick-usecase-text.html \title Use Case - Displaying Text In QML \brief Example of how to display text in QML To display text the Text type is provided by the \l {Qt Quick} module. For related uses, the \l{TextInput} and \l{TextEdit} types provide editable text controls. For full HTML markup, see the \l {Qt WebEngine} module. \section1 Displaying and Formatting Text To display text in QML, create a Text item and set the text property to the text you wish to display. The Text item will now display that text. Several properties can be set on the Text item to style the entire block of text. These include color, font family, font size, bold and italic. For a full list of properties, consult the \l{Text} type documentation. Rich text like markup can be used to selectively style specific sections of text with a Text item. Set \l Text::textFormat to Text.StyledText to use this functionality. More details are available in the documentation of the \l{Text} type. \section1 Laying Out Text By default, Text will display the text as a single line unless it contains embedded newlines. To wrap the line, set the wrapMode property and give the text an explicit width for it to wrap to. If the width or height is not explicitly set, reading these properties will return the parameters of the bounding rect of the text (if you have explicitly set width or height, you can still use paintedWidth and paintedHeight). With these parameters in mind, the Text can be positioned like any other Item. \section1 Example Code \snippet qmlapp/usecases/text.qml 0 \image qmlapp/qml-uses-text.png \section1 Internationalization and Scalability When dealing with texts, applications must take into account various topics such as the device's orientation and the language settings. The following pages go into detail about these various topics. \list \li \l{Right-to-left User Interfaces} \li \l{Internationalization with Qt} \li \l{Scalability} \endlist */