| /**************************************************************************** |
| ** |
| ** Copyright (C) 2016 The Qt Company Ltd. |
| ** Contact: https://www.qt.io/licensing/ |
| ** |
| ** This file is part of the documentation of the Qt Toolkit. |
| ** |
| ** $QT_BEGIN_LICENSE:FDL$ |
| ** Commercial License Usage |
| ** Licensees holding valid commercial Qt licenses may use this file in |
| ** accordance with the commercial license agreement provided with the |
| ** Software or, alternatively, in accordance with the terms contained in |
| ** a written agreement between you and The Qt Company. For licensing terms |
| ** and conditions see https://www.qt.io/terms-conditions. For further |
| ** information use the contact form at https://www.qt.io/contact-us. |
| ** |
| ** GNU Free Documentation License Usage |
| ** Alternatively, this file may be used under the terms of the GNU Free |
| ** Documentation License version 1.3 as published by the Free Software |
| ** Foundation and appearing in the file included in the packaging of |
| ** this file. Please review the following information to ensure |
| ** the GNU Free Documentation License version 1.3 requirements |
| ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. |
| ** $QT_END_LICENSE$ |
| ** |
| ****************************************************************************/ |
| /*! |
| \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 and Localization with Qt Quick} |
| \li \l{Scalability} |
| \endlist |
| |
| */ |