From c4a83ba75749a723f2d30688a2424d2cc6444c95 Mon Sep 17 00:00:00 2001 From: asl Date: Thu, 14 Feb 2008 12:59:11 +0000 Subject: [PATCH] 1) the method find() is public now 2) the createToolBar() accepts the parameter QMainWindow* --- src/Qtx/QtxActionToolMgr.cxx | 8 +++++--- src/Qtx/QtxActionToolMgr.h | 5 +++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Qtx/QtxActionToolMgr.cxx b/src/Qtx/QtxActionToolMgr.cxx index 47b339edd..f234f2dcb 100644 --- a/src/Qtx/QtxActionToolMgr.cxx +++ b/src/Qtx/QtxActionToolMgr.cxx @@ -92,9 +92,10 @@ QMainWindow* QtxActionToolMgr::mainWindow() const \param title toolbar title \param tid requested toolbar ID + \param mw parent main window; if it is null, the tool manager's main window is used \return id of created/found toolbar */ -int QtxActionToolMgr::createToolBar( const QString& title, const int tid ) +int QtxActionToolMgr::createToolBar( const QString& title, const int tid, QMainWindow* mw ) { static int _toolBarId = -1; @@ -108,7 +109,8 @@ int QtxActionToolMgr::createToolBar( const QString& title, const int tid ) if ( tbId != -1 ) return tbId; - QToolBar* tb = find( title, mainWindow() ); + QMainWindow* tbw = mw ? mw : mainWindow(); + QToolBar* tb = find( title, tbw ); tbId = tid < 0 ? --_toolBarId : tid; @@ -117,7 +119,7 @@ int QtxActionToolMgr::createToolBar( const QString& title, const int tid ) if ( !tb ) { - tb = new QtxToolBar( true, mainWindow() ); + tb = new QtxToolBar( true, tbw ); mainWindow()->addToolBar( tb ); tb->setWindowTitle( title ); tb->setObjectName( title ); diff --git a/src/Qtx/QtxActionToolMgr.h b/src/Qtx/QtxActionToolMgr.h index be8bda268..b774dda33 100644 --- a/src/Qtx/QtxActionToolMgr.h +++ b/src/Qtx/QtxActionToolMgr.h @@ -61,7 +61,7 @@ public: QMainWindow* mainWindow() const; - int createToolBar( const QString&, int = -1 ); + int createToolBar( const QString&, int = -1, QMainWindow* = 0 ); void removeToolBar( const QString& ); void removeToolBar( const int ); @@ -101,11 +101,12 @@ public: virtual bool load( const QString&, QtxActionMgr::Reader& ); + int find( QToolBar* ) const; + protected slots: void onToolBarDestroyed(); protected: - int find( QToolBar* ) const; int find( const QString& ) const; QToolBar* find( const QString&, QMainWindow* ) const; -- 2.39.2