Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.

Using Qt 4.7

From Texas Instruments Wiki
Jump to: navigation, search


This page is work in progress and subject to change.

About

This page discusses the specific aspects of using Qt 4.7 Embedded SDK on TI platforms.

Qt 4.7 introduces a new feature for dynamic creation and update of UI elements. The UI creation kit called as QtQuick mainly consists of the following technologies:

  • QML- JavaScript like declarative language that specifies the UI elements and their behavior
  • QtDeclarative - C++ class which that translates QML and provides the glue logic between application and QML UI

Useful Links

  • Qt 4.7.1 can be obtained here

Building Qt 4.7

  1. Download Qt Embedded SDK 4.7.1 from the link given above
  2. Extract the Qt SDK to the required location - for example /home/user/qt-everywhere-opensource-src-4.7.1
  3. Refer to this page for building and installing Qt with SGX hardware accelerated OpenGL ES2 support
  4. Refer to this page if SGX support is not required

At the end of the above steps, the Qt should be successfully cross compiled for the target configuration. The Qt SDK should have been installed successfully in the target file system specified through --prefix during configure.

Creating a "Hello World" QtQuick application

Developing a QtQuick application involves two steps:

  1. Writing a QML specification describing the UI
  2. Writing a C++ application to interface with this QML specification

This tarball provides the required files for the QtQuick Hello World application.

helloworld.qml

This file specifies the UI elements, interactions and their behavior. This example just declares a rectangle with a specific width, height and color parameters. The rectangle also contains a text item for showing the famous "Hello World!"

main.cpp

This file invokes the glue logic to translate the QML spec into Qt graphics elements. This is done through a new Qt class QtDeclarativeView introduced in Qt 4.7. This example just sets the source for this view to point to helloworld.qml. The path should be specified from the perspective of target file system.

Building the application

  • Qt 4.7.1 should have been built and installed before building the QtQuick application. Let Qt 4.7.1 be installed on $(QT_DIR) on the host
  • Untar the tarball on the host machine
  • Run qmake inside the helloworld directory
 $(QT_DIR)/bin/qmake -project
  • Edit the helloworld.pro to add the QtDeclarative library to the project
 LIBS += -lQtDeclarative
  • Run qmake on the helloworld project to generate a Makefile
 $(QT_DIR)/bin/qmake -spec $(QT_DIR)/mkspecs/qws/linux-TIarmv7-g++
  • Run make
  • This should generate the helloworld application

Running the application

  • Copy the generated binary "helloword" to the target file system
  • Copy the included file "helloworld.qml" to the target file system at the same location where the binary was copied
  • Run the helloworld application
 ./helloworld -qws
  • The helloworld.qml can be edited without modifying the Qt C++ application. For example, the width, height, text can be modified directly by updating the QML file