Posts: 6
Joined: Wed Jan 10, 2018 2:43 pm

QT Cross-Compile problem with Linguist

Thu Jan 11, 2018 6:29 am

Hello to everyone!

Hopefully I am in the right place with my topic.

I have to build an App for the Raspberry pi with a GUI and I have to use QT.
Developing on the raspberry is no option because it would take too much time (delay typing, compiling time etc.) and the app will be extensive.
So the solution is to develop on my Pc and cross compile to the raspberry.
So far that was not the problem, the system setup was done in a few hours and it works (that means a created app with a Mainwindow is compiled on the Pc transfered to the raspberry and the window appears on the touchscreen of the raspberry)
the exactly setup:
---Raspberry pi b3
---NOOBS (I know NOOBS :roll: but for the moment it is enough)
---Windows PC (just for the VM)
---VM: Ubuntu 16.04.3 LTS
---QT 5.9.3
---QT Creator 4.4.1
I hope i did not forget anything.
So lets get started with my Problem:
The app has to be multilangual and Qt offers a pretty good solution with the Qt-Linguist.
If I build my app wit the Desktop Qt 5.9.3 GC 64bit compiler everything works fine. If I change the language from german to english it works fine. All the texts are shown in english or german (whatever i choose). So I think I can say there is no mistake in the code.
But if i choose the Raspberry toolchain:
The app can be build without an error.
The window apears in the right shape on the Touchscreen of the raspy but if i change the language...nothing hapens.
I dont really have an idea whats the problem.
Maybe thet there is a problem wit the .qm file?
I have tried to copy the wohle project to the raspy and then execute the app. (the idea was maybe i need to transfer the qm file too...but i did not work :roll: )
google does not have any solution for me...looks like not many people try to do this...or i make a realy stupide mistake..

I hope you guys could help me.
sorry for my ba english...

User avatar
Posts: 5177
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: QT Cross-Compile problem with Linguist

Fri Jan 12, 2018 3:02 pm

What/which version of Qt5 is the Pi running ? Did you crosscompile your own ?
The window apears in the right shape on the Touchscreen of the raspy but if i change the language...nothing hapens.
How do you change language ? Menu in you app ? Are you sure there are no errors logged in terminal ?

Posts: 1415
Joined: Thu Jun 27, 2013 12:32 pm
Location: UK

Re: QT Cross-Compile problem with Linguist

Sat Jan 13, 2018 1:03 am

You said you know NOOBS - I presume you mean you know how to use it, but have you tried building it?
It uses Qt, although an older v4.8 version, and uses translation with linguist.
Perhaps you could compare your App with NOOBS source code to see if there are any differences in how it does it compared to your App?
For forms created graphically with QtCreator, the text seems to magically change, but for dynamically created widgets it is necessary to refresh them after a change to the language.
PINN - NOOBS with the extras... https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=142574

Posts: 6
Joined: Wed Jan 10, 2018 2:43 pm

Re: QT Cross-Compile problem with Linguist

Mon Jan 15, 2018 7:30 am

Hi guys

Thank you for your replies.

It took alot of time but ifound the mistake on my own.

As I told you in my first post I copied the whole Project folder to th Pi and then execute the App.
I thought that should eliminate any mistakes with the file paths.
THE ANSWER IS: that is wrong the file paths dont work.
Now i use absolute file pathsto find the .qm files and now it works great.

If I think about i the answer is very easy..but it took a long time to get the idea to try absolut file paths.

Thanks for your help.

Return to “Graphics programming”