Skip to content

Commit

Permalink
Fixed issue #641 - Unexpected behaviour with tab drag on scrollable t…
Browse files Browse the repository at this point in the history
…ab bar
  • Loading branch information
githubuser0xFFFF committed Jul 8, 2024
1 parent 06e8451 commit 1c41cbf
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/DockAreaTabBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 1c41cbf

Please sign in to comment.