QML, user interface language

Qt Markup Language is a declarative UI language. It is compatible with the Qt framework and interfaces with its API. It can be extended with C code holding calls to this API.

To use the runtime, Qt Declarative, must be added to the Qt framework.

Why use QML?

Building an interface on the Qt environment is easier with QML as it is easier to describe a Java interface with JavaFX, which is similar (while other platforms make use of XML).
Just one line of code to display "Hello World!" cons thirty in Qt (see "Hello World!" in all languages).

The processing can be much slower however with than the use of direct calls to the Qt framework, so the language is best suited for small applications with a simple interface, and less for heavier applications.

According to the editor, the runtime being installed on a server, a QML application can works on the Web with HTTP, making it an alternative to HTML. A HTML page may be generated also by QML to be viewed in a browser and be powered by JavaScript.

Features of the language

Code samples

Drawing a rectangle enclosing the words "Hello World!".

Rectangle {
   width: 200
   height: 200
   color: mouse.pressed ? "blue" : "red"  
   Text {          
     text: "Hello World"          
     anchors.centerIn: parent      
   }  
}

Including JavaScript code ...

Rectangle {      
   function calculateHeight() 
   {          
     ... calculs... 
     return x;      
   }      

   height: calculateHeight()      
   width: { 
      if (height > 100) 200; else 50 
   }  
}  

More on the new Qt site.

Programming languages Asm.js - AspectJ - Basic - C - CIL - C++ - C++11 - C# - Dart - Eiffel - Go - Java - JavaScript - JavaFX Script - Pascal - PHP - Python - QML - Rexx - Ruby - Scala - Scriptol - Tcl - HTML - XML - XAML - XUL - SQL