Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-91199

QQmlApplicationEngine::retranslate() call invalidates DelegateModelGroup filtering

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15
    • None
    • Ubuntu 20.04
      GCC 9.3.0
      Qt 5.15.1
    • Linux/X11

    Description

      Hi!

      I'm using a DelegateModelGroup inside a DelegateModel to filter some items of a GridView.

      Besides, my application needs to be translated into several languages.

      When I change the language by calling retranslate() on my QQmlApplicationEngine, all the items disappear...

      I saw the following limitation in the documentation of QQmlApplicationEngine::retranslate:

      Note: Due to a limitation in the implementation, this function refreshes all the engine's bindings, not only those that use strings marked for translation. This may be optimized in a future release.

      As DelegateModelGroup' use is based on its 'name' property (which is a string), I think the issue come from there.

       

      Steps to reproduce

      Attached files are a minimal CMake project that shows the issue. Here are the steps to reproduce: 

      mkdir build
      cd build
      cmake -DCMAKE_PREFIX_PATH=/path/to/your/Qt/gcc_64 ..
      make -j 6
      
      

       Launch the 'my_target' executable and click the 'Translate' button.

      --> all items in the GridView disappear

      Attachments

        1. CMakeLists.txt
          0.7 kB
        2. main.cpp
          0.3 kB
        3. main.qml
          2 kB
        4. my_model.cpp
          1.0 kB
        5. my_model.h
          0.6 kB
        6. qml_loader.cpp
          0.6 kB
        7. qml_loader.h
          0.3 kB
        8. resources.qrc
          0.1 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            tje T J
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes