How to convert QList to Array of C++
-
Convert the QList to QVector, then ,you get can the data pointer from it.
Or you can create a array of your data type, then copy all the data to it.
-
Agreed, and to add a little explanation: QList doesn't store its data as contiguous elements in memory (which is the case of QVector/std::vector), that's why there is no direct conversion available.
-
To pass it to an external library, to old-not-easy-to-modify code, or just to check he's good at avoiding crashs !
-
Hmm, Qt is cross-platform.........that's the strength of Qt! If done properly in Qt you are able to compile your code on any platform supported without resorting to C++ standard code.
Btw if you feel the topic has been answered post [SOLVED] in front of your first post