A bug of Q_ENUMS
-
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,
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().
-
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.
-
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.