From: vsv Date: Thu, 10 Apr 2014 11:56:23 +0000 (+0400) Subject: Bug with shown scroll buttons in main menu is corrected X-Git-Tag: V_0.1~24^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=43a3a658dc8c465136e3d01f96dd57b9a8620b7f;p=modules%2Fshaper.git Bug with shown scroll buttons in main menu is corrected --- diff --git a/src/XGUI/XGUI_Workbench.cpp b/src/XGUI/XGUI_Workbench.cpp index b3a1aee2b..996d5a7ae 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); @@ -159,3 +160,14 @@ 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); +} \ No newline at end of file diff --git a/src/XGUI/XGUI_Workbench.h b/src/XGUI/XGUI_Workbench.h index cc362db2b..57b17d3be 100644 --- a/src/XGUI/XGUI_Workbench.h +++ b/src/XGUI/XGUI_Workbench.h @@ -27,6 +27,7 @@ private slots: protected: virtual void resizeEvent(QResizeEvent * theEvent); + virtual bool eventFilter(QObject *theObj, QEvent *theEvent); private: void addSeparator();