From 7ad244cad155f32f22e82e1458eb1c42f759a620 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 7 Dec 2009 14:01:54 +0100 Subject: Fix the toolbars docking The gap could be inserted even if the toolbar is very far away. This is due to the fact that we were only considering the distance as 1-directional. Now we also check that mouse position is inside the main window. Reviewed-by: gabi --- src/gui/widgets/qtoolbararealayout.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/gui/widgets/qtoolbararealayout.cpp b/src/gui/widgets/qtoolbararealayout.cpp index c329305..b83026b 100644 --- a/src/gui/widgets/qtoolbararealayout.cpp +++ b/src/gui/widgets/qtoolbararealayout.cpp @@ -598,16 +598,21 @@ int QToolBarAreaLayoutInfo::distance(const QPoint &pos) const { switch (dockPos) { case QInternal::LeftDock: - return pos.x() - rect.right(); + if (pos.y() < rect.bottom()) + return pos.x() - rect.right(); case QInternal::RightDock: - return rect.left() - pos.x(); + if (pos.y() < rect.bottom()) + return rect.left() - pos.x(); case QInternal::TopDock: - return pos.y() - rect.bottom(); + if (pos.x() < rect.right()) + return pos.y() - rect.bottom(); case QInternal::BottomDock: - return rect.top() - pos.y(); + if (pos.x() < rect.right()) + return rect.top() - pos.y(); default: - return -1; + break; } + return -1; } /****************************************************************************** -- cgit v0.12