X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_ToolBox.cpp;h=1ab883c86e13653ada9d70bf36bf1c98dec7d87b;hb=d0e479afb535cd9d6542d53302428a5c8e99485f;hp=7f8736a250fb110f49948a9eecadd6d8778a42e5;hpb=ad180bfdd74c7f6dc79aed6c0180c458f531c1ec;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_ToolBox.cpp b/src/ModuleBase/ModuleBase_ToolBox.cpp index 7f8736a25..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,10 +47,12 @@ 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() ); aButton->setToolTip( theName ); + aButton->setObjectName( theName ); myButtonsGroup->addButton( aButton, anOldCount ); myButtonsLayout->insertWidget( anOldCount, aButton ); } @@ -74,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; +}