diff --git a/src/Gui/WorkbenchSelector.cpp b/src/Gui/WorkbenchSelector.cpp index 4d8ca65dd3..c2ded0ec6b 100644 --- a/src/Gui/WorkbenchSelector.cpp +++ b/src/Gui/WorkbenchSelector.cpp @@ -428,3 +428,5 @@ void WorkbenchTabWidget::adjustSize() parentWidget()->adjustSize(); } + +#include "moc_WorkbenchSelector.cpp" diff --git a/src/Gui/WorkbenchSelector.h b/src/Gui/WorkbenchSelector.h index 272a8b8a2a..2ae36cfd5b 100644 --- a/src/Gui/WorkbenchSelector.h +++ b/src/Gui/WorkbenchSelector.h @@ -29,6 +29,8 @@ #include #include #include +#include + #include #include #include @@ -101,7 +103,23 @@ class GuiExport WorkbenchTabWidget : public QWidget return size; } + void wheelEvent(QWheelEvent* wheelEvent) override + { + // Qt does not expose any way to programmatically control scroll of QTabBar hence + // we need to use a bit hacky solution of simulating clicks on the scroll buttons + + auto left = findChild(QString::fromUtf8("ScrollLeftButton")); + auto right = findChild(QString::fromUtf8("ScrollRightButton")); + + if (wheelEvent->angleDelta().y() > 0) { + right->click(); + } else { + left->click(); + } + } + WorkbenchItemStyle itemStyle() const { return _itemStyle; } + void setItemStyle(WorkbenchItemStyle itemStyle) { _itemStyle = itemStyle; setProperty("style", QString::fromUtf8(workbenchItemStyleToString(itemStyle))); @@ -122,7 +140,7 @@ class GuiExport WorkbenchTabWidget : public QWidget public: explicit WorkbenchTabWidget(WorkbenchGroup* aGroup, QWidget* parent = nullptr); - + void setToolBarArea(Gui::ToolBarArea area); void buildPrefMenu();