• May 02, 2024, 04:46:09 am

Author Topic: Qt/QML+ QRC trick to hide files from .sis  (Read 2718 times)

0 Members and 1 Guest are viewing this topic.

Offline huellif

  • Developer
  • Christmas Santa
  • ****
  • Posts: 402
  • Reputation: 212
Qt/QML+ QRC trick to hide files from .sis
« on: August 20, 2013, 04:10:33 pm »
Most of you use QRC to hide your code, graphics etc. in .exe file.

the usual way is put "#" in front of the files path in QML/graphics folder before build, but this does hide the files also from QtCreator.
I guess you want to show the files in QtCreator always +  hide them always from .sis, so what to do?

check e.g. this .pro file:
Code: [Select]
folder_01.source = qml/Gmail
folder_01.target = qml
DEPLOYMENTFOLDERS = folder_01

most of you do this before of an build:
Code: [Select]

#folder_01.source = qml/Gmail
#folder_01.target = qml
#DEPLOYMENTFOLDERS = folder_01

simply remove all this lines and add:

Code: [Select]
#hack to hide QML and .js from  build, but show them in QtCreator + for lupdate
{ SOURCES += qml\Gmail\*.qml } \
{ SOURCES += qml\Gmail\js\*.js } \

works fine or?

QtCreator does ignore the { } and shows the files, build qmake and sisbuild don't include the files.

another feature:
if you want to make a multilanguage app you can run:
Code: [Select]
lupdate Projectname.pro -ts translation.ts

to create a single .ts file which contains ALL QML strings for QtLinguist
« Last Edit: August 20, 2013, 04:14:53 pm by huellif »

Offline mk27

  • Developer
  • Forum User
  • ****
  • Posts: 79
  • Reputation: 29
  • I am alive and exist on Discord. PM for add.
  • Current Phone: : Nokia X7-00
Re: Qt/QML+ QRC trick to hide files from .sis
« Reply #1 on: August 20, 2013, 04:21:22 pm »
Nice trick! Exactly what I needed! ;) Thanks! +1 Rep. added.

Offline huellif

  • Developer
  • Christmas Santa
  • ****
  • Posts: 402
  • Reputation: 212

Offline pisarz1958

  • Developer
  • New Member
  • ****
  • Posts: 26
  • Reputation: 27
  • Oh, I have this little field in my profile!
  • Current Phone: : Nokia 500
Re: Qt/QML+ QRC trick to hide files from .sis
« Reply #3 on: August 20, 2013, 07:32:40 pm »
Putting this stuff in "SOURCES" breaks compilation for Harmattan platform, so I suggest using simply "OTHER_FILES", though it isn't working properly with lupdate, so you still need to use this simple hack to get lupdate to work.

huellif, could you someday explain internationalization in QtQuick? I was able to generate .ts file, but I have no idea, what should I do with it after that, not counting putting translations in this file. They simply weren't loaded.
« Last Edit: August 20, 2013, 07:34:28 pm by pisarz1958 »

Offline huellif

  • Developer
  • Christmas Santa
  • ****
  • Posts: 402
  • Reputation: 212
Re: Qt/QML+ QRC trick to hide files from .sis
« Reply #4 on: August 20, 2013, 10:01:40 pm »
it's not really hard.
If you want to I can create a multilanguage hello world for this section.

In DelightApp (app for our CFWs) I implemented it successfully based on Dicksons Tweetian code.


You have to compile the .ts file via lrelease, include them in .sis or .exe
and in main.cpp you have to load them
« Last Edit: August 20, 2013, 10:16:11 pm by huellif »

Offline mk27

  • Developer
  • Forum User
  • ****
  • Posts: 79
  • Reputation: 29
  • I am alive and exist on Discord. PM for add.
  • Current Phone: : Nokia X7-00
Re: Qt/QML+ QRC trick to hide files from .sis
« Reply #5 on: September 30, 2013, 08:42:19 pm »
Today I finally Used this Trick! And It Helped A lot :) Thanks again for Posting :)