summaryrefslogtreecommitdiffstats
path: root/src/gui/styles/qs60style.cpp
diff options
context:
space:
mode:
authorSami Merila <sami.merila@nokia.com>2011-03-29 07:03:35 (GMT)
committerSami Merila <sami.merila@nokia.com>2011-03-29 07:03:35 (GMT)
commit4f8d4492b8cafcdef71b5b40482c1eddb23062ab (patch)
tree3fdba5e05e238f0af5e16ec42fdfa9fdfdf86732 /src/gui/styles/qs60style.cpp
parent5a6acc0ba1ed3b056f4c7a9c37481f4cb347a352 (diff)
downloadQt-4f8d4492b8cafcdef71b5b40482c1eddb23062ab.zip
Qt-4f8d4492b8cafcdef71b5b40482c1eddb23062ab.tar.gz
Qt-4f8d4492b8cafcdef71b5b40482c1eddb23062ab.tar.bz2
Fix for failing autotest QToolBar/Symbian
QS60Style was calculating the minimum size of a toolbutton inside a toolbar based on number of visible buttons. Of course, when the non-visible buttons become visible and we are limiting the toolbar width to screen width it fails (since the orginally visible button is already claiming to take whole width of toolbar and now-visible button is taking half the button width). As a fix, calculate minimum size based on number buttons only, irregardless of their visibility. Task-number: QTBUG-17777 Reviewed-by: Miikka Heikkinen
Diffstat (limited to 'src/gui/styles/qs60style.cpp')
-rw-r--r--src/gui/styles/qs60style.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index aa68c23..da1528e 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -2556,17 +2556,16 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt,
tb->sizePolicy().horizontalPolicy() == QSizePolicy::Maximum) && tb->orientation() == Qt::Horizontal;
if (parentCanGrowHorizontally) {
- int visibleButtons = 0;
+ int buttons = 0;
//Make the auto-stretch to happen only for horizontal orientation
if (tb && tb->orientation() == Qt::Horizontal) {
QList<QAction*> actionList = tb->actions();
for (int i = 0; i < actionList.count(); i++) {
- if (actionList.at(i)->isVisible())
- visibleButtons++;
+ buttons++;
}
}
- if (widget->parentWidget() && visibleButtons > 0) {
+ if (widget->parentWidget() && buttons > 0) {
QWidget *w = const_cast<QWidget *>(widget);
int toolBarMaxWidth = 0;
int totalMargin = 0;
@@ -2589,7 +2588,7 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt,
toolBarMaxWidth -= totalMargin;
//ensure that buttons are side-by-side and not on top of each other
- const int toolButtonWidth = (toolBarMaxWidth / visibleButtons)
+ const int toolButtonWidth = (toolBarMaxWidth / buttons)
- pixelMetric(QStyle::PM_ToolBarItemSpacing)
- pixelMetric(QStyle::PM_ToolBarItemMargin)
//toolbar frame needs to be reduced again, since QToolBarLayout adds it for each toolbar action