Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Simple Qt UI example: Page 1 of 2 (32 Items)
   
Simple Qt UI example  
Attached is a simple UI using the Qt "Declarative" model.  Declarative Qt programs utilize a paradigm similar to web 
pages.

The tutorial includes complete instructions for building and running the the example on QNX hosted on x86.

Dennis
Attachment: Compressed file qtEasy.zip 1.59 MB
Re: Simple Qt UI example  
PDF version of the document
Attachment: PDF QtEasy.pdf 284.36 KB
Re: Simple Qt UI example  
Hello Dennis!
Great example, thank You!
These days, I am trying to include QT to QNX. 
Following the instruction sheet coming with Your example, I installed  qt_qnx_host_win32_x86.tar.gz and qt_qnx_targets.
tar.gz on my windows 7-machine in the qnx650-directory (p.6, Steps 1-3). While the code example works in the QT IDE, I 
always get the following error message when I try to compile the code in the qnx650 directory (p.7, Step 4). 

"make: *** No rule to make target `/usr/qnx650/target/qnx6/usr/share/qt4/mkspecs/
unsupported/qws/qnx-i386-g++/qmake.conf', needed by `Makefile'.  Stop."

The advice for the makefile given in the readme-file coming with qt_qnx_2011-02-24b.zip (s. Your post from 3/3/11 in 
this forum) does not seem to work either:

"In file included from ../easyData.cpp:1:
../easyData.h:11:36: error: QDeclarativeListProperty: No such file or directory
make[2]: *** [easyData.o] Error 1
make[2]: Leaving directory `C:/QNX650/target/qnx6/x86/usr/lib/qt4/examples/cEasy
/nto-x86-o'
make[1]: *** [all] Error 2
make[1]: Leaving directory `C:/QNX650/target/qnx6/x86/usr/lib/qt4/examples/cEasy
/nto-x86-o'
make: *** [all] Error 2".

May I ask for Your help?
Re: Simple Qt UI example  
Simon-

If I read your post correctly, the first error...

"make: *** No rule to make target `/usr/qnx650/target/qnx6/usr/share/qt4/mkspecs/
unsupported/qws/qnx-i386-g++/qmake.conf'

...was fixed by configuring according to the  readme-file coming with qt_qnx_2011-02-24b.zip ?

(You do need to configure the qt_qnx package by following its instructions.)

This changed the behavior to the second error?

"In file included from ../easyData.cpp:1:
../easyData.h:11:36: error: QDeclarativeListProperty: No such file or directory

Perhaps cEasy/Makefile was overwritten?  Note the one in the cEasy package has two comments at the top with initials "
dek".  You need that version of Makefile to resolve the include file issues for QtDeclarative.

Dennis


Re: Simple Qt UI example  
Hello Dennis, 
thank You for the incredibly fast answer!
The replacement of Your cEasy/Makefile by the Makefile in the readme.txt brought me to the second error message. Going 
further, I complemented the automatically generated makefile in the subdirectory \cEasy\nto-x86-o by hand with Your two 
comments on QtDeclarative. Another call of make then yields the error message   

"ntox86-g++ -Wl,-O1 -o cEasy easyData.o main.o mainwidget.o moc_easyData.o moc_ma
inwidget.o    -LC:/QNX650/target/qnx6/x86/usr/lib -lQtGui -lQtCore -lQtDeclarati
ve
C:/QNX650/target/qnx6/x86/usr/lib/libQtGui.so: file not recognized: File truncat
ed
collect2: ld returned 1 exit status
make[2]: *** [cEasy] Error 1
make[2]: Leaving directory `C:/QNX650/target/qnx6/x86/usr/lib/qt4/examples/cEasy
/nto-x86-o'
make[1]: *** [all] Error 2"

So it seems to be a problem with linking to the libraries, doesn't it?
Probably, the empty links libQtCore.so.4 etc. are not properly recognized by the windows system? How can I directly 
connect the relevant libraries libQtCore.so.4.7.1 etc. ? 
Thank You for any effort!
sk
Re: Simple Qt UI example  
Honestly, I did not understand how to implement p.6, step 4, since I did not find the profile-file in windows nor in the
 qnx650-directory.
Do well!
 sk
Re: Simple Qt UI example  
It finally registered that you are trying to build on Windows!  The pdf doc assumes "self-hosted".  But it sounds like 
you got pretty far.

>>>Probably, the empty links libQtCore.so.4 etc. are not properly recognized by the windows system?

You are correct - depending on which windows "tar" program you use, symbolic links are not always correct.  If you have 
zero-len *.so libraries, they are supposed to be symbolic links to the "latest" library.  So the remedy on Windows is to
 copy the CONTENTS of the latest library into the corresponding zero-len .so name. 

>>>I did not understand how to implement p.6, step 4, since I did not find the profile-file in windows nor in the qnx650
-directory.

You could try putting them in the system environment - control panel/System - but I think you will just keep running 
into more problems.  You really need to install the 6.5 development CD onto a PC or into vmware!

Dennis   

Re: Simple Qt UI example  
Hello Dennis,
since I was not able to copy the contents (there is no windows-program to view lib-file properly), I tried to simply 
rename the libraries.version with the label of their corresponding link-library, f.ex. libQtDeclarative.so.4.7.1 to 
libQtDeclarative.so.
When compiling, it produced several "undefined references". It would have been a truely elegant solution, but I finally 
gave up and worked around with compiling in a virtual QNX-machine according to Your instruction sheet. There it worked 
out perfectly. Now, I am going to try out different QT-samples.
Thanks a lot for Your help!
Do well!
 sk 
Re: Simple Qt UI example  
Hi,

I tried the example also to get it running on an IGEPv2 (ARM). I modified the makefile and created a dos application to 
work around the library issue. This post contains the dos script. The next one will contain a modified Makefile to make 
it build on a Win32 host.

Freddy
Attachment: Text _fix_libQt_libs.cmd 2.29 KB
Re: Simple Qt UI example  
And here is the modified makefile. I noticed a few things:

Sometimes, there is a reference to QNX650/target/armle/
There is also a reference to ***arm***
There are references to **x86**
And there are references to **i386**

I had to puzzle for a while to get the makefile as given by the attachment. The QT application now builds nicely on 
Windows.

I hope others can use it also.

Freddy
Attachment: Text Makefile 9.97 KB
Re: Simple Qt UI example  
But.... solutions also introduce problems :-)

I tried to run the application on a read-only filesystem but ran into the following error message:

# Cannot create Qt for Embedded Linux data directory: /qtembedded-0

It seems that a file is created on the root of my filesystem, it there a way to redirect this file using an environment 
variable?

Freddy
Re: Simple Qt UI example  
Hello,
Never stop trying harder: after some fiddling with renaming the libraries (some to the name of the symbolic link, some 
to 'name of the symbolic link.4') and setting the appropriate environment variable, it worked out finally. 
This is admittedly much more comfortable with your makefile, Freddy - thank You!
Replacing the /apps - directory with my paths, it compiles without any complains.
Thank You all for Your efforts!
 Simon K.
Re: Simple Qt UI example  
I hope you enjoyed the makefile. I need to add some comments to it.

These are the steps I did on win32:
1) Download the sources.
2) Run the copy script to fix the shared objects issue.
3) Copied the files from the qt project to the QNX Makefile project.
4) Modified the makefile
5) Build project.

Getting there was a long way but I learned something new during the journey and that is nice also.

Good luck with the ongoing developments Simon and Thanks Dennis for providing the foundation.

Freddy
Re: Simple Qt UI example  
# Cannot create Qt for Embedded Linux data directory: /qtembedded-0

I noticed on the VMware image, /tmp/qtembedded-0 is created.  Environment variable TMPDIR=/tmp  is set  - could that be 
absent on your target?

Dennis
Re: Simple Qt UI example  
I will try that tomorrow. But I think that will help.

Thanks for the reply.
Freddy
Re: Simple Qt UI example  
He Dennis,

That seems to do the trick. I cannot use /tmp because it is '/dev/shmem'. I use a ramdrive. This is what I do:

# ls -l /tmp/cEasy
-rwxrwxrwx  2 root      0             34249 Jan 01  1980 /tmp/cEasy

export TMPDIR=/fs/ram
/tmp/cEasy -qws

After executing cEasy, the following message appears:
 Qt for Embedded Linux data directory has incorrect permissions: /fs/ram/qtembedded-0

Do you have a clue what is happening?

Freddy
Re: Simple Qt UI example  
>>>data directory has incorrect permissions: /fs/ram/qtembedded-0
Sounds like /fs/ram is not formatted qnx4 or qnx6.  Some filesystems don't support permissions.

Dennis
Re: Simple Qt UI example  
You're right. My /fs/ram is a FAT drive. I created a new QNX4 ramdrive and it works. Thanks for the answer.

Right now, I am able to:
1) Build the QT example on a win32 hosted development system
2) run the Qt example on an IGEPv2

Everything required is within this thread.

@Dennis: Thanks for the example and the hints.

Cheers,
Freddy
RE: Simple Qt UI example  
>>>@Dennis: Thanks for the example and the hints.
Thank you from providing the win32 build.  I haven't tried it yet but
its good to have a reference!

BTW the other example (with pps) is more interesting...

-----Original Message-----
From: Freddy Martens [mailto:community-noreply@qnx.com] 
Sent: Thursday, June 30, 2011 12:02 PM
To: general-qt
Subject: Re: Simple Qt UI example

You're right. My /fs/ram is a FAT drive. I created a new QNX4 ramdrive
and it works. Thanks for the answer.

Right now, I am able to:
1) Build the QT example on a win32 hosted development system
2) run the Qt example on an IGEPv2

Everything required is within this thread.

@Dennis: Thanks for the example and the hints.

Cheers,
Freddy



_______________________________________________

Qt General
http://community.qnx.com/sf/go/post86993
Re: RE: Simple Qt UI example  
Hi Dennis,

A little offtopic...

Here is another example. Homebrewn. The problem is that the INCPATH in the Makefile needs the drive specifier 'C:' to be
 able to build. Without, it starts complaining. The cEasy project you provided doesn't need this. I already checked the 
project properties but I cannot find anything explaining why I need to use the 'c:' part in the INCPATH.

And yes, I will lookinto pps also, I first want to figure out which libraries are required on the target (I know, 'pidin
 mem' answers the question but I want to know which of the provided libs are target libraries and which ones are used on
 a development host). 
Freddy

Attachment: Compressed file qtSmallDashboard.zip 20.97 KB
Re: Simple Qt UI example  
Freddy-

I verified your Makefile on Windows.  Seemed to work well!  Thanks for contributing.

FYI - It is NOT necessary to do the fixup for zero len files  in '_fix_libQt_libs.cmd'   IF you use the QNX tools to 
untar the archive.

You can use:

C:\QNX650\host\win32\x86\usr\bin\gzip.exe -d qt_qnx_targets.tar.gz

C:\QNX650\host\win32\x86\usr\bin\tar.exe -xvf qt_qnx_targets.tar

The zero len files are symbolic links on a posix filesystem.  When winzip unzips them, no file contents exist so empty 
files are created.   But the QNX tools are smarter - for every symbolic link, they create a "copy" of what the link 
points to.  Inefficient, but at least it works!

Dennis
Re: Simple Qt UI example  
Actually, the armle tree is flawed - it does not have the symbolic links at all so the _fix_libQt_libs.cmd file is 
required!

Dennis
Re: Simple Qt UI example  
Hi Dennis,

I followed your example, but encountered some errors. Hope you can help me out..

My environment is self-host QNX6 using VMware

It all went on well until step 6. 5) # ./cEasy –qws
here an error message showed as:
    ldd:FATAL: Could not load library libQtGui.so.4

I also attached a picture to make myself clear..

I have no idea how to handle it..coz I'm rather new to both Qt and QNX...

BTW, what does -qws mean?

Thanks in advance!

> Attached is a simple UI using the Qt "Declarative" model.  Declarative Qt 
> programs utilize a paradigm similar to web pages.
> 
> The tutorial includes complete instructions for building and running the the 
> example on QNX hosted on x86.
> 
> Dennis


Attachment: Bitmap qnx-qt-error.bmp 857.33 KB
Re: Simple Qt UI example  
Oh! I forgot to copy the library files.. Now it works fine!

But I still have a question, why we have to use an external terminal to make the keyboard and mouse functional ?

Re: Simple Qt UI example  
Hello Zhiying, 
it's a rather astonishing coincidence: just today, when trying out the example on a new QNX-machine, I ran into the same
 error message. 
Do You know where exactly the so-libraries have to be stored? Is it the folder /usr/lib/ or somewhere else? How did You 
solve it?
Do well!
 Simon K.