Improved tab bar scrolling (#678)

* Improved tab bar scrolling

* Fix: tab bar scroll for mouse
This commit is contained in:
Ivan Ugryumov 2024-12-12 15:13:01 +03:00 committed by GitHub
parent f2378636e2
commit 1f21eb0200
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 14 deletions

View File

@ -160,19 +160,9 @@ CDockAreaTabBar::~CDockAreaTabBar()
//============================================================================ //============================================================================
void CDockAreaTabBar::wheelEvent(QWheelEvent* Event) void CDockAreaTabBar::wheelEvent(QWheelEvent* Event)
{ {
Event->accept(); QCoreApplication::sendEvent(horizontalScrollBar(), Event);
const int direction = Event->angleDelta().y();
if (direction < 0)
{
horizontalScrollBar()->setValue(horizontalScrollBar()->value() + 20);
}
else
{
horizontalScrollBar()->setValue(horizontalScrollBar()->value() - 20);
}
} }
//============================================================================ //============================================================================
void CDockAreaTabBar::setCurrentIndex(int index) void CDockAreaTabBar::setCurrentIndex(int index)
{ {
@ -356,7 +346,7 @@ void CDockAreaTabBar::onCloseOtherTabsRequested()
CDockWidget::DockWidgetDeleteOnClose) ? 1 : 0; CDockWidget::DockWidgetDeleteOnClose) ? 1 : 0;
closeTab(i); closeTab(i);
// If the the dock widget blocks closing, i.e. if the flag // If the dock widget blocks closing, i.e. if the flag
// CustomCloseHandling is set, and the dock widget is still open, // CustomCloseHandling is set, and the dock widget is still open,
// then we do not need to correct the index // then we do not need to correct the index
if (Tab->dockWidget()->isClosed()) if (Tab->dockWidget()->isClosed())

View File

@ -67,7 +67,6 @@ private Q_SLOTS:
protected: protected:
virtual void wheelEvent(QWheelEvent* Event) override; virtual void wheelEvent(QWheelEvent* Event) override;
public: public:
using Super = QScrollArea; using Super = QScrollArea;