From 43a3a658dc8c465136e3d01f96dd57b9a8620b7f Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 10 Apr 2014 15:56:23 +0400 Subject: [PATCH] Bug with shown scroll buttons in main menu is corrected --- src/XGUI/XGUI_Workbench.cpp | 12 ++++++++++++ src/XGUI/XGUI_Workbench.h | 1 + 2 files changed, 13 insertions(+) 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(); -- 2.39.2