lupdate_only: showing QML and C++ files twice.



  • I added translations to my application, but to allow lupdate to find my translations in the C++ and QML files, I need to include them like this:

    lupdate_only {
    SOURCES = src/*.cpp \
        src/*.h \
        qml/*.qml 
    }
    

    I already have them included individually under

    SOURCES += \
        src/main.cpp \
        src/ect.... \
    
    HEADERS += \
        src/myModel.h \
        src/ect.... \
    
    OTHER_FILES += \
        qml/main.qml \
        qml/ect.... \
    

    But now in QtCreator:

    My headers show up in Project / Headers / src (Correct)
    My QML shows up in Project / QML / qml (Correct)
    ALL my header and sources show up under Project / Sources / src / (Incorrect, should be just .cpp)
    My QML shows up in Project / Sources / qml (Incorrect, should not show QML under Sources)

    So it seems like lupdate_only put a copy of my QML and Header files and added them to my Sources subdirectory. Is there any way to exclude them being added to this list? I found this Qt bug, but a dev in the comments described it as not being a bug. How is showing a file twice not a bug?

    Any ideas?



  • Bump, I'd really like to hear what anyone has to say about this. Should I be manually translating .qml and .cpp files with lupdate?



  • lupdate automatically picks all SOURCES and HEADERS. The problem is just that it misses the QML files.
    So I use this construct:

    lupdate_only {
    SOURCES += $$OTHER_FILES
    }

    (and have my QML files in OTHER_FILES, of course).

    Take care, it should be double $ character.

    At least this prevents the Header files to appear in sources. The QML files are still in the Project / Sources / qml folder, though.



  • Thanks, that really helps. The problem I was having was that lupdate couldn't find my C++ translation from files inside SOURCES either. Any idea why that could happen?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.