mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2025-01-24 13:32:06 +08:00
Improved tab bar scrolling (#678)
* Improved tab bar scrolling * Fix: tab bar scroll for mouse
This commit is contained in:
parent
f2378636e2
commit
1f21eb0200
@ -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())
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user