Results 1 to 3 of 3

Thread: How to use custom enum in designer that be decladred in an other class

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2011
    Posts
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to use custom enum in designer that be decladred in an other class

    Hi,

    I solved it alone, simply like this

    Qt Code:
    1. class CFoo : public QObject
    2. {
    3. Q_OBJECT
    4. Q_ENUMS(EDataType)
    5. public:
    6. enum EDataType {edtString=0, edtInt, edtDouble, edtDate};
    7. };
    8.  
    9.  
    10. class QDESIGNER_WIDGET_EXPORT CMyLabel : public QLabel
    11. {
    12. Q_OBJECT
    13. Q_PROPERTY(CFoo::EDataType dataType READ getDataType WRITE setDataType)
    14. Q_ENUMS(CFoo::EDataType)
    15. public:
    16. CMyLabel(QWidget *parent = 0);
    17. CFoo::EDataType getDataType(void) { return _dataType; }
    18. void setDataType(CFoo::EDataType dataType) { _dataType=dataType; }
    19. private:
    20. CFoo::EDataType _dataType;
    21. };
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to use custom enum in designer that be decladred in an other class

    I think you don't need line #14 in your code.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 7
    Last Post: 18th August 2011, 14:43
  2. QItemEditorFactory and custom enum types.
    By hickscorp in forum Qt Programming
    Replies: 4
    Last Post: 7th August 2011, 16:08
  3. show custom enum property in designer?
    By qlands in forum Qt Programming
    Replies: 0
    Last Post: 5th July 2011, 17:12
  4. static enum in a class
    By mickey in forum General Programming
    Replies: 3
    Last Post: 19th August 2008, 19:02
  5. Store an custom enum in QSettings
    By Lykurg in forum Qt Programming
    Replies: 1
    Last Post: 14th March 2007, 20:06

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
  •  
Qt is a trademark of The Qt Company.