Commit a3de986c authored by Julien Finet's avatar Julien Finet Committed by Marcus D. Hanwell
Browse files

BUG: Fix memory leak... the Qt mainwindow was not destructed

parent 3f13424c
...@@ -45,11 +45,11 @@ int main( int argc, char * argv [] ) ...@@ -45,11 +45,11 @@ int main( int argc, char * argv [] )
{ {
// Qt initialization // Qt initialization
QApplication app(argc, argv); QApplication app(argc, argv);
QMainWindow *mainWindow = new QMainWindow; QMainWindow mainWindow;
mainWindow->setGeometry(0, 0, 1150, 600); mainWindow.setGeometry(0, 0, 1150, 600);
// QVTK set up and initialization // QVTK set up and initialization
QVTKWidget *qvtkWidget = new QVTKWidget(mainWindow); QVTKWidget *qvtkWidget = new QVTKWidget(&mainWindow);
// Set up my 2D world... // Set up my 2D world...
VTK_CREATE(vtkContextView, view); // This contains a chart object VTK_CREATE(vtkContextView, view); // This contains a chart object
...@@ -107,7 +107,7 @@ int main( int argc, char * argv [] ) ...@@ -107,7 +107,7 @@ int main( int argc, char * argv [] )
line->SetWidth(2.0); line->SetWidth(2.0);
*/ */
// Now lets try to add a table view // Now lets try to add a table view
QWidget *widget = new QWidget(mainWindow); QWidget *widget = new QWidget(&mainWindow);
QHBoxLayout *layout = new QHBoxLayout(widget); QHBoxLayout *layout = new QHBoxLayout(widget);
VTK_CREATE(vtkQtTableView, tableView); VTK_CREATE(vtkQtTableView, tableView);
tableView->SetSplitMultiComponentColumns(true); tableView->SetSplitMultiComponentColumns(true);
...@@ -116,10 +116,10 @@ int main( int argc, char * argv [] ) ...@@ -116,10 +116,10 @@ int main( int argc, char * argv [] )
layout->addWidget(qvtkWidget, 2); layout->addWidget(qvtkWidget, 2);
//layout->addWidget(qtChart, 2); //layout->addWidget(qtChart, 2);
layout->addWidget(tableView->GetWidget()); layout->addWidget(tableView->GetWidget());
mainWindow->setCentralWidget(widget); mainWindow.setCentralWidget(widget);
// Now show the application and start the event loop // Now show the application and start the event loop
mainWindow->show(); mainWindow.show();
return app.exec(); return app.exec();
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment