From e3d6bd3fc41b09c2eb7c56789d7dc5e26722a3b9 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Thu, 11 Jun 2009 16:05:28 +0200 Subject: Fixed ToolBar layout so that when a toolbar is resized to its sizeHint we get a "sticky" effect --- src/gui/widgets/qtoolbararealayout.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gui/widgets/qtoolbararealayout.cpp b/src/gui/widgets/qtoolbararealayout.cpp index 240d059..b1b743e 100644 --- a/src/gui/widgets/qtoolbararealayout.cpp +++ b/src/gui/widgets/qtoolbararealayout.cpp @@ -440,9 +440,10 @@ void QToolBarAreaLayoutInfo::moveToolBar(QToolBar *toolbar, int pos) //we check if the previous is near its size hint //in which case we try to stick to it - if (qAbs(pick(o, previous.sizeHint()) - (previous.size + extra)) < QApplication::startDragDistance()) { - //we stick to the default space - extra = 0; + const int diff = pick(o, previous.sizeHint()) - (previous.size + extra); + if (qAbs(diff) < QApplication::startDragDistance()) { + //we stick to the default place and size + extra += diff; } //update for the current item -- cgit v0.12