Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deep copy QMap and other Qt containers

Generally speaking, what is the correct way to deep copy Qt containers? I'm not worried about deep copying the containers recursively, although addressing such would be helpful.

like image 554
Freedom_Ben Avatar asked May 28 '13 19:05

Freedom_Ben


1 Answers

Despite what everyone will tell you - that you don't deep copy Qt containers - there are situations in which you simply need to perform an actual deep copy instead of just a shallow one. To do that, use detach():

container1 = container2;
container1.detach();
like image 57
kralyk Avatar answered Oct 16 '22 13:10

kralyk