Using Qt 4.7

This page is work in progress and subject to change.

Contents

[hide]

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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值