Qt QML Reference Documentation

Binding

Binding to an Inaccessible Property

Conditional Bindings

C++ Extensions: Network Access Manager Factory Example

Component

Creation Context

Connections

Creating C++ Plugins for QML

Creating a Plugin

TimeExample QML extension plugin

Project settings for the plugin

Plugin definition in the qmldir

Reference

Creating Resource Files

Data Type Conversion Between QML and C++

QTime to JavaScript Date

Data Ownership

Basic Qt Data Types

QObject-derived Types

Conversion Between Qt and JavaScript Types

QVariantList and QVariantMap to JavaScript Array and Object

QDateTime to JavaScript Date

QTime and JavaScript Date

Sequence Type to JavaScript Array

QByteArray to JavaScript ArrayBuffer

Value Types

Enumeration Types

Enumeration Types as Signal and Method Parameters

Date

Format Enumeration Values

Format Strings

Further Notes

Defining JavaScript Resources in QML

Code-Behind Implementation Resource

Shared JavaScript Resources (Libraries)

Defining Object Types through QML Documents

Defining an Object Type with a QML File

Naming Custom QML Object Types

Custom QML Type Definition

Inline Components

Importing Types Defined Outside the Current Directory

Accessible Attributes of Custom Types

Defining QML Types from C++

Integrating QML and C++ - Attached Properties

Registering C++ Types with the QML Type System

Preconditions

Registering an Instantiable Object Type

Registering Non-Instantiable Types

Registering Singleton Objects with a Singleton Type

Type Revisions and Versions

Registering Extension Objects

Defining QML-Specific Types and Attributes

Providing Attached Properties

Steps for Implementing Attached Objects

Implementing Attached Objects: An Example

Property Modifier Types

Property Value Sources

Specifying Default Properties for QML Object Types

Defining Visual Items with the Qt Quick Module

Receiving Notifications for Object Initialization

Dynamic QML Object Creation from JavaScript

Creating Objects Dynamically

Creating a Component Dynamically

Creating an Object from a String of QML

Maintaining Dynamically Created Objects

Deleting Objects Dynamically

ECMA-262

Embedding C++ Objects into QML with Context Properties

Setting a Simple Context Property

Setting an Object as a Context Property

Exposing Attributes of C++ Types to QML

Integrating QML and C++ - Grouped Properties

Data Type Handling and Ownership

Exposing Properties

Notes on Use of Notify Signals

Properties with Object Types

Properties with Object-List Types

Grouped Properties

Exposing Methods (Including Qt Slots)

Exposing Signals

Extending QML - Adding Types Example

Declare the Person Class

Define the Person Class

Running the Example

Extending QML - Attached Properties Example

Extending QML - Binding Example

Extending QML - Default Property Example

Declaring the BirthdayParty Class

Running the Example

Extending QML - Extension Objects Example

Extending QML - Grouped Properties Example

Extending QML - Inheritance and Coercion Example

Declare Boy and Girl

Define People as a Base Class

Define Boy and Girl

Running the Example

Extending QML - Methods Example

Extending QML - Object and List Property Types Example

Declare the BirthdayParty

Define the BirthdayParty

Running the Example

Extending QML - Property Value Source Example

Extending QML - Signal Support Example

Felgo QML Hot Reload Tool

FinalState

Example Usage

Fine-tuning the JavaScript Engine

Font Awesome

GammaRay

HistoryState

Example Usage

Identified Modules

Locally Installed Identified Modules

An Example

Remotely Installed Identified Modules

Semantics of Identified Modules

Import Statements

Syntax of an Import Statement

Module (Namespace) Imports

C++ Module Imports

Importing into a Qualified Local Namespace

Directory Imports

JavaScript Resource Imports

JavaScript Resources from Modules

Further Information

QML Import Path

Debugging

Important C++ Classes Provided By The Qt QML Module

QML Runtime

The QQmlEngine Class

The QQmlContext Class

Dynamic Object Instantiation and Expression Evaluation

The QQmlComponent Class

The QQmlExpression Class

Usage of the Classes within QML Applications

Importing JavaScript Resources in QML

Importing a JavaScript Resource from a QML Document

Imports Within JavaScript Resources

Importing a JavaScript Resource from Another JavaScript Resource

Importing a QML Module from a JavaScript Resource

Importing QML Document Directories

Local Directory Imports

An Example

Remotely Located Directories

Directory Listing qmldir Files

Integrating QML and C++

Integrating QML and JavaScript

JavaScript Expressions

JavaScript Resources

JavaScript Imports

JavaScript Host Environment

Fine Tuning the JavaScript engine

Interacting with QML Objects from C++

Loading QML Objects from C++

Accessing Loaded QML Objects by Object Name

Accessing Members of a QML Object Type from C++

Properties

Invoking QML Methods

Connecting to QML Signals

JavaScript Expressions in QML Documents

JavaScript in property bindings

JavaScript in signal handlers

JavaScript in standalone functions

JavaScript in custom methods

Functions defined in a JavaScript file

Connecting signals to JavaScript functions

JavaScript in application startup code

JavaScript Host Environment

Common Base

QML Global Object

JavaScript Objects and Functions

JavaScript Environment Restrictions

JavaScriptCore Macro Assembler

Legacy Modules

Installed Legacy Modules

Located Legacy Modules

List of JavaScript Objects and Functions

The Global Object

Value Properties

Function Properties

Constructor Properties

Other Properties

The Object Object

Object Constructor

Function Properties

Object Prototype

Function Properties

Function Objects

Function Prototype

Function Properties

Array Objects

Array Prototype Object

Function Properties

String Objects

String Prototype Object

Function Properties

Boolean Objects

Boolean Prototype Object

Function Properties

Number Objects

Number Prototype Object

Function Properties

The Number Object

Value Properties

Function Properties

The Math Object

Value Properties

Function Properties

Date Objects

Date Prototype Object

Function Properties

RegExp Objects

RegExp Prototype Object

Function Properties

Error Objects

Error Prototype Object

Value Properties

Function Properties

The JSON Object

Function Properties

Locale

FormatType

Locale String Format Types

LoggingCategory

Making Applications Scriptable

Scripting Classes

Basic Usage

Making a QObject Available to the Script Engine

Implications for Application Security

Module Definition qmldir Files

Contents of a Module Definition qmldir File

Versioning Semantics

Example of a qmldir File

Writing a qmltypes File

Mozilla Developer Network Date Reference

Nullish Coalescing

Number

Overview - QML and C++ Integration

Choosing the Correct Integration Method Between C++ and QML

Exposing Attributes of C++ Classes to QML

Defining QML Types from C++

Embedding C++ Objects into QML with Context Properties

Interacting with QML Objects from C++

Data Type Conversion Between QML and C++

Property Binding

Overview

Creating Property Bindings from JavaScript

Debugging overwriting of bindings

Using <@keyword>this</@keyword> with Property Binding

QAbstractState

QAbstractTransition

Evaluating Scripts

Engine Configuration

Script Exceptions

Script Object Creation

QObject Integration

Dynamic QObject Properties

Extensions

Working With Arrays

QML Basic Types

Supported Basic Types

Basic Types Provided By The QML Language

Basic Types Provided By QML Modules

Property Change Behavior for Basic Types

QML Debugger

QML Documents

Structure of a QML Document

Syntax of the QML Language

Defining Object Types Through QML Documents

Resource Loading and Network Transparency

Scope and Naming Resolution

QML Example - Dynamic Scene

QML Examples - Internationalization

QML Global Object

XMLHttpRequest

XMLHttpRequest

QML Modules

Defining a QML Module

Supported QML Module Types

Providing Types and Functionality in a C++ Plugin

QML Object Attributes

Attributes in Object Declarations

The id Attribute

Property Attributes

Defining Property Attributes

Valid Types in Custom Property Definitions

Assigning Values to Property Attributes

Value Assignment on Initialization

Imperative Value Assignment

Static Values and Binding Expression Values

Type Safety

Special Property Types

Object List Property Attributes

Grouped Properties

Property Aliases

Considerations for Property Aliases

Property Aliases and Types

Default Properties

Required Properties

Read-Only Properties

Property Modifier Objects

Signal Attributes

Defining Signal Attributes

Property Change Signals

Signal Handler Attributes

Property Change Signal Handlers

Method Attributes

Defining Method Attributes

Attached Properties and Attached Signal Handlers

A Note About Accessing Attached Properties and Signal Handlers

Enumeration Attributes

QML Object Types

Defining Object Types from QML

Defining Object Types Through QML Documents

Defining Anonymous Types with Component

Defining Object Types from C++

QML Plugin Example

QML Profiler

QML Syntax Basics

Import Statements

Object Declarations

Child Objects

Comments

Network Components

The Context Hierarchy

TimeExample QML extension plugin

Project settings for the plugin

Plugin definition in the qmldir

QSignalTransition

QmlLive

Qt

QmlGlobalQtObject

Enums

Types

Date/Time Formatters

Dynamic Object Creation

Other Functions

Qt Creator Manual

Qt QML

Getting Started

QML and QML Types

Lists and Models

JavaScript Environment for QML Applications

Integrating QML with C++ Applications

Additional Frameworks

Licenses and Attributions

Guides and Other Information

Reference

Qt Quick Examples - XMLHttpRequest

Running the Example

Get Data

Qt5 Cadaques

Resource Loading and Network Transparency

Relative vs. Absolute URLs

QRC Resources

Limitations

Implications for Application Security

Scope and Naming Resolution

JavaScript Scope

Type Names and Imported JavaScript Files

Binding Scope Object

Component Scope

Component Instance Hierarchy

Overridden Properties

JavaScript Global Object

Signal and Handler Event System

Receiving signals with signal handlers

Property change signal handlers

Using the Connections type

Attached signal handlers

Adding signals to custom QML types

Connecting signals to methods and signals

Signal to signal connect

Squish

Structure of a QML Document

Imports

The Root Object Declaration

The Declarative State Machine Framework

Using Both QtQuick and QtQml.StateMachine Imports

A Simple State Machine

State Machines That Finish

Sharing Transitions

Using History States

Using Parallel States

Exiting a Composite State

Targetless Transitions

Related Information

The QML Disk Cache

The QML Reference

The QML Type System

Basic Types

JavaScript Types

QML Object Types

W3Schools JavaScript Reference

Writing QML Extensions with C++

Running the Tutorial Examples

Chapter 1: Creating a New Type

Chapter 2: Connecting to C++ Methods and Signals

Chapter 3: Adding Property Bindings

Chapter 4: Using Custom Property Types

Chapter 5: Using List Property Types

Chapter 6: Writing an Extension Plugin

Chapter 7: Summary

QtObject

SignalTransition

Example Usage

State

States with Child States

Example Usage

StateMachine

Example Usage

String

TimeoutTransition

Example Usage

Timer

Using the enumeration Type in QML

Using the list Type

Using the url Type

Change Notification Semantics

Property Value Initialization Semantics

Using Scarce Resources with the variant Type

Storing Arrays and Objects

Qt QML Examples

Qt QML C++ Classes

Qt QML QML Types

Importing QtQml

Basic Types

Object Types

Qt QML State Machine QML Types