View Full Version : enum scope

14th February 2006, 23:40
hi all,

i have a global enum defined as:

enum EditType {Currency, Percent, LabeledNumber, Text};
then i have a class with an enum defined identically:

class A : public QWidget

enum EditTypeBase {Currency, Percent, LabeledNumber, Text};
EditTypeBase LineType;

in the function definitions i need to map from EditTypeBase to EditType. i HAVE to do it this way because of the meta-object compiler.

how do i compare the two enums?

EditType A::GetType()
if (LineType == Currency)
return EditType::Currency;

this gives a syntax error. the first 'Currency' is from EditTypeBase defined inside the class, but the 2nd 'Currency' is of type EditType defined outside. how do i properly refer to EditType enumerators within class A since they have the same names as the ones defined inside the class?


15th February 2006, 05:39
never mind -- was forced to go a different direction ...