Mam klasę i chcę go używać w Qvariant, dlatego muszę zadeklarować i zarejestrować typ Meta. To, co zrobiłem:Zarejestruj Meta Type w Qt
class blabla: public QThread
{
Q_OBJECT
.
.
.
};
Q_DECLARE_METATYPE(blabla)
Ale ten kod daje mi błąd:
In copy constructor ‘QThread::QThread(const QThread&)’:
instantiated from ‘void* qMetaTypeConstructHelper(const T*) [with T = blabla]’
instantiated from ‘int qRegisterMetaType(const char*, T*) [with T = blabla]’
instantiated from here
‘QObject::QObject(const QObject&)’ is private
within this context
In file included from UnitTest.cpp:16:0:
blabla.h: In copy constructor ‘blabla::blabla(const blabla&)’:
note: synthesized method ‘QThread::QThread(const QThread&)’ first required here
In file included from /usr/include/QtCore/qvariant.h:48:0,
from /usr/include/QtCore/qabstractitemmodel.h:45,
from /usr/include/QtCore/QtCore:7,
from /usr/include/QtTest/QtTest:3,
from UnitTest.h:16,
from UnitTest.cpp:14:
In function ‘void* qMetaTypeConstructHelper(const T*) [with T = blabla]’:
note: synthesized method ‘blabla::blabla(const blabla&)’ first required here
make[1]: *** [build/obj/UnitTest.o] Error 1
Chyba trzeba zarejestrować Met-typ, ale nie jestem pewien, gdzie mają qRegisterMetaType<MyClass>("MyClass");
. Próbowałem go po makrze deklaracji typu meta, ale spowodował błąd. Zgłaszaj wszelkie komentarze lub wskazówki, które kierują mnie na właściwą ścieżkę.
Wierzę, że rejestruję metatypesy w pliku źródłowym C++ dla klasy, którą rejestruję. I tak jak cmannett85 powiedziałem, że używam wskaźników do klas, a nie obiektów. – drescherjm