Qt Tips

来源:互联网 发布:广东软件企业认定 编辑:程序博客网 时间:2024/06/08 11:49

A collection of tips&tricks for using Qt on embedded systems. Usually this was tested on one of the OMAP EVMs.

Using Virtual Display

This requires that Qt was configured with the option '-plugin-gfx-vnc'. Now start any Qt application as follows:

#./deform -qws -display "VNC"

Then connect a remote VNCviewer to your target (of course you need to know the IP address of the target in that case).

You may also use the default display and VNC at the same time:

#./deform -qws -display "VNC:LinuxFb"

Alternatively you can set the display using an environment variable before starting Qt.

#export QWS_DISPLAY="VNC" #export QWS_SIZE="1920x1080"

And yes, you can get real big displays on OMAP3 that way...

Touchscreen Support

If you have a screen supporting touch you need to follow below steps to make this available to your Qt applications.

Make sure you have Tslib installed to your platform. This will provide basic touchscreen support for a couple of devices. We have tested with the TSC2046 that is used on the TI/Mistral OMAP3 EVM for example.

Add dependencies to your mkspec gmake.conf accordingly:

#modifications to include ts-libQMAKE_INCDIR           += /home/omap3/hd/workdir/filesys/usr/share/includeQMAKE_LIBDIR           += /home/omap3/hd/workdir/filesys/lib 

Run Qt configure again with option 'qt-mouse-tslib' (touch as primary mouse device) or '--plugin-mouse-tslib' (touch as optional mouse device). Now recompile Qt base libs.

Finally you need to modify your target environment with the following variables (path and device names are examples):

QWS_MOUSE_PROTO='Tslib:/dev/input/event1'TSLIB_CALIBFILE='/etc/pointercal'TSLIB_CONFFILE='/etc/ts.conf'TSLIB_CONSOLEDEVICE='none'TSLIB_FBDEVICE='/dev/fb0'TSLIB_PLUGINDIR='/lib/ts'TSLIB_TSDEVICE='/dev/input/event1'

You may have to call 'ts_calibrate' once to get your touch screen calibrated. Redo this if you change the rotation or screen size configuration.

QWT

QWT (http://qwt.sourceforge.net/) is a useful extension to Qt. To avoid linker issues use the define QWT_DLL when linking a QWT DLL.


原创粉丝点击