From 4fbf19955d5c018d8f12611d39348b48be3ff006 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 20 Nov 2009 14:13:03 +0100 Subject: Revert "Do not extend the last toolbar in a line when moving it" make a real fix for the problem is defaulting to sizehint when there is no preferred size set (ie the toolbar hasn't been moved) This reverts commit a2c247ed521d88f99a21b4207cdff8ea03e949be. --- src/gui/widgets/qtoolbararealayout.cpp | 11 +++++------ src/gui/widgets/qtoolbararealayout_p.h | 3 +-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/gui/widgets/qtoolbararealayout.cpp b/src/gui/widgets/qtoolbararealayout.cpp index d09a301..b7e985c 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), lastVisible(-1) + : o(orientation) { } @@ -146,7 +146,7 @@ QSize QToolBarAreaLayoutLine::minimumSize() const void QToolBarAreaLayoutLine::fitLayout() { - lastVisible = -1; + int last = -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; - lastVisible = i; + last = i; } // calculate the positions from the sizes @@ -180,7 +180,7 @@ void QToolBarAreaLayoutLine::fitLayout() continue; item.pos = pos; - if (i == lastVisible) // stretch the last item to the end of the line + if (i == last) // stretch the last item to the end of the line item.size = qMax(0, pick(o, rect.size()) - item.pos); pos += item.size; } @@ -441,8 +441,7 @@ void QToolBarAreaLayoutInfo::moveToolBar(QToolBar *toolbar, int pos) } //update for the current item - if (k != line.lastVisible) - current.extendSize(line.o, -extra); + 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 afbd455..134e95a 100644 --- a/src/gui/widgets/qtoolbararealayout_p.h +++ b/src/gui/widgets/qtoolbararealayout_p.h @@ -118,7 +118,7 @@ public: void extendSize(Qt::Orientation o, int extent) { - int newSize = qMax(pick(o, minimumSize()), (preferredSize > 0 ? preferredSize : size) + extent); + int newSize = qMax(pick(o, minimumSize()), (preferredSize > 0 ? preferredSize : pick(o, sizeHint())) + extent); int sizeh = pick(o, sizeHint()); if (newSize == sizeh) { preferredSize = -1; @@ -148,7 +148,6 @@ public: QRect rect; Qt::Orientation o; - int lastVisible; QList toolBarItems; }; -- cgit v0.12