* @brief SdiWindow module's implementation
* @author Enar Vaikene
*
- * Copyright (c) 2011 Enar Vaikene
+ * Copyright (c) 2011-2019 Enar Vaikene
*
* This file is part of the eVaf C++ cross-platform application development framework.
*
#include <QList>
#include <QVector>
#include <QHash>
-#include <QWeakPointer>
+#include <QScopedPointer>
class QVBoxLayout;
public:
- MainWindow(QWidget * parent = 0, Qt::WindowFlags flags = 0);
+ MainWindow(QWidget * parent = nullptr, Qt::WindowFlags flags = 0);
virtual ~MainWindow();
protected: // Methods
- /// Garbage collector timer
- virtual void timerEvent(QTimerEvent * e);
-
private: // Methods
QString mMainPanelName;
/// List of GUI::Panel objects added to the manager
- QList<QWeakPointer<Gui::Panel> > mPanels;
+ QList<Gui::Panel *> mPanels;
/// List of minimized GUI::Panel objects
- QVector<QWeakPointer<Gui::Panel> > mMinimizedPanels;
+ QVector<Gui::Panel *> mMinimizedPanels;
/// Hash with panel names
- QHash<QString, QWeakPointer<Gui::Panel> > mPanelNames;
+ QHash<QString, Gui::Panel *> mPanelNames;
/// Current main panel added to this window
- QWeakPointer<Gui::Panel> mMainPanel;
-
- /// Garbage collector timer ID
- int mTimerId;
+ Gui::Panel * mMainPanel;
private: // Methods
/// Gets the main panel name from module attributes
QString getMainPanelName(QString const & args) const;
+
+private slots:
+
+ /// Panel destroyed signal. We need to remove the panel from all the
+ /// lists.
+ void panelDestroyed(QObject * obj = nullptr);
+
};
/**
virtual void done();
- virtual bool isReady() const { return mWindow != 0 && mWindow->isReady(); }
+ virtual bool isReady() const { return mWindow != nullptr && mWindow->isReady(); }
private:
/// iSdiWindow interface implementation
- MainWindow * mWindow;
+ QScopedPointer<MainWindow> mWindow;
};
} // namespace eVaf::SdiWindow::Internal