From 558c60c233f6c41e4dff867b7597120da893bd8b Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 14 Mar 2011 14:07:43 +0000 Subject: [PATCH] 0021207: EDF GUI: Impossible to show hide toolbars --- src/Qtx/QtxActionToolMgr.cxx | 5 ++++- src/Qtx/QtxToolBar.cxx | 8 +++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Qtx/QtxActionToolMgr.cxx b/src/Qtx/QtxActionToolMgr.cxx index b815cc2c4..35a5bcef8 100644 --- a/src/Qtx/QtxActionToolMgr.cxx +++ b/src/Qtx/QtxActionToolMgr.cxx @@ -28,6 +28,8 @@ #include "QtxAction.h" #include "QtxToolBar.h" +#include +#include #include /*! @@ -131,7 +133,7 @@ int QtxActionToolMgr::createToolBar( const QString& title, bool floatable, Qt::T if ( !tb ) { tb = new QtxToolBar( true, tbw ); - tb->setVisible( false ); // VSR: create toolbar visible initially + //tb->setVisible( false ); // VSR: create toolbar visible initially tb->setFloatable( floatable ); tb->setAllowedAreas( dockAreas ); tb->setMovable( dockAreas & Qt::AllToolBarAreas ); @@ -139,6 +141,7 @@ int QtxActionToolMgr::createToolBar( const QString& title, bool floatable, Qt::T tb->setWindowTitle( title ); tb->setObjectName( title ); tb->setToolTip( title ); + QApplication::postEvent( tb, new QHideEvent()); } tInfo.toolBar = tb; diff --git a/src/Qtx/QtxToolBar.cxx b/src/Qtx/QtxToolBar.cxx index abbfb1749..0b6b9f3d7 100644 --- a/src/Qtx/QtxToolBar.cxx +++ b/src/Qtx/QtxToolBar.cxx @@ -101,8 +101,9 @@ bool QtxToolBar::Watcher::eventFilter( QObject* o, QEvent* e ) bool updVis = ( o != myCont && ( e->type() == QEvent::Show || e->type() == QEvent::ShowToParent || e->type() == QEvent::Hide || e->type() == QEvent::HideToParent ) ) || - ( o == myCont && ( e->type() == QEvent::ChildRemoved || e->type() == QEvent::Show || - e->type() == QEvent::ShowToParent || e->type() == QEvent::ActionAdded || + ( o == myCont && ( e->type() == QEvent::ChildAdded || e->type() == QEvent::ChildRemoved || e->type() == QEvent::Show || + e->type() == QEvent::ShowToParent || e->type() == QEvent::Hide || + e->type() == QEvent::HideToParent || e->type() == QEvent::ActionAdded || e->type() == QEvent::ActionRemoved ) ); if ( updVis ) @@ -276,7 +277,7 @@ void QtxToolBar::Watcher::updateVisibility() } } - vis = vis || (!empty && isVisible()); + vis = (!isEmpty() && isVisible()); if ( vis != myCont->isVisibleTo( myCont->parentWidget() ) ) vis ? showContainer() : hideContainer(); } @@ -363,6 +364,7 @@ QtxToolBar::~QtxToolBar() */ void QtxToolBar::setVisible( bool visible ) { + if ( isVisible() == visible ) return; if ( myWatcher ) { if ( visible ) -- 2.39.2