Results 1 to 2 of 2

Thread: enum scope

  1. #1
    Join Date
    Feb 2006
    Posts
    29
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt3
    Platforms
    Windows

    Default enum scope

    hi all,

    i have a global enum defined as:

    Qt Code:
    1. enum EditType {Currency, Percent, LabeledNumber, Text};
    To copy to clipboard, switch view to plain text mode 
    then i have a class with an enum defined identically:

    Qt Code:
    1. class A : public QWidget
    2. {
    3. public:
    4. A();
    5. ~A();
    6.  
    7. enum EditTypeBase {Currency, Percent, LabeledNumber, Text};
    8. EditTypeBase LineType;
    9. ...
    10. }
    To copy to clipboard, switch view to plain text mode 

    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?

    Qt Code:
    1. EditType A::GetType()
    2. {
    3. if (LineType == Currency)
    4. return EditType::Currency;
    5. ...
    6. }
    To copy to clipboard, switch view to plain text mode 

    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?
    thanks

    lou

  2. #2
    Join Date
    Feb 2006
    Posts
    29
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: enum scope

    never mind -- was forced to go a different direction ...

Similar Threads

  1. nmake error during .pro compiling
    By mattia in forum Installation and Deployment
    Replies: 5
    Last Post: 18th June 2008, 11:15
  2. Just for fun game
    By vermarajeev in forum Qt-based Software
    Replies: 6
    Last Post: 13th December 2007, 22:52
  3. Error compiling psql plugin
    By vieraci in forum Installation and Deployment
    Replies: 4
    Last Post: 7th October 2007, 03:49
  4. qt 4.2.2 install on aix
    By try to remember in forum Installation and Deployment
    Replies: 2
    Last Post: 28th March 2007, 13:19
  5. enum property
    By illuzioner in forum Qt Tools
    Replies: 10
    Last Post: 22nd August 2006, 22:47

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.