Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [SOLVED] lupdate: search QML files recursively
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] lupdate: search QML files recursively

Scheduled Pinned Locked Moved QML and Qt Quick
6 Posts 3 Posters 2.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    m_andrej
    wrote on last edited by m_andrej
    #1

    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?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dynamo72
      wrote on last edited by dynamo72
      #2

      Have you tried this?

      lupdate_only {
      SOURCES += $$DISTFILES
      }

      1 Reply Last reply
      1
      • M Offline
        M Offline
        m_andrej
        wrote on last edited by
        #3

        Yes I have. It doesn't work. But with double dollar sign it does :-)
        Thanks

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dynamo72
          wrote on last edited by dynamo72
          #4

          @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).

          1 Reply Last reply
          0
          • M Offline
            M Offline
            m_andrej
            wrote on last edited by m_andrej
            #5

            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?

            1 Reply Last reply
            0
            • L Offline
              L Offline
              lili2012
              wrote on last edited by
              #6

              Thanks!That work for me。

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved