Skip to content

Commit 1c41cbf

Browse files
Fixed issue #641 - Unexpected behaviour with tab drag on scrollable tab bar
1 parent 06e8451 commit 1c41cbf

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/DockAreaTabBar.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,15 +390,18 @@ void CDockAreaTabBar::onTabWidgetMoved(const QPoint& GlobalPos)
390390

391391
int fromIndex = d->TabsLayout->indexOf(MovingTab);
392392
auto MousePos = mapFromGlobal(GlobalPos);
393-
MousePos.rx() = qMax(d->firstTab()->geometry().left(), MousePos.x());
394-
MousePos.rx() = qMin(d->lastTab()->geometry().right(), MousePos.x());
393+
MousePos.rx() = qMax(0, MousePos.x());
394+
MousePos.rx() = qMin(width(), MousePos.x());
395395
int toIndex = -1;
396396
// Find tab under mouse
397397
for (int i = 0; i < count(); ++i)
398398
{
399399
CDockWidgetTab* DropTab = tab(i);
400+
auto TabGeometry = DropTab->geometry();
401+
TabGeometry.setTopLeft(d->TabsContainerWidget->mapToParent(TabGeometry.topLeft()));
402+
TabGeometry.setBottomRight(d->TabsContainerWidget->mapToParent(TabGeometry.bottomRight()));
400403
if (DropTab == MovingTab || !DropTab->isVisibleTo(this)
401-
|| !DropTab->geometry().contains(MousePos))
404+
|| !TabGeometry.contains(MousePos))
402405
{
403406
continue;
404407
}

0 commit comments

Comments
 (0)