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. How to use enum in QML?

How to use enum in QML?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 369 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.
  • fcarneyF Offline
    fcarneyF Offline
    fcarney
    wrote on last edited by
    #1

    I can declare this in QML:

        enum ObjectTypes {
            OT_Object1 = 100,
            OT_Object2 = 200
        }
    

    But I cannot seem to use the values in any way. I tried using console.log of the enum values, but it says they don't exist. I get no errors when declaring the enum either. Is this fully implemented?

    C++ is a perfectly valid school of magic.

    1 Reply Last reply
    0
    • fcarneyF Offline
      fcarneyF Offline
      fcarney
      wrote on last edited by
      #2

      Why do I look and look and don't find, then find after I post?
      https://doc.qt.io/qt-5/qtqml-syntax-objectattributes.html#enumeration-attributes

      C++ is a perfectly valid school of magic.

      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