Results 1 to 6 of 6

Thread: Registering classe in QMetaType

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2007
    Location
    Brazil
    Posts
    8
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Registering classe in QMetaType

    Hi,

    I am trying to register a class on QMetaType in order to use it with QVariant. However, when I try to compile the class with the macro Q_DECLARE_METATYPE occurs an error.

    Here is the code:

    Qt Code:
    1. #include "Account.h"
    2.  
    3. Account::Account() {
    4. // do nothing
    5. };
    6.  
    7. Account::Account(QString _provider, QString _type, QPixmap _icon) {
    8. provider = _provider;
    9. type = _type;
    10. icon = _icon;
    11. }
    12.  
    13. Account::Account(const Account &account) {
    14. provider = account.provider;
    15. type = account.type;
    16. icon = account.icon;
    17. }
    18.  
    19. Account::~ Account() {
    20. // do nothing
    21. }
    22.  
    23. void Account::setProvider(QString _provider) {
    24. provider = _provider;
    25. }
    26.  
    27. QString Account::getProvider() {
    28. return provider;
    29. }
    30.  
    31. void Account::setType(QString _type) {
    32. type = _type;
    33. }
    34.  
    35. QString Account::getType() {
    36. return type;
    37. }
    38.  
    39. void Account::setIcon(QPixmap _icon) {
    40. icon = _icon;
    41. }
    42.  
    43. QPixmap Account::getIcon() {
    44. return icon;
    45. }
    46.  
    47. Q_DECLARE_METATYPE(Account)
    To copy to clipboard, switch view to plain text mode 

    And the error is:

    Qt Code:
    1. Account.cpp:47: error: expected constructor, destructor, or type conversion at end of input
    To copy to clipboard, switch view to plain text mode 

    The error is just at the line that invokes the macro.

    Any help is appreciated !

    Thanks,

    Rafael
    Last edited by rcintra; 14th May 2007 at 22:13.

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.