array of structs?
-
How can I create a growable array of structs? It seems QVector<MyStruct*> is not allowed, nor is QVector<MyStruct>.
There is no QArray for some reason, but QTypedArray<MyStruct*> also doesn't work.
Should I revert to using standard C++ vectors?
I had thought about creating a QVector<QDict*> but in Qt 5 it seems that QDict doesn't exist any more. -
Hi
Both QVector<MyStruct*>
QVector<MyStruct> are allowed.If MyStruct is QObject based (has as the parent) then only pointer to it, can be used.
If MyStruct is simply a c++ struct then both QVector , QList, and all
containers that are known to man, will work.That said, nothing wrong in using std::vector and friends.
So something else must be up with the code
if it did not work for you.Please show definition of MyStruct if you want help to find out.