/**************************************************************************** ** ** Copyright (C) 2017 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$ ** ****************************************************************************/ /*! \qmlmodule QtQml 2.\QtMinorVersion \title Qt QML QML Types \ingroup qmlmodules \brief List of QML types provided by the Qt QML module The \l{Qt QML} module provides the definition and implementation of various convenience types which can be used with the QML language, including some elementary QML types which can provide the basis for further extensions to the QML language. The \l QtObject and \l Component object types are non-visual and provide building-blocks for extensions to QML. \section1 Importing QtQml The types provided by the \c QtQml module are only available in a QML document if that document imports the \c QtQml namespace (or if the document imports the \c QtQuick namespace, as noted below). The current version of the \c QtQml module is version 2.\QtMinorVersion, and thus it may be imported via the following statement: \qml \QtMinorVersion import QtQml 2.\1 \endqml Most clients will never need to use the \c QtQml import, as all of the types are also provided by the \c QtQuick namespace which may be imported as follows: \qml \QtMinorVersion import QtQuick 2.\1 \endqml See the \l{Qt Quick} module documentation for more information about the \c QtQuick namespace and what it provides to QML application developers. The QML types for creating lists and models, such as \l ListModel and \l ListElement, are moved to a submodule, \c QtQml.Models. The \l{Qt QML Models QML Types}{Qt QML Models} page has more information. The documentation for the types below applies equally to the types of the same name provided by the \l{Qt Quick} module, as they are in fact identical. \section1 Basic Types The following \l{qtqml-typesystem-basictypes.html}{QML basic types} are provided: \annotatedlist qtqmlbasictypes \section1 Object Types The following \l{qtqml-typesystem-objecttypes.html}{QML object types} are provided: */ /*! \qmlbasictype date \ingroup qtqmlbasictypes \ingroup qtquickbasictypes \brief a date value. The \c date type refers to a date value, including the time of the day. To create a \c date value, specify it as a "YYYY-MM-DDThh:mm:ss.zzzZ" string. (The T is literal, YYYY is a full year number, MM and DD are month and day numbers, hh, mm and ss are hours, minutes and seconds, with .zzz as milliseconds and Z as time-zone offset. The T and following time are optional. If they are omitted, the date is handled as the start of UTC's day, which falls on other dates in some time-zones. When T is included, the :ss.zzz or just .zzz part can be omitted. With or without those, the zone offset can be omitted, in which case local time is used.) For example: \qml MyDatePicker { minDate: "2000-01-01 0:0"; maxDate: "2020-12-31 23:59" } \endqml To read a date value returned from a C++ extension class, use \l{QtQml::Qt::formatDate()}{Qt.formatDate()} and \l{QtQml::Qt::formatDateTime()}{Qt.formatDateTime()}. When integrating with C++, note that any QDate or QDateTime value \l{qtqml-cppintegration-data.html}{passed into QML from C++} is automatically converted into a \c date value, and vice-versa. Note, however, that converting a QDate will result in UTC's start of the day, which falls on a different date in some other time-zones. It is usually more robust to convert the QDate via a QDateTime explicitly, specifying local-time or a relevant time-zone and selecting a time of day (such as noon) that reliably exists (daylight-savings transitions skip an hour, near one end or the other of a day). This basic type is provided by the QML language. It can be implicitly converted to a \l{QtQml::Date}{Date} object. \sa {QtQml::Date}{QML Date object}, {QML Basic Types} */ /*! \qmlbasictype point \ingroup qtqmlbasictypes \ingroup qtquickbasictypes \brief a value with x and y attributes. The \c point type refers to a value with \c x and \c y attributes. To create a \c point value, specify it as a "x,y" string: \qml CustomObject { myPointProperty: "0,20" } \endqml Or use the \l{QtQml::Qt::point()}{Qt.point()} function: \qml CustomObject { myPointProperty: Qt.point(0, 20) } \endqml When integrating with C++, note that any QPoint or QPointF value \l{qtqml-cppintegration-data.html}{passed into QML from C++} is automatically converted into a \c point value. When a \c point value is passed to C++, it is automatically converted into a QPointF value. \sa{QML Basic Types} */ /*! \qmlbasictype size \ingroup qtqmlbasictypes \ingroup qtquickbasictypes \brief a value with width and height attributes The \c size type refers to a value with has \c width and \c height attributes. For example, to read the \c width and \c height values of the \l {Image::sourceSize} size-type property: \qml Column { Image { id: image; source: "logo.png" } Text { text: image.sourceSize.width + "," + image.sourceSize.height } } \endqml To create a \c size value, specify it as a "width x height" string: \qml Image { sourceSize: "150x50" } \endqml Or use the \l{QtQml::Qt::size()}{Qt.size()} function: \qml Image { sourceSize: Qt.size(150, 50) } \endqml When integrating with C++, note that any QSize or QSizeF value \l{qtqml-cppintegration-data.html}{passed into QML from C++} is automatically converted into a \c size value, and vice-versa. When a \c size value is passed to C++, it is automatically converted into a QSizeF value. \sa{QML Basic Types} */ /*! \qmlbasictype rect \ingroup qtqmlbasictypes \ingroup qtquickbasictypes \brief a value with x, y, width and height attributes. The \c rect type refers to a value with \c x, \c y, \c width and \c height attributes. For example, to read the \c width and \c height values of the \l Item \l {Item::childrenRect.x}{childrenRect} rect-type property: \qml Rectangle { width: childrenRect.width height: childrenRect.height Rectangle { width: 100; height: 100 } } \endqml To create a \c rect value, specify it as a "x, y, width x height" string: \qml CustomObject { myRectProperty: "50,50,100x100" } \endqml Or use the \l{QtQml::Qt::rect()}{Qt.rect()} function: \qml CustomObject { myRectProperty: Qt.rect(50, 50, 100, 100) } \endqml The \c rect type also exposes read-only \c left, \c right, \c top and \c bottom attributes. These are the same as their \l {QRectF}{C++ counterparts}. When integrating with C++, note that any QRect or QRectF value \l{qtqml-cppintegration-data.html}{passed into QML from C++} is automatically converted into a \c rect value, and vice-versa. When a \c rect value is passed to C++, it is automatically converted into a QRectF value. \sa{QML Basic Types} */