From a2c247ed521d88f99a21b4207cdff8ea03e949be Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 20 Nov 2009 13:59:18 +0100 Subject: Do not extend the last toolbar in a line when moving it --- src/gui/widgets/qtoolbararealayout.cpp | 11 ++++++----- src/gui/widgets/qtoolbararealayout_p.h | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/gui/widgets/qtoolbararealayout.cpp b/src/gui/widgets/qtoolbararealayout.cpp index b7e985c..d09a301 100644 --- a/src/gui/widgets/qtoolbararealayout.cpp +++ b/src/gui/widgets/qtoolbararealayout.cpp @@ -100,7 +100,7 @@ bool QToolBarAreaLayoutItem::skip() const */ QToolBarAreaLayoutLine::QToolBarAreaLayoutLine(Qt::Orientation orientation) - : o(orientation) + : o(orientation), lastVisible(-1) { } @@ -146,7 +146,7 @@ QSize QToolBarAreaLayoutLine::minimumSize() const void QToolBarAreaLayoutLine::fitLayout() { - int last = -1; + lastVisible = -1; int min = pick(o, minimumSize()); int space = pick(o, rect.size()); int extra = qMax(0, space - min); @@ -169,7 +169,7 @@ void QToolBarAreaLayoutLine::fitLayout() extra -= extraSpace; - last = i; + lastVisible = i; } // calculate the positions from the sizes @@ -180,7 +180,7 @@ void QToolBarAreaLayoutLine::fitLayout() continue; item.pos = pos; - if (i == last) // stretch the last item to the end of the line + if (i == lastVisible) // stretch the last item to the end of the line item.size = qMax(0, pick(o, rect.size()) - item.pos); pos += item.size; } @@ -441,7 +441,8 @@ void QToolBarAreaLayoutInfo::moveToolBar(QToolBar *toolbar, int pos) } //update for the current item - current.extendSize(line.o, -extra); + if (k != line.lastVisible) + current.extendSize(line.o, -extra); if (extra >= 0) { previous.extendSize(line.o, extra); diff --git a/src/gui/widgets/qtoolbararealayout_p.h b/src/gui/widgets/qtoolbararealayout_p.h index f0ab80c..afbd455 100644 --- a/src/gui/widgets/qtoolbararealayout_p.h +++ b/src/gui/widgets/qtoolbararealayout_p.h @@ -148,6 +148,7 @@ public: QRect rect; Qt::Orientation o; + int lastVisible; QList toolBarItems; }; -- cgit v0.12