diff --git a/src/DockAreaTabBar.cpp b/src/DockAreaTabBar.cpp index e835144..39b2901 100644 --- a/src/DockAreaTabBar.cpp +++ b/src/DockAreaTabBar.cpp @@ -390,15 +390,18 @@ void CDockAreaTabBar::onTabWidgetMoved(const QPoint& GlobalPos) int fromIndex = d->TabsLayout->indexOf(MovingTab); auto MousePos = mapFromGlobal(GlobalPos); - MousePos.rx() = qMax(d->firstTab()->geometry().left(), MousePos.x()); - MousePos.rx() = qMin(d->lastTab()->geometry().right(), MousePos.x()); + MousePos.rx() = qMax(0, MousePos.x()); + MousePos.rx() = qMin(width(), MousePos.x()); int toIndex = -1; // Find tab under mouse for (int i = 0; i < count(); ++i) { CDockWidgetTab* DropTab = tab(i); + auto TabGeometry = DropTab->geometry(); + TabGeometry.setTopLeft(d->TabsContainerWidget->mapToParent(TabGeometry.topLeft())); + TabGeometry.setBottomRight(d->TabsContainerWidget->mapToParent(TabGeometry.bottomRight())); if (DropTab == MovingTab || !DropTab->isVisibleTo(this) - || !DropTab->geometry().contains(MousePos)) + || !TabGeometry.contains(MousePos)) { continue; }