why enum has problems in qt ?
-
This is not a Qt problem but general C++ syntax. use enum class instead of
enum
Also please take a look at https://stackoverflow.com/help/how-to-ask for future posts. Other people might have the same problem you have in the future and it would be nice for them to be able to just google it and find it on this forum
-
Could you paste in an example that isn't working for you?
-
Even though you call the two enums different names ('x' and 'y'), there members live in the same namespace, i.e., you redeclare 'a' and 'b' in the second enum. That doesn't work. It is kinda the same as declaring a variable 'a' twice in the same scope, that also doesn't work... If you have to use the same name 'a' and 'b' in both enums, the only way to really accomplish that (iirc) is to wrap them in different namespaces outside of the class definition. A better solution, though, would be to simply use different names...
-
This is not a Qt problem but general C++ syntax. use enum class instead of
enum
Also please take a look at https://stackoverflow.com/help/how-to-ask for future posts. Other people might have the same problem you have in the future and it would be nice for them to be able to just google it and find it on this forum
-
This is not a Qt problem but general C++ syntax. use enum class instead of
enum
Also please take a look at https://stackoverflow.com/help/how-to-ask for future posts. Other people might have the same problem you have in the future and it would be nice for them to be able to just google it and find it on this forum
-
Even though you call the two enums different names ('x' and 'y'), there members live in the same namespace, i.e., you redeclare 'a' and 'b' in the second enum. That doesn't work. It is kinda the same as declaring a variable 'a' twice in the same scope, that also doesn't work... If you have to use the same name 'a' and 'b' in both enums, the only way to really accomplish that (iirc) is to wrap them in different namespaces outside of the class definition. A better solution, though, would be to simply use different names...