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

Enum with -1 value returns undefined in QML code

    XMLWordPrintable

Details

    • b1b843dcf5165f5b204adbd3cf36c0c8fa3605c0 in qtbase, 836c6279ebbb43e09d7754f3f43bfa29f9613315 in qtdeclarative

    Description

      If you have enum such as

      enum Fruits {
              Apple  = 1<<0,
              Orange       = 1<<1,
              Grape      = 1<<2,
              Kiwi      = 1<<3,
              AllFruits     = 0xffffffff
          };
      

      and expose it to QML, all other enums are accessible in QML code, but AllFruits returns undefined. It would be expected that it would instead return the numeric value of AllFruits.

      Also, if you replace 0xffffffff with -1, the problem still persists. If you make the flag value smaller, however, like 0x00ffffff, it works in QML.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            liaqi Liang Qi
            holmsted Lasse Holmstedt
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes