Qt-contributors-summit-2013-Evolution-of-the-QML-language

From Qt Wiki
Revision as of 17:18, 6 January 2017 by EdwardWelbourne (talk | contribs) (Categorize)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
This article may require cleanup to meet the Qt Wiki's quality standards. Reason: Auto-imported from ExpressionEngine.
Please improve this article if you can. Remove the {{cleanup}} tag and add this page to Updated pages list after it's clean.

Forward Versioning Control

Uses Qt versions, meaning no new features in patch releases.

For features that won't provide good errors, consider using pragmas to enforce a clear error message at the top of the files

Impending Features

Targeting 5.2

Pragmas

new "pragma foo" lines will be added. pragma lines must come in the preamble before all item declarations, and some might require being placed before import lines. Note that unlike QML/JS files, there is no "." before the line. Example:

  1. pragma strict
  2. import QtQuick 3.3
  3.  
  4. Item {
  5.     property var foo: "Alpha"
  6. }

Singletons

New "pragma singleton" makes this QML file represent a type which is a singleton type. Behavior of type is identical to C++/JSValue singletons.

Example:

  1. pragma singleton
  2. import QtQml 2.0
  3.  
  4. //OtherType.qml
  5. QtObject {
  6.     property int foo: 3
  7. }
  1. import QtQuick 2.2
  2. import "."
  3.  
  4. Item {
  5.     width: 20 + OtherType.foo
  6. }

Long term features

No schedule yet. Note that attached properties are currently planned to be left with C++ as an advanced usecase.

Enums in QML

Something like

  1. property enum orderOptions: [ OrderByType, OrderByHeight, OrderByMagic ]

Grouped properties in QML

Something like

  1. property group<CustomObject> foo { weight: 300; height: 200; }


Where CustomObject is a QObject derived type, and the non-optional initializer provides a default value which is copied on write.

const properties

  1. property const int offsetter: 20

pragma strict

Mostly like JS pragma strict, may provide even more type safety by denying implicit conversions (if we add explicit conversions of course).