summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-12-07 13:01:54 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-12-07 13:08:10 (GMT)
commit7ad244cad155f32f22e82e1458eb1c42f759a620 (patch)
tree261f005d951c977d1db36c456780f2f6aa0a1164 /src/gui
parent757fc27dcdaf67b2f79d2f3bcc8eaaeff345c0c8 (diff)
downloadQt-7ad244cad155f32f22e82e1458eb1c42f759a620.zip
Qt-7ad244cad155f32f22e82e1458eb1c42f759a620.tar.gz
Qt-7ad244cad155f32f22e82e1458eb1c42f759a620.tar.bz2
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
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/widgets/qtoolbararealayout.cpp15
1 files 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;
}
/******************************************************************************