diff options
author | Sami Merila <sami.merila@nokia.com> | 2010-01-26 10:57:21 (GMT) |
---|---|---|
committer | Sami Merila <sami.merila@nokia.com> | 2010-01-26 10:57:21 (GMT) |
commit | e571e0f012e3e27ffff56493755999da1960318c (patch) | |
tree | f70822d091568deea329b49f8701bd7a2ec127db /src/gui/styles | |
parent | 9bb9991b7c6182249cbf922e4718e1c64e3c6433 (diff) | |
download | Qt-e571e0f012e3e27ffff56493755999da1960318c.zip Qt-e571e0f012e3e27ffff56493755999da1960318c.tar.gz Qt-e571e0f012e3e27ffff56493755999da1960318c.tar.bz2 |
QFileDialog layout issue on Symbian
If long path (or any other long string) is added to a combobox, it
grows outside of screen area. QS60Style needs to check that widget
will not grow wider than screen area.
Task-number: QTBUG-6371
Reviewed-by: Alessandro Portale
Diffstat (limited to 'src/gui/styles')
-rw-r--r-- | src/gui/styles/qs60style.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 5a4e6df..0083803 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -2398,6 +2398,24 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, //QCommonStyle does not adjust height with horizontal margin, it only adjusts width sz.setHeight(sz.height() + 2 * pixelMetric(PM_FocusFrameVMargin)); break; +#ifndef QT_NO_COMBOBOX + case CT_ComboBox: + if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) { + const int frameWidth = cmb->frame ? pixelMetric(PM_ComboBoxFrameWidth, opt, widget) * 2 : 0; + const int textMargins = 2*(pixelMetric(PM_FocusFrameHMargin) + 1); + const int smallestExtraWidth = 23; + // QItemDelegate::sizeHint expands the textMargins two times, thus the 2*textMargins... + const int extra = + qMax(smallestExtraWidth, 2*textMargins + pixelMetric(PM_ScrollBarExtent, opt, widget)); + sz = QSize(sz.width() + frameWidth + extra, sz.height() + frameWidth); + int maxScreenWidth = QApplication::desktop()->availableGeometry().size().width(); + if (sz.width() > maxScreenWidth) { + maxScreenWidth = maxScreenWidth - (extra + frameWidth); + sz.setWidth(maxScreenWidth); + } + } + break; +#endif default: sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget); break; |