[SOLVED] lupdate: search QML files recursively
-
Hi,
I need to generate *.ts files from translatable strings in all my QML files. However, they are divided into several subdirectories. The relevant part of the *.pro file looks like this:
TRANSLATIONS += patientapp_en.ts \ patientapp_de.ts DISTFILES += \ qml/navigation/StackPage.qml \ qml/UsersPage.qml \ qml/controls/CToolButton.qml \ qml/controls/CTextToolButton.qml \ qml/TrainingsPage.qml \ qml/patient_list/PatientsPage.qml \ qml/patient_list/TableCell.qml \ qml/patient_list/new_patient/NewPatientPage.qml \ qml/home/BottomBar.qml \ qml/home/HomePage.qml \ qml/home/main.qml \ qml/home/TopBar.qml \ qml/home/Clock.qml \ qml/controls/CLabel.qml \ qml/patient_list/new_patient/CameraPage.qml \ qml/dialogs/Toast.qml \ qml/dialogs/YesNoDialog.qml \ qml/controls/CButton.qml \ qml/simple_stand/SimpleStandPage.qml \ qml/simple_stand/CircleTimer.qml \ qml/controls/EmptyIndicator.qml \ qml/SettingsPage.qml \ qml/controls/forms/FormField.qml \ qml/controls/forms/FormLabel.qml
I'd like to find a solution that doesn't require me to list the QML files or directories twice in the *.pro file. I already tried this:
lupdate_only { SOURCES += qml/*.qml \ qml/*/*.qml \ qml/*/*/*.qml }
Unfortunately, only the first line in the code (
qml/*.qml
) matches QML files. It seems that you can't use wildcards for directories. Another idea I tried:lupdate_only { SOURCES += DISTFILES }
This doesn't work either :-(
Have you got any other ideas? -
Have you tried this?
lupdate_only {
SOURCES += $$DISTFILES
} -
Yes I have. It doesn't work. But with double dollar sign it does :-)
Thanks -
@m_andrej said:
But with double dollar sign it does :-)
Yes, I finally removed the code quotes - first the double $$ appeared both in preview and submitted post - but after page reloading only one $ was left :)
I use the same principle now, despite I put the QML files into the OTHER_FILES section - then the project tree gets a dedicated QML folder symbol with the red "qml" icon.
(Adding QML files adds them into the DISTFILES section in the .pro, but since I use a binary resource for the QML files, I always add them directly to the .qrc - this works fine so far). -
It's interesting that this code
lupdate_only { SOURCES += $$$$DISTFILES // double dollar sign here }
makes Qt Creator to show my QML files in "Sources" section of my project tree, which is supposed to contain only C++ files. Do you think this is a bug of Qt Creator?
-
Thanks!That work for me。