mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-11-15 05:05:43 +08:00
Fixed issue #641 - Unexpected behaviour with tab drag on scrollable tab bar
This commit is contained in:
parent
06e8451fc0
commit
1c41cbff82
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user