diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-11-20 13:13:03 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-11-20 13:14:55 (GMT) |
commit | 4fbf19955d5c018d8f12611d39348b48be3ff006 (patch) | |
tree | f91cef7e898919898d3c0a3f95fc0461b409fd6f /src/gui/widgets | |
parent | a2c247ed521d88f99a21b4207cdff8ea03e949be (diff) | |
download | Qt-4fbf19955d5c018d8f12611d39348b48be3ff006.zip Qt-4fbf19955d5c018d8f12611d39348b48be3ff006.tar.gz Qt-4fbf19955d5c018d8f12611d39348b48be3ff006.tar.bz2 |
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.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/qtoolbararealayout.cpp | 11 | ||||
-rw-r--r-- | 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<QToolBarAreaLayoutItem> toolBarItems; }; |