X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_ToolBox.cpp;h=1ab883c86e13653ada9d70bf36bf1c98dec7d87b;hb=43439fdaa624bc161321e9caf56e48f259187dad;hp=592b5a0325847da1ed4abc4cb760e1f11cb7a7c5;hpb=e25330fc6173134d1b9e5ac4580fc7ccc32c519e;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_ToolBox.cpp b/src/ModuleBase/ModuleBase_ToolBox.cpp index 592b5a032..1ab883c86 100644 --- a/src/ModuleBase/ModuleBase_ToolBox.cpp +++ b/src/ModuleBase/ModuleBase_ToolBox.cpp @@ -5,6 +5,8 @@ // Author: Alexandre SOLOVYOV #include +#include + #include #include #include @@ -45,6 +47,7 @@ void ModuleBase_ToolBox::addItem( QWidget* thePage, const QString& theName, cons myStack->addWidget( thePage ); QToolButton* aButton = new QToolButton( myButtonsFrame ); + aButton->setFocusPolicy(Qt::StrongFocus); aButton->setCheckable( true ); aButton->setIcon( theIcon ); aButton->setIconSize( theIcon.size() ); @@ -75,3 +78,26 @@ void ModuleBase_ToolBox::onButton( int theIndex ) myStack->setCurrentIndex( theIndex ); } +bool ModuleBase_ToolBox::isOffToolBoxParent(ModuleBase_ModelWidget* theWidget) +{ + bool isOffToolBox = false; + + QList aControls = theWidget->getControls(); + if (aControls.size() > 0) { + QWidget* aFirstControl = aControls.first(); + + QWidget* aWidget = aFirstControl; + QWidget* aParent = (QWidget*)aFirstControl->parent(); + while (aParent) { + QStackedWidget* aStackedWidget = dynamic_cast(aParent); + if (aStackedWidget) { + int anIndex = aStackedWidget->currentIndex(); + isOffToolBox = aStackedWidget->currentWidget() != aWidget; + break; + } + aWidget = aParent; + aParent = (QWidget*)aWidget->parent(); + } + } + return isOffToolBox; +}