The SdiWindow module is now a simple window manager that manages Gui::Window objects.
Adding individual widgets and layouts is no more supported.
The idea is that the same Gui::Window object could be added to many different
window managers, not only the SdiWindow.
include_directories(${eVaf_INCLUDE})
# Required eVaf libraries
-set(eVaf_LIBRARIES CommonLib PluginsLib)
+set(eVaf_LIBRARIES CommonLib PluginsLib GuiLib)
# Source files
set(SRCS
class QLayout;
namespace eVaf {
+
+namespace Gui {
+ class Window;
+} // namespace eVaf::Gui
+
namespace SdiWindow {
/**
- * Main window interface for eVaf applications implementing the Single Document Interface.
+ * Single Document Interface window manager for eVaf applications.
*
- * The iSdiWindow interface provides access to the SDI main window. The SDI main window is
- * an empty window that the application can fill with widgets.
+ * The iSdiWindow interface implements an SDI window manager.
*/
struct SDIWINDOW_EXPORT iSdiWindow
{
static iSdiWindow * instance();
/**
- * Adds the widget to the end of the main window layout
- * @param widget The widget
- *
- * This function adds the widget to the end of the main window layout.
- */
- virtual void addWidget(QWidget * widget) = 0;
-
- /**
- * Adds the layout to the end of the main window layout
- * @param layout The layout
+ * Adds the window to the main SDI window
+ * @param window The window
*
- * This function adds the new layout to the end of the main window layout.
+ * This function adds a window to the main SDI layout.
*/
- virtual void addLayout(QLayout * layout) = 0;
+ virtual void addWindow(Gui::Window * window) = 0;
};
} // namespace eVaf::SdiWindow
} // namespace eVaf
-Q_DECLARE_INTERFACE(eVaf::SdiWindow::iSdiWindow, "eVaf.SdiWindow.iSdiWindow/1.0")
+Q_DECLARE_INTERFACE(eVaf::SdiWindow::iSdiWindow, "eVaf.SdiWindow.iSdiWindow/1.1")
#endif // isdiwindow.h
close();
- // Delete all the items added to the main window
- while (mItemsAdded.count() > 0) {
- QWeakPointer<QObject> item = mItemsAdded.takeAt(0);
- if (!item.isNull())
- delete item.data();
- }
+ // Delete the window
+ if (mWindow)
+ delete mWindow.data();
EVAF_INFO("%s finalized", qPrintable(objectName()));
}
-void MainWindow::addWidget(QWidget * widget)
-{
- mLayout->addWidget(widget);
- mItemsAdded.append(widget);
-}
-
-void MainWindow::addLayout(QLayout * layout)
+void MainWindow::addWindow(Gui::Window * window)
{
- mLayout->addLayout(layout);
- mItemsAdded.append(layout);
+ // Delete the existing window
+ if (mWindow)
+ delete mWindow.data();
+ mLayout->addWidget(window);
+ mWindow = window;
}
void MainWindow::saveSettings()
#include "isdiwindow.h"
#include <Plugins/iPlugin>
+#include <Gui/Window>
#include <QObject>
#include <QString>
virtual bool isReady() { return mReady; }
- virtual void addWidget(QWidget * widget);
-
- virtual void addLayout(QLayout * layout);
+ virtual void addWindow(Gui::Window * window);
private: // Methods
/// Ready flag
bool mReady;
- /// The layout of the window
+ /// The layout of the main window
QVBoxLayout * mLayout;
- /// Widgets and layouts added to the main window
- QList<QWeakPointer<QObject> > mItemsAdded;
+ /// eVaf GUI window implementing the main window
+ QWeakPointer<Gui::Window> mWindow;
};
/**
* Module/library version number in the form major,minor,release,build
*/
-#define VER_FILE_VERSION 0,2,4,5
+#define VER_FILE_VERSION 0,3,1,6
/**
* Module/library version number in the string format (shall end with \0)
*/
-#define VER_FILE_VERSION_STR "0.2.4.5\0"
+#define VER_FILE_VERSION_STR "0.3.1.6\0"
/**
* Module/library name (shall end with \0)