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

regression: QVariant treats enums as strings after access from qml

    XMLWordPrintable

Details

    • All, Linux/X11

    Description

      this bug report contains 100% reproducible test case.
      regression: on 5.14.2(and other past versions like 5.12) test case works, on 5.15 it doesnt
      severity: it breaks my app completly on 5.15

       
      QVariant treats enums (made for qml (enum classes) as strings rather than ints.
      It happens after accessing enum property from qml in a eg. listview via model in a special way.
      Ive made my models to be able to return QObject so that I can even emit some signal / launch some slots / q_invokables.
      So when such QObject is returned and something is accessed via it (for example property) - it breaks whole QVariant - not only in QML but in c++ too.

      This is output from qml:
      //5.15 prints: status: E_loggedIn
      //5.14.2 prints: status: 0 or 1 or 2 (number)

      this is output from c++(QDebug):
      //5.15 prints: cpp: QVariant(LoginStatusType::Type, "E_loggedIn")
      //5.14.2 prnts: cpp: QVariant(int, 1)

       

      ive included test case with simple code that shows it all - with comments where it happens and what it prints.

      Attachments

        1. brokerAccount.cpp
          2 kB
        2. brokerAccount.cpp
          2 kB
        3. brokerAccount.h
          2 kB
        4. brokerAccount.h
          2 kB
        5. main.cpp
          1 kB
        6. main.cpp
          1 kB
        7. main.qml
          2 kB
        8. main.qml
          1 kB
        9. qt-enum-test.pro
          0.6 kB
        10. test-case-output.txt
          1 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            ulherman Ulf Hermann
            meomic Michal M
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes