Unsolved Generate assert failure when qmodelindex is put into qdatastream...
-
Hi,
I am trying to put qmodelindex into qdatastream and I get the following error:
What should I do?
< source >
QVariant v(model_Idx);
QByteArray ba;
QDataStream ds(&ba, QIODevice::ReadWrite);ds << v;
<error>
Debug Error!
Module : 5.7.1
File : global\gglobal.cpp
Line:3089
ASSERT failure in QVariant::save "Invalid type to save", file kernel\qvariant.cpp, line 2144Bye...
-
I don't think QModelIndex storing in stream is supported. Since save operation returns false for QModelIndex, it must be crashing. May be you can get the row,column values from QModelIndex and save them in stream. Also as side note, it is not a good idea to store the QModelIndex. See the warning message in Qt documentation for QModelIndex.