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:
#include "Account.h"
Account::Account() {
// do nothing
};
provider = _provider;
type = _type;
icon = _icon;
}
Account::Account(const Account &account) {
provider = account.provider;
type = account.type;
icon = account.icon;
}
Account::~ Account() {
// do nothing
}
void Account
::setProvider(QString _provider
) { provider = _provider;
}
return provider;
}
void Account
::setType(QString _type
) { type = _type;
}
return type;
}
void Account
::setIcon(QPixmap _icon
) { icon = _icon;
}
return icon;
}
Q_DECLARE_METATYPE(Account)
#include "Account.h"
Account::Account() {
// do nothing
};
Account::Account(QString _provider, QString _type, QPixmap _icon) {
provider = _provider;
type = _type;
icon = _icon;
}
Account::Account(const Account &account) {
provider = account.provider;
type = account.type;
icon = account.icon;
}
Account::~ Account() {
// do nothing
}
void Account::setProvider(QString _provider) {
provider = _provider;
}
QString Account::getProvider() {
return provider;
}
void Account::setType(QString _type) {
type = _type;
}
QString Account::getType() {
return type;
}
void Account::setIcon(QPixmap _icon) {
icon = _icon;
}
QPixmap Account::getIcon() {
return icon;
}
Q_DECLARE_METATYPE(Account)
To copy to clipboard, switch view to plain text mode
And the error is:
Account.cpp:47: error: expected constructor, destructor, or type conversion at end of input
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
Bookmarks