Results 1 to 8 of 8

Thread: "Enum class"/Q_ENUM use in QML? Cannot read property of undefined

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2016
    Posts
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: "Enum class"/Q_ENUM use in QML? Cannot read property of undefined

    I've had a similar issue. Does it work if you add

    Qt Code:
    1. qRegisterMetaType<Enums::DayOfWeek >("Enums::DayOfWeek")
    To copy to clipboard, switch view to plain text mode 

    and change the call to:

    Qt Code:
    1. myObject.outputDay(Enums.MONDAY)
    To copy to clipboard, switch view to plain text mode 
    ?

    The one thing that is not so nice about this is that the parameter in the call doesn't refer to DayOfWeek anymore.

    Regards

  2. The following user says thank you to oiaavb for this useful post:

    sedi (1st August 2016)

  3. #2
    Join Date
    Jan 2012
    Location
    Dortmund, Germany
    Posts
    159
    Thanks
    69
    Thanked 10 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Re: "Enum class"/Q_ENUM use in QML? Cannot read property of undefined

    Yes, absolutely! The loss of the strong typisation is a pity - but at least I can use it :-) Thanks!

Similar Threads

  1. Replies: 1
    Last Post: 20th November 2015, 10:02
  2. Replies: 3
    Last Post: 16th March 2015, 07:31
  3. Cannot assign to non-existent property "lon" lon: "3"
    By TheIndependentAquarius in forum Qt Quick
    Replies: 1
    Last Post: 12th November 2013, 15:50
  4. [SOLVED] QPropertyAnimation "text" property in QLabel
    By AlekseyK in forum Qt Programming
    Replies: 3
    Last Post: 7th December 2010, 18:46
  5. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.