summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2014-09-16 16:33:57 +0200
committerTony Sarajärvi <tony.sarajarvi@digia.com>2014-09-16 22:42:47 +0200
commitbb3d2ca9f18071537888622310ca0cb7f587e61d (patch)
treea357f4792f89ebd640c99ac11147370802d4f8e5 /src/widgets
parent055622ed48888d5a38ee8f2314c252c96dc34e84 (diff)
QToolButton: properly reset the size hint when a menu is set on it
QToolButton::sizeHint() takes into account the presence of a menu. However, setMenu() doesn't retrigger a size hint recalculation. Hence, (un)setting a menu on an already sized tool button won't properly reset the size hint. Since the calculated size hint is cached, delete the cached value and call updateGeometry to cause a recalculation. Task-number: QTBUG-38949 Change-Id: I6e79e5e70e31afdfd129282b3668875eca86f51d Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/widgets/qtoolbutton.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp
index 497bc52109..cb441d6c6e 100644
--- a/src/widgets/widgets/qtoolbutton.cpp
+++ b/src/widgets/widgets/qtoolbutton.cpp
@@ -652,6 +652,10 @@ void QToolButton::setMenu(QMenu* menu)
} else {
d->menuAction = 0;
}
+
+ // changing the menu set may change the size hint, so reset it
+ d->sizeHint = QSize();
+ updateGeometry();
update();
}