diff options
author | Jens Bache-Wiig <jbache@trolltech.com> | 2010-06-11 10:53:07 (GMT) |
---|---|---|
committer | Jens Bache-Wiig <jbache@trolltech.com> | 2010-06-11 10:56:55 (GMT) |
commit | 8577353b2a5155600e672955e7c6a61e9e9519ca (patch) | |
tree | 8bda3a044fa2cdaf693ca22db19fb16d184e2c9a | |
parent | dc80d7886d1fea853a6a0bdd0960d619cb6fff07 (diff) | |
download | Qt-8577353b2a5155600e672955e7c6a61e9e9519ca.zip Qt-8577353b2a5155600e672955e7c6a61e9e9519ca.tar.gz Qt-8577353b2a5155600e672955e7c6a61e9e9519ca.tar.bz2 |
Fixed size hint for combo box on windows
When you use larger fonts or DPI on windows, the combobox can
calculate a size hint that results of text eliding on items.
This fix removes some duplicate code in Vista style and adds
a dpi dependant size hint for XP style.
Task-number: QTBUG-7552
Reviewed-by: richard
-rw-r--r-- | src/gui/styles/qwindowsvistastyle.cpp | 25 | ||||
-rw-r--r-- | src/gui/styles/qwindowsxpstyle.cpp | 4 |
2 files changed, 4 insertions, 25 deletions
diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp index 67a7b85..8511592 100644 --- a/src/gui/styles/qwindowsvistastyle.cpp +++ b/src/gui/styles/qwindowsvistastyle.cpp @@ -1926,30 +1926,7 @@ QSize QWindowsVistaStyle::sizeFromContents(ContentsType type, const QStyleOption return QWindowsStyle::sizeFromContents(type, option, size, widget); QSize sz(size); - - QSize newSize = QWindowsXPStyle::sizeFromContents(type, option, size, widget); switch (type) { - case CT_LineEdit: - case CT_ComboBox: - { - HTHEME theme = pOpenThemeData(0, L"Button"); - MARGINS borderSize; - if (theme) { - int result = pGetThemeMargins(theme, - NULL, - BP_PUSHBUTTON, - PBS_NORMAL, - TMT_CONTENTMARGINS, - NULL, - &borderSize); - if (result == S_OK) { - sz += QSize(borderSize.cxLeftWidth + borderSize.cxRightWidth - 2, - borderSize.cyBottomHeight + borderSize.cyTopHeight - 2); - } - sz += QSize(23, 0); //arrow button - } - } - return sz; case CT_MenuItem: sz = QWindowsXPStyle::sizeFromContents(type, option, size, widget); int minimumHeight; @@ -1990,7 +1967,7 @@ QSize QWindowsVistaStyle::sizeFromContents(ContentsType type, const QStyleOption default: break; } - return newSize; + return QWindowsXPStyle::sizeFromContents(type, option, size, widget); } /*! diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp index efb1224..8743807 100644 --- a/src/gui/styles/qwindowsxpstyle.cpp +++ b/src/gui/styles/qwindowsxpstyle.cpp @@ -3678,7 +3678,9 @@ QSize QWindowsXPStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt sz += QSize(borderSize.cxLeftWidth + borderSize.cxRightWidth - 2, borderSize.cyBottomHeight + borderSize.cyTopHeight - 2); } - sz += QSize(23, 0); //arrow button + const int textMargins = 2*(proxy()->pixelMetric(PM_FocusFrameHMargin) + 1); + sz += QSize(qMax(pixelMetric(QStyle::PM_ScrollBarExtent, option, widget) + + textMargins, 23), 0); //arrow button } } break; |