[Interest] QHash memory management

Jason R. Kretzer jason at gocodigo.com
Tue Aug 5 23:10:02 CEST 2014

Just a quick question about using QHash with pointers.

Lets say I have the following snippet:


QWebView *view;
QHash<int, QWebView *> hash;

for(int i=0; i<10; i++) {
     view = new QWebView(this);
     hash.insert(i, view);

////go do something meaningful

//or do a hash.clear();
for(int j=0; j<10; j++) {


After the remove or clear is called, do I still need to delete the 
pointers?  If so, would I just iterate through them using the value 
function and delete them one by one?


Jason R. Kretzer
Lead Application Developer
jason at gocodigo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140805/3be2d894/attachment.html>

More information about the Interest mailing list