O'Reilly logo

Computer Vision with OpenCV 3 and Qt5 by Amin Ahmadi Tazehkandi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Introduction to QML

As mentioned in the introduction, QML has a JSON-like structure that can be used to describe the elements on a user interface. A QML code imports one or more libraries and has a root element that contains all of the other visual and non-visual elements. The following is an example of a QML code that results in the creation of an empty window (ApplicationWindow type) with a specified width, height, and title:

    import QtQuick 2.7 
    import QtQuick.Controls 2.2 
 
    ApplicationWindow 
    { 
      visible: true 
      width: 300 
      height: 500 
      title: "Hello QML" 
    } 

Each import statement must be followed with a QML library name and version. In the preceding code, two of the main QML libraries that include most of the default types are imported. For instance, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required