diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/quick/doc/snippets/qml/font.qml | 22 | ||||
| -rw-r--r-- | src/quick/doc/src/qmltypereference.qdoc | 10 |
2 files changed, 29 insertions, 3 deletions
diff --git a/src/quick/doc/snippets/qml/font.qml b/src/quick/doc/snippets/qml/font.qml new file mode 100644 index 0000000000..5f76d6fc30 --- /dev/null +++ b/src/quick/doc/snippets/qml/font.qml @@ -0,0 +1,22 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick + +Item { +//! [text] + Text { + font.family: "Helvetica" + font.pointSize: 13 + font.bold: true + } +//! [text] + +//! [structured-value-construction] + readonly property font myFont: ({ + family: "Helvetica", + pointSize: 13, + bold: true + }) +//! [structured-value-construction] +} diff --git a/src/quick/doc/src/qmltypereference.qdoc b/src/quick/doc/src/qmltypereference.qdoc index e1ebca8106..607f506e76 100644 --- a/src/quick/doc/src/qmltypereference.qdoc +++ b/src/quick/doc/src/qmltypereference.qdoc @@ -163,9 +163,13 @@ available when you import \c QtQuick. \endlist Example: - \qml - Text { font.family: "Helvetica"; font.pointSize: 13; font.bold: true } - \endqml + + \snippet qml/font.qml text + + As \c font is a \l {QML_STRUCTURED_VALUE}{structured value} type, it can + also be constructed with a JavaScript object: + + \snippet qml/font.qml structured-value-construction When integrating with C++, note that any QFont value \l{qtqml-cppintegration-data.html}{passed into QML from C++} is automatically |
