Hmm, the reason for the crash turns out to be rather different. I was implementing QVariant operators for my classes as per the wiki, so that I could get rid of the QVariant::fromValue( *myObject ) calls. I also put a qDebug() statement in the copy constructor of my class. Then, when calling setData( QModelIndex idx, *myObject ), the debug messages showed that the copy constructor was being called recusively, despite being defined as MyClass::MyClass( const MyClass &other ). This was obviously calling the program to crash. It wasn't even entering the setData() function, as I had qDebug() statements in there to check. It just spins in a loop, making copies of *myObject.
I am implementing copy constructors as I need the parents to changed when that object it copied, otherwise the QAbstractItemModels can't keep track of tree heirarchy. I am a bit lost as to why this is happening though![]()
Bookmarks