Bir Meta Türü Kayıt Olun Bir dersim var ve bunu bir Qvariant'ta kullanmak istiyorum, bu yüzden Meta tipini Bildirmek ve Kaydetmek zorundayım.Qt
class blabla: public QThread
{
Q_OBJECT
.
.
.
};
Q_DECLARE_METATYPE(blabla)
Ama bu kod bana hata veriyor: Bu benim yaptığım budur benim met-tipi kayıt gerekiyor galiba
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
, ama nereye qRegisterMetaType<MyClass>("MyClass");
olduğundan emin değilim . Meta türü bildirim makrosundan sonra sahip olmayı denedim, ancak hatayla sonuçlandı. Beni doğru yola yönlendiren herhangi bir yorumu veya ipucu seçin.
Kayıtlı olduğum sınıf için olan meta verip'leri C++ kaynak dosyasına kaydettirdiğime inanıyorum. Ve cmannett85 gibi, nesneler değil sınıflara işaretçiler kullandığımı söyledi. – drescherjm