Let Qt keep track of top-level windows.
This commit is contained in:
+5
-2
@@ -204,8 +204,11 @@ void File::close( MainWindow *window )
|
||||
///
|
||||
void File::exit()
|
||||
{
|
||||
foreach ( MainWindow* window, MainWindow::windowList() )
|
||||
foreach ( QWidget* qwidget, QApplication::topLevelWidgets() )
|
||||
{
|
||||
window->close();
|
||||
if ( MainWindow* window = qobject_cast<MainWindow*>(qwidget) )
|
||||
{
|
||||
window->close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,12 +52,6 @@
|
||||
#include "Help.h"
|
||||
|
||||
|
||||
///
|
||||
/// Static window list
|
||||
///
|
||||
QList<MainWindow*> MainWindow::smWindowList;
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
@@ -146,8 +140,6 @@ MainWindow::MainWindow()
|
||||
#endif
|
||||
|
||||
readSettings();
|
||||
|
||||
smWindowList.push_back( this );
|
||||
}
|
||||
|
||||
|
||||
@@ -156,7 +148,6 @@ MainWindow::MainWindow()
|
||||
///
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
smWindowList.removeOne( this );
|
||||
}
|
||||
|
||||
|
||||
@@ -208,14 +199,6 @@ bool MainWindow::isEmpty() const
|
||||
return mModel == 0;
|
||||
}
|
||||
|
||||
///
|
||||
/// Get window list
|
||||
///
|
||||
QList<MainWindow*> MainWindow::windowList()
|
||||
{
|
||||
return smWindowList;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Close Event Handler
|
||||
|
||||
@@ -70,8 +70,6 @@ public:
|
||||
void setModel( LabelModel* label );
|
||||
bool isEmpty() const;
|
||||
|
||||
static QList<MainWindow *> windowList();
|
||||
|
||||
|
||||
/////////////////////////////////////
|
||||
// Events
|
||||
@@ -186,8 +184,6 @@ private:
|
||||
// Private Data
|
||||
/////////////////////////////////////
|
||||
private:
|
||||
static QList<MainWindow*> smWindowList;
|
||||
|
||||
QMenu* fileMenu;
|
||||
QMenu* editMenu;
|
||||
QMenu* viewMenu;
|
||||
|
||||
Reference in New Issue
Block a user