
Originally Posted by
Valheru
Err, I've JUST done that in my project and I can access the enum thypes in other classes, as long as I include the header file.
Yes, you can access it as long as the enum is declared as public.
class SomeClass
{
enum Enum { Val1, Val2 }; // this is a private enum, cannot access "outside"
public:
SomeClass();
...
};
class AnotherClass
{
public:
enum Enum { Val1, Val2 }; // this is a public enum, accessible from "outside"
AnotherClass();
...
};
class SomeClass
{
enum Enum { Val1, Val2 }; // this is a private enum, cannot access "outside"
public:
SomeClass();
...
};
class AnotherClass
{
public:
enum Enum { Val1, Val2 }; // this is a public enum, accessible from "outside"
AnotherClass();
...
};
To copy to clipboard, switch view to plain text mode
I'll agree that having to use the class :: prefix in the .cpp file of the class implementing the enum is retarded, but that's just a minor asthetic thing.
This is a C++, not Qt "issue". An enumeration defined inside a class belongs to the namespace of the class. You'll need to define the enum outside the class to be able to use it without a namespace prefix..
Bookmarks