Skip to content

Commit

Permalink
Improved tab bar scrolling (#678)
Browse files Browse the repository at this point in the history
* Improved tab bar scrolling

* Fix: tab bar scroll for mouse
  • Loading branch information
Servall4 authored Dec 12, 2024
1 parent f237863 commit 1f21eb0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
14 changes: 2 additions & 12 deletions src/DockAreaTabBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,19 +160,9 @@ CDockAreaTabBar::~CDockAreaTabBar()
//============================================================================
void CDockAreaTabBar::wheelEvent(QWheelEvent* Event)
{
Event->accept();
const int direction = Event->angleDelta().y();
if (direction < 0)
{
horizontalScrollBar()->setValue(horizontalScrollBar()->value() + 20);
}
else
{
horizontalScrollBar()->setValue(horizontalScrollBar()->value() - 20);
}
QCoreApplication::sendEvent(horizontalScrollBar(), Event);
}


//============================================================================
void CDockAreaTabBar::setCurrentIndex(int index)
{
Expand Down Expand Up @@ -356,7 +346,7 @@ void CDockAreaTabBar::onCloseOtherTabsRequested()
CDockWidget::DockWidgetDeleteOnClose) ? 1 : 0;
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,
// then we do not need to correct the index
if (Tab->dockWidget()->isClosed())
Expand Down
3 changes: 1 addition & 2 deletions src/DockAreaTabBar.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ private Q_SLOTS:
void onTabWidgetMoved(const QPoint& GlobalPos);

protected:
virtual void wheelEvent(QWheelEvent* Event) override;

virtual void wheelEvent(QWheelEvent* Event) override;

public:
using Super = QScrollArea;
Expand Down

0 comments on commit 1f21eb0

Please sign in to comment.