summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-07-07 09:12:39 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-07-07 09:12:39 (GMT)
commit07ba75cb8031b844484901bef903fb055cc0b182 (patch)
treef366f1b4090078d07a253f76f0a996802f38978e /src/gui/widgets
parent4e31ccad1cfb9df0d624d5c39d7906a75b4fc2d0 (diff)
downloadQt-07ba75cb8031b844484901bef903fb055cc0b182.zip
Qt-07ba75cb8031b844484901bef903fb055cc0b182.tar.gz
Qt-07ba75cb8031b844484901bef903fb055cc0b182.tar.bz2
QToolBar: better management of positions when hiding/unhiding
The toolbar that one would unhide could be packed at the right of the screen. This was because the last toolbar always has a size that fills the space. So if you unhide a toolbar situated after this one, it got "compressed".
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/qtoolbararealayout.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/gui/widgets/qtoolbararealayout.cpp b/src/gui/widgets/qtoolbararealayout.cpp
index 0c11700..b4a0ef0 100644
--- a/src/gui/widgets/qtoolbararealayout.cpp
+++ b/src/gui/widgets/qtoolbararealayout.cpp
@@ -156,21 +156,15 @@ void QToolBarAreaLayoutLine::fitLayout()
if (item.skip())
continue;
- QToolBarLayout *tblayout = qobject_cast<QToolBarLayout*>(item.widgetItem->widget()->layout());
- if (tblayout)
+ if (QToolBarLayout *tblayout = qobject_cast<QToolBarLayout*>(item.widgetItem->widget()->layout()))
tblayout->checkUsePopupMenu();
- int itemMin = pick(o, item.minimumSize());
- int itemHint = pick(o, item.sizeHint());
- //we ensure the extraspace is not too low
- item.size = qMax(item.size, itemHint);
- if (item.preferredSize > 0) {
- //preferredSize would be the default size
- item.size = item.preferredSize;
- }
+ const int itemMin = pick(o, item.minimumSize());
+ //preferredSize is the default if it is set, otherwise, we take the sizehint
+ item.size = item.preferredSize > 0 ? item.preferredSize : pick(o, item.sizeHint());
//the extraspace is the space above the item minimum sizehint
- int extraSpace = qMin(item.size - itemMin, extra);
+ const int extraSpace = qMin(item.size - itemMin, extra);
item.size = itemMin + extraSpace; //that is the real size
extra -= extraSpace;