diff options
author | Sami Merila <sami.merila@nokia.com> | 2011-03-14 12:06:04 +0200 |
---|---|---|
committer | Timo Turunen <timo.p.turunen@nokia.com> | 2011-03-16 09:43:30 +0200 |
commit | cc016cc9cfba9b35a852399603c6d3f99e31af58 (patch) | |
tree | af4c4005ad80e1a07bf8affe3fc0872c0b32d494 | |
parent | 186096455ed3dd5bc27b272ff8959a5a38ec5100 (diff) | |
download | qt4-tools-cc016cc9cfba9b35a852399603c6d3f99e31af58.tar.gz |
QS60Style: QTreeView::indexRowSizeHint returns incorrect value
Fix for http://bugreports.qt.nokia.com/browse/QTBUG-17786.
QS60Style tries to work around the hardcoded margin that the
QCommonStyle adds to menu items (line 4782 in my QCommonStyle.cpp).
Unfortunately regular itemview items are handled in the same code
branch in QS60Style, so the class incorrectly reduces the itemview
height 8 pixels. The reduction should only happen with menu items.
Task-number: QTBUG-17786
Reviewed-by: Laszlo Agocs
(cherry picked from commit 8b7c98123eadf9263c6bde4b1263bd64fc388c8d)
-rw-r--r-- | src/gui/styles/qs60style.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index c94932691c..d0ca4072c6 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -2643,10 +2643,13 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget); //native items have small empty areas at the beginning and end of menu item sz.setWidth(sz.width() + 2 * pixelMetric(PM_MenuHMargin) + 2 * QS60StylePrivate::pixelMetric(PM_FrameCornerWidth)); - if (QS60StylePrivate::isTouchSupported()) + if (QS60StylePrivate::isTouchSupported()) { //Make itemview easier to use in touch devices + sz.setHeight(sz.height() + 2 * pixelMetric(PM_FocusFrameVMargin)); //QCommonStyle does not adjust height with horizontal margin, it only adjusts width - sz.setHeight(sz.height() + 2 * pixelMetric(PM_FocusFrameVMargin) - 8); //QCommonstyle adds 8 to height that this style handles through PM values + if (ct == CT_MenuItem) + sz.setHeight(sz.height() - 8); //QCommonstyle adds 8 to height that this style handles through PM values + } break; #ifndef QT_NO_COMBOBOX case CT_ComboBox: { |