0

I had to mark some of the .xml files for internationalization. I do not use lupdate manually from cmd, instead I put it in the project's .pro file like:

lupdate_only{
 SOURCES += $$EXTRA_XML
}

The above code works just fine, but as you noticed I had to put the xml files in SOURCES. As a consequence the .xml files appear in the Sources virtual folder from the left Projects' perspective window, just next to the .cpp files. I find this solution a bit nasty and confusing.

- Project
- - Headers
- - Sources
- - - main.cpp
- - - some.xml //not wanted here

Is there a way to use lupdate, in .pro, on different files such that those files won't appear in the Sources folder? Thanks!

UPDATE I use Qt Creator 4.0.3

Ispas Claudiu
  • 1,890
  • 2
  • 28
  • 54

2 Answers2

1
lupdate_only {
    SOURCES += $$EXTRA_XML
} 

With this conditional statement, lupdate tool sees the .qml files but qmake will ignore it.

ManuelH
  • 846
  • 1
  • 15
  • 25
  • The lupdate_only seems to be a conditional statement for the compiler but I think the problem is with the Qt Creator which parses the .pro files and interprets the SOURCES variable – Ispas Claudiu Nov 29 '16 at 10:47
  • In that case, the only other possible solution I can think of, is that you make a separate .pro file, containing just the lupdate_only { ... } and the xml files. You will then need to run lupdate from the command line yourself, while Qt Creator works with the other .pro file containing all the C++ headers and sources. – ManuelH Nov 29 '16 at 11:05
  • It's almost the same thing as running the lupdate from cmd, however your response gave me the idea to move lupdate into the .pri file and not it works as desired, so thank you – Ispas Claudiu Nov 29 '16 at 12:02
0

I found the solution to my problem, however I think it's a Qt Creator bug. I just moved the lupdate statement with its contents into a .pri file and now the xml files do not appear under the Sources virtual folder. (the .pri file is included in .pro)

Ispas Claudiu
  • 1,890
  • 2
  • 28
  • 54