X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_Workbench.cpp;h=f92380374eb88c32b2494d572f29bd49b276da50;hb=f8d51abf2ab6024a974d42c139f7650ccf0ef774;hp=b3a1aee2b98d5db5c01e5ada92be46433ad7ec30;hpb=e1f8fb3cfc1ee565db16fbbd9fe6f65121c4577c;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_Workbench.cpp b/src/XGUI/XGUI_Workbench.cpp index b3a1aee2b..f92380374 100644 --- a/src/XGUI/XGUI_Workbench.cpp +++ b/src/XGUI/XGUI_Workbench.cpp @@ -50,6 +50,7 @@ XGUI_Workbench::XGUI_Workbench(QWidget *theParent) myCommandsArea = new CommandsArea(this); aMainLayout->addWidget(myCommandsArea); + myCommandsArea->viewport()->installEventFilter(this); myChildWidget = new QWidget(myCommandsArea); myCommandsArea->setWidget(myChildWidget); @@ -83,7 +84,9 @@ XGUI_MenuGroupPanel* XGUI_Workbench::addGroup(const QString& theId) XGUI_MenuGroupPanel* aGroup = new XGUI_MenuGroupPanel(myChildWidget); aGroup->setObjectName(theId); myLayout->addWidget(aGroup); - addSeparator(); + if(theId != "Default") { + addSeparator(); + } myLayout->addStretch(); myGroups.append(aGroup); return aGroup; @@ -159,3 +162,34 @@ bool XGUI_Workbench::isExceedsRight() int aWgtWidth = myChildWidget->childrenRect().width(); return ((aVPWidth - aPos.x()) < aWgtWidth); } + +bool XGUI_Workbench::eventFilter(QObject *theObj, QEvent *theEvent) +{ + if (theObj == myCommandsArea->viewport()) { + if (theEvent->type() == QEvent::Resize) { + myLeftButton->setVisible(isExceedsLeft()); + myRightButton->setVisible(isExceedsRight()); + } + } + return QWidget::eventFilter(theObj, theEvent); +} + +XGUI_Command* XGUI_Workbench::feature(const QString& theId) const +{ + QList::const_iterator aIt; + for (aIt = myGroups.constBegin(); aIt != myGroups.constEnd(); ++aIt) { + XGUI_Command* aCmd = (*aIt)->feature(theId); + if (aCmd) + return aCmd; + } + return 0; +} + +QList XGUI_Workbench::features() const +{ + QList aList; + QList::const_iterator aIt; + for (aIt = myGroups.constBegin(); aIt != myGroups.constEnd(); ++aIt) + aList.append((*aIt)->features()); + return aList; +}