Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How can I copy the Qmap ?
Eng.Jason last edited by
Hello , I have some question about Qmap.
I want copy Qmap(A) to another Qmap(B) . so i try like this.
QMap <int, my_Struct> Amap; QMap <int, my_Struct> Bmap; Amap = Bmap; -> it occurred about Segmentation fault at here.
is this wrong way?
how can i copy the qmap? is that have a another ways?
please help me.
micland last edited by micland
Your code looks fine. The assignment operator for QMap is overloaded and should support your code snippet (see http://doc.qt.io/qt-5/qmap.html#operator-eq)
Do you do any fancy stuff in the copy constructor / assignment operator of
my_Structthat may lead to the segmentation fault?
To add to @micland, what's the base class of my_Struct ?