Qt QML Release Notes

Qt QML in Qt 5.1

Qt 5.1 introduces several bug fixes and new functionalities to Qt QML. This is a summary of the new changes:

New Submodule

The Qt QML Models is a new submodule in Qt 5.1 and provides several QML types for handling data with models and lists. These types replace types such as VisualItemModel, VisualDataModel, and VisualDataGroup.

The What's New in Qt 5.1 has more information about the Qt 5.1 release.

Qt QML in Qt 5.0

The Qt QML module is new in Qt 5.0. It provides the QML engine and implements the QML language supporting infrastructure.

(Prior to Qt 5, this functionality was provided by the QtDeclarative module, which has now been replaced by the new Qt QML and Qt Quick modules. See the Porting QML Applications to Qt 5 page for more information.)

QML Engine

  • JavaScript engine has changed to V8.
  • Various parser and compiler optimizations have been implemented, as well as a new bindings optimizer.
  • New QQmlEngine::trimComponentCache() method safely discards unused data in the engine's component cache to free memory.

Component and Object Creation

  • QML objects can now be created asynchronously to improve application performance.
  • The component returned by Qt.createComponent() is no longer parented to the engine. Be sure to hold a reference, or provide a parent.

Type System

  • New var property type. This is a general-purpose property type which obsoletes the variant type. Properties of the var type may hold JavaScript references.
  • QML properties of type var and variant can now hold pixmaps. See Scarce Resources in JavaScript for more information.
  • Value type improvements:
    • QML now supports defining properties of value type basic types within QML documents. Supported types include QSizeF, QPointF and QRectF as size, point and rect respectively.
    • QColor is now a value type provided by the QtQuick module. The red, green, blue and alpha channels of a color property can be accessed via r, g, b and a properties.
    • Factory functions for various value types have been added to the Qt object exposed to QML. Some of those functions require the QtQuick module to be imported in order to return valid values. See the Qt Quick Release Notes for more information about these functions.
  • Support for sequence types QList<int>, QList<qreal>, QList<bool>, QList<QUrl>, QList<QString> and QStringList has been improved. QObjects can define Q_PROPERTYs of these types which can be accessed transparently from JavaScript.

Modules and Imports

  • Arbitrary functionality may be provided in a namespace through a singleton type. See qmlRegisterSingletonType() for more information.
  • JavaScript (.js) files may now import QML modules and other JavaScript files using the ".import" syntax.
  • Plugins may now use QQmlExtensionPlugin::baseUrl to get the directory from which the plugin is loaded. This will be useful if the plugin needs to load QML or other assets from the same directory.

Other

© 2015 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.