[Qt-interest] How to properly destroy QWebViews?

Peter pgeorges at gmail.com
Wed Oct 28 17:08:44 CET 2009


Lets imagine we have a QTabWidget derived object with multiple QWebViews
derived widgets attached to it. When a tab is closed, would this not be
enough to completely destroy the QWebView widget and free up all the memory?

class TabWidget : public QTabWidget

class WebPanel : public QWebView


void TabWidget::closeTab(int index)

{

  QWidget* widget = QTabWidget::widget(index);

  removeTab(index);

  widget->deleteLater(); //or delete widget

}


or even (if it makes any difference?):


void TabWidget::closeTab(int index)

{

  WebPanel* webPanel = dynamic_cast<WebPanel*>(widget(index));

  removeTab(index);

  webPanel->deleteLater(); //or delete webPanel

}


What else must be done to completely free the memory used? If I goto a large
site, the memory usage shoots up but closing a tab does not clear it all.
Does QtWebKit keep some other objects laying around? Is it because I share a
single networkAccessManager between each QWebView?


Any assistance would be appreciated!


Cheers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091029/b8c7598e/attachment.html 


More information about the Qt-interest-old mailing list