From 35eac29df43632c7054b1b4d6a98e2ef370bbc23 Mon Sep 17 00:00:00 2001 From: aquiles Date: Mon, 15 Nov 2010 00:04:10 +0100 Subject: [PATCH] Changed: #1150 fixed some dockwidgets bugs --- .../src/georges_treeview_dialog.cpp | 1 + .../georges_editor_qt/src/main_window.cpp | 32 ++++++++++++++----- .../georges_editor_qt/src/main_window.h | 1 + 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/georges_treeview_dialog.cpp b/code/ryzom/tools/leveldesign/georges_editor_qt/src/georges_treeview_dialog.cpp index fa94dc88e..2ab35f92d 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/src/georges_treeview_dialog.cpp +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/src/georges_treeview_dialog.cpp @@ -274,6 +274,7 @@ namespace NLQT Modules::mainWin().createEmptyView( Modules::mainWin().getTreeViewList().takeFirst()); } + Modules::mainWin().getTreeViewList().removeOne(this); deleteLater(); } } diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/main_window.cpp b/code/ryzom/tools/leveldesign/georges_editor_qt/src/main_window.cpp index 57c0c3fe2..59fcd9ba8 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/src/main_window.cpp +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/src/main_window.cpp @@ -41,7 +41,7 @@ namespace NLQT CMainWindow::CMainWindow(QWidget *parent) : QMainWindow(parent), _GeorgesLogDialog(0), _ObjectViewerDialog(0), - _GeorgesDirTreeDialog(0) + _GeorgesDirTreeDialog(0),_emptyView(0) { setWindowTitle("Qt Georges Editor"); @@ -106,17 +106,31 @@ namespace NLQT CMainWindow::~CMainWindow() { // save state & geometry of window and widgets - QSettings settings("georges_editor_qt.ini", QSettings::IniFormat); - settings.beginGroup("WindowSettings"); - settings.setValue("QtWindowState", saveState()); - settings.setValue("QtWindowGeometry", saveGeometry()); - settings.endGroup(); + _statusBarTimer->stop(); delete _ObjectViewerDialog; delete _GeorgesDirTreeDialog; delete _GeorgesLogDialog; + delete _emptyView; + } + + void CMainWindow::closeEvent(QCloseEvent *event) + { + // TODO: dirty hack to have qt recognize possible state/geometry changes + // of new emptyView + CGeorgesTreeViewDialog *bla = new CGeorgesTreeViewDialog(this, true); + tabifyDockWidget(_emptyView, bla); + removeDockWidget(bla); + bla->deleteLater(); + + QSettings settings("georges_editor_qt.ini", QSettings::IniFormat); + settings.beginGroup("WindowSettings"); + settings.setValue("QtWindowState", saveState()); + settings.setValue("QtWindowGeometry", saveGeometry()); + settings.endGroup(); + event->accept(); } void CMainWindow::openTreeView(QString file) @@ -135,13 +149,12 @@ namespace NLQT if (!newView) { newView = new CGeorgesTreeViewDialog(this); - //newView->setAllowedAreas(Qt::TopDockWidgetArea | Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); newView->setWindowTitle(file); if (_treeViewList.isEmpty()) { - _emptyView->deleteLater(); tabifyDockWidget(_emptyView, newView); + _emptyView->deleteLater(); } else { @@ -245,8 +258,10 @@ namespace NLQT void CMainWindow::createEmptyView(QDockWidget* w) { _emptyView = new CGeorgesTreeViewDialog(this, true); + if(w) { + addDockWidget(Qt::TopDockWidgetArea, _emptyView); tabifyDockWidget(w, _emptyView); } else @@ -401,6 +416,7 @@ namespace NLQT void CMainWindow::tabChanged(int index) { + nlinfo(QString("%1").arg(index).toStdString().c_str()); if (index == -1) { setWindowTitle("Qt Georges Editor"); diff --git a/code/ryzom/tools/leveldesign/georges_editor_qt/src/main_window.h b/code/ryzom/tools/leveldesign/georges_editor_qt/src/main_window.h index da08a8efe..7f56503cf 100644 --- a/code/ryzom/tools/leveldesign/georges_editor_qt/src/main_window.h +++ b/code/ryzom/tools/leveldesign/georges_editor_qt/src/main_window.h @@ -58,6 +58,7 @@ namespace NLQT QList& getTreeViewList() { return _treeViewList; } QTabBar* getTabBar(); void createEmptyView(QDockWidget* w = 0); + void closeEvent(QCloseEvent *event); private Q_SLOTS: void open();