From 2415fe300af56bbb93591a767b5f1315c23bc827 Mon Sep 17 00:00:00 2001 From: stv Date: Thu, 9 Feb 2006 09:01:51 +0000 Subject: [PATCH] no message --- src/Qtx/QtxDockAction.cxx | 44 ++++++++++++++++++++++++++++++++++++++- src/Qtx/QtxDockAction.h | 2 ++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/src/Qtx/QtxDockAction.cxx b/src/Qtx/QtxDockAction.cxx index 89e72344c..b6e166b42 100755 --- a/src/Qtx/QtxDockAction.cxx +++ b/src/Qtx/QtxDockAction.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include /*! @@ -707,7 +708,36 @@ void QtxDockAction::dockWindows( QPtrList& lst, QMainWindow* main ) if ( !mw ) return; - lst = mw->dockWindows(); + QObjectList* objs = mw->queryList( "QDockWindow" ); + if ( objs ) + { + for ( QObjectListIt it( *objs ); it.current(); ++it ) + { + QDockWindow* dockWin = ::qt_cast( it.current() ); + if ( dockWin && dockMainWindow( mw, dockWin ) ) + lst.append( dockWin ); + } + } + delete objs; +} + +bool QtxDockAction::dockMainWindow( QMainWindow* mw, QObject* win ) const +{ + if ( !mw || !win ) + return false; + + while ( win ) + { + if ( win->parent() && win->parent() == mw ) + return true; + + if ( ::qt_cast( win->parent() ) ) + return false; + + win = win->parent(); + } + + return false; } /*! @@ -772,6 +802,14 @@ void QtxDockAction::loadPlaceInfo( QDockWindow* dw ) const if ( !myInfo.contains( dw ) ) return; + QMainWindow* mw = mainWindow(); + if ( !mw ) + return; + + QObject* p = dw->parent(); + if ( !( !p || p == mw || ( p->parent() && p->parent() == mw ) ) ) + return; + QString winName = myInfo[dw].name; if ( winName.isEmpty() || !myGeom.contains( winName ) ) return; @@ -807,6 +845,10 @@ void QtxDockAction::loadPlaceInfo() const QMap nameMap; for ( QPtrListIterator itr( lst ); itr.current(); ++itr ) { + QObject* p = itr.current()->parent(); + if ( !( !p || p == mw || ( p->parent() && p->parent() == mw ) ) ) + continue; + QString name; if ( myInfo.contains( itr.current() ) ) name = myInfo[itr.current()].name; diff --git a/src/Qtx/QtxDockAction.h b/src/Qtx/QtxDockAction.h index 4583bebda..5e3ae2de8 100755 --- a/src/Qtx/QtxDockAction.h +++ b/src/Qtx/QtxDockAction.h @@ -121,6 +121,8 @@ private: void updateMenus(); + bool dockMainWindow( QMainWindow*, QObject* ) const; + private: enum { AutoAdd = QEvent::User, LoadArea }; -- 2.39.2