I have a class Pkg and I need to use it under form of QVariant.
At the end of my Pkg.h I have:
Q_DECLARE_METATYPE(Pkg)
and this does not give compile errors, but in my main.cpp I have to do:
qRegisterMetaType<Pkg>("Pkg");
and this does not give errors too, but when I try to create a QVariant(Pkg) I get lots of errors like:
In member function 'void MainWindow::FillPackagesList()':
mainWin.cpp:233: error: 'qRegisterMetaType' isnot a member of 'QMetaType' mainWin.cpp:234: error: no matching function for call to QVariant::QVariant(Pkg&)'
/usr/lib/qt/include/QtCore/qvariant.h:208: note: QVariant::QVariant(Qt::GlobalColor)
/usr/lib/qt/include/QtCore/qvariant.h:206: note: QVariant::QVariant(const QRegExp&)
/usr/lib/qt/include/QtCore/qvariant.h:204: note: QVariant::QVariant(const QLocale&)
/usr/lib/qt/include/QtCore/qvariant.h:203: note: QVariant::QVariant(const QUrl&)
/usr/lib/qt/include/QtCore/qvariant.h:201: note: QVariant::QVariant(const QRectF&)
/usr/lib/qt/include/QtCore/qvariant.h:200: note: QVariant::QVariant(const QRect&)
and errors over errors again...