]> vaikene.ee Git - evaf/blobdiff - src/plugins/SdiWindow/sdiwindow.cpp
Changed the way how the main window is used.
[evaf] / src / plugins / SdiWindow / sdiwindow.cpp
index a804dfc14cc64dc70a8739612dc8decf3a0636a7..4be6efe4f333b9b075db4e6dbdd6e2f52a38ccf5 100644 (file)
@@ -63,6 +63,10 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags flags)
     // Apply the size specified in a) properties; or b) on the command line
     setWindowSize();
 
+    // Create the default layout
+    mLayout = new QVBoxLayout;
+    setLayout(mLayout);
+
     EVAF_INFO("%s created", qPrintable(objectName()));
 }
 
@@ -89,9 +93,25 @@ void MainWindow::done()
 {
     close();
 
+    // Delete all the items added to the main window
+    while (mItemsAdded.count() > 0)
+        delete mItemsAdded.takeAt(0);
+
     EVAF_INFO("%s finalized", qPrintable(objectName()));
 }
 
+void MainWindow::addWidget(QWidget * widget)
+{
+    mLayout->addWidget(widget);
+    mItemsAdded.append(widget);
+}
+
+void MainWindow::addLayout(QLayout * layout)
+{
+    mLayout->addLayout(layout);
+    mItemsAdded.append(layout);
+}
+
 void MainWindow::saveSettings()
 {
     static int ver[4] = {VER_FILE_VERSION};