Skip to content

Commit 1f21eb0

Browse files
authored
Improved tab bar scrolling (#678)
* Improved tab bar scrolling * Fix: tab bar scroll for mouse
1 parent f237863 commit 1f21eb0

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

src/DockAreaTabBar.cpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -160,19 +160,9 @@ CDockAreaTabBar::~CDockAreaTabBar()
160160
//============================================================================
161161
void CDockAreaTabBar::wheelEvent(QWheelEvent* Event)
162162
{
163-
Event->accept();
164-
const int direction = Event->angleDelta().y();
165-
if (direction < 0)
166-
{
167-
horizontalScrollBar()->setValue(horizontalScrollBar()->value() + 20);
168-
}
169-
else
170-
{
171-
horizontalScrollBar()->setValue(horizontalScrollBar()->value() - 20);
172-
}
163+
QCoreApplication::sendEvent(horizontalScrollBar(), Event);
173164
}
174165

175-
176166
//============================================================================
177167
void CDockAreaTabBar::setCurrentIndex(int index)
178168
{
@@ -356,7 +346,7 @@ void CDockAreaTabBar::onCloseOtherTabsRequested()
356346
CDockWidget::DockWidgetDeleteOnClose) ? 1 : 0;
357347
closeTab(i);
358348

359-
// If the the dock widget blocks closing, i.e. if the flag
349+
// If the dock widget blocks closing, i.e. if the flag
360350
// CustomCloseHandling is set, and the dock widget is still open,
361351
// then we do not need to correct the index
362352
if (Tab->dockWidget()->isClosed())

src/DockAreaTabBar.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ private Q_SLOTS:
6565
void onTabWidgetMoved(const QPoint& GlobalPos);
6666

6767
protected:
68-
virtual void wheelEvent(QWheelEvent* Event) override;
69-
68+
virtual void wheelEvent(QWheelEvent* Event) override;
7069

7170
public:
7271
using Super = QScrollArea;

0 commit comments

Comments
 (0)