summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-11-20 12:59:18 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-11-20 13:00:14 (GMT)
commita2c247ed521d88f99a21b4207cdff8ea03e949be (patch)
tree8bc7ea1c25e44317d882dca722cdcdc7745734b6
parent75d68b2b245da91ec9f985893f9b233d9d6a0793 (diff)
downloadQt-a2c247ed521d88f99a21b4207cdff8ea03e949be.zip
Qt-a2c247ed521d88f99a21b4207cdff8ea03e949be.tar.gz
Qt-a2c247ed521d88f99a21b4207cdff8ea03e949be.tar.bz2
Do not extend the last toolbar in a line when moving it
-rw-r--r--src/gui/widgets/qtoolbararealayout.cpp11
-rw-r--r--src/gui/widgets/qtoolbararealayout_p.h1
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<QToolBarAreaLayoutItem> toolBarItems;
};