QML Basic Types

QML supports a number of basic types.

A basic type is one that refers to a simple value, such as an int or a string. This contrasts with a QML Objects in Qt, which refers to an object with properties, signals, methods and so on. Unlike an object type, a basic type cannot be used to declare QML objects: it is not possible, for example, to declare an int{} object or a size{} object.

Basic types can be used to refer to a single value (e.g. int refers to a single number, string refers to a single free form text string in quotes).

When a variable or property holds a basic type and it is assigned to another variable or property, then a copy of the value is made. In JavaScript, this value is called a primitive value.

Supported Basic Types

Some basic types are supported by the engine by default and do not require an import statement to be used, while others do require the client to import the module which provides them. All of the basic types listed below may be used as a property type in a QML document.

Basic Types Provided By The QML Language

The basic types supported natively in the QML language are listed below:


Binary true/false value


Number with a decimal point


Named enumeration value


Whole number, e.g. 0, 10, or -20


Number with a decimal point


Free form text string

Basic Types Provided By QML Modules

QML modules may extend the QML language with more basic types. For example, the basic types provided by the QtQuick module are listed below:

The Qt global object provides useful functions for manipulating values of basic types.

Currently only QML modules which are provided by Qt may provide their own basic types, however this may change in future releases of Qt QML. In order to use types provided by a particular QML module, clients must import that module in their QML documents.

See also QML Type System in Qt.

Available under certain Qt licenses.
Find out more.