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. A bug of Q_ENUMS
Qt 6.11 is out! See what's new in the release blog

A bug of Q_ENUMS

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 3 Posters 2.3k 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.
  • H Offline
    H Offline
    harlentan
    wrote on last edited by
    #1

    I find there is a bug in Qt Creator.
    The situation is like this:

    @

    Class Base : public QObject
    {
    //...
    Q_ENUMS(DataType)//attion!

       //....
    
       enum DataType
    

    {
    type1,
    type2,
    type3
    };

        virtual void get(DataType ty)
    

    };

    Class C: pulic Base//this has registed for QML
    {

    void get(DataType ty)

    }

    //then in QML file,

    //main.qml

    C{
    id: cid
    /******************/
    here comes the bug
    bug 1: the first time I wirte "C." then the Qt Creator will autocomplete
    for me to select from type1, type2,type3. Then, just go to the defination
    of DataType, just modify it(e.g. add the type4).After you do this, then
    your modify will never come into effect until you restart your Qt Creator.
    (That is to say, Qt Creator will never see the type4)

    bug 2: Try to transfer the type, any type from the DataType, just not use the
    type1 will be OK(e.g type2). Then debug step into the get() function
    (I mean invoke the function from the qml), you will find that what
    ever you take to the parameter, when you are in the get() function ,
    the parameter you get is always C.type1.
    ******************/
    Componet.onCompleted{
    get(C.type1)
    }
    }
    @

    I think there is something wrong with the Q_ENUMS().

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tobias.hunger
      wrote on last edited by
      #2

      Have you considered to "file bugreports":http://bugreports.qt.nokia.com/ ?

      Developers will run into issues reported here only by chance and everything that is not in the bug tracker tends to get lost, too, even if somebody actually notices the issue here.

      1 Reply Last reply
      0
      • F Offline
        F Offline
        Franzk
        wrote on last edited by
        #3

        For bug 1, did you try to "update the code model":http://doc.qt.nokia.com/qtcreator-2.2/creator-editor-using.html#using-update-code-model? It's a menu option somewhere that rescans the code for this sorta thing.

        "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

        http://www.catb.org/~esr/faqs/smart-questions.html

        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