diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2010-02-04 12:37:18 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2010-02-04 12:37:18 (GMT) |
commit | 8f83747d12efc612b730a7dd911f916127387c0c (patch) | |
tree | d61b4c877cd14247ae0de260034cb99494434c5d /src/gui/styles | |
parent | 53038b678ccba374da5ce9ad216044f075a3ffd8 (diff) | |
parent | 8e98033a67263f6a2d9155f228dc28e2faee4f5e (diff) | |
download | Qt-8f83747d12efc612b730a7dd911f916127387c0c.zip Qt-8f83747d12efc612b730a7dd911f916127387c0c.tar.gz Qt-8f83747d12efc612b730a7dd911f916127387c0c.tar.bz2 |
Merge remote branch 'origin/4.6' into qt-master-from-4.6
Conflicts:
examples/assistant/simpletextviewer/findfiledialog.cpp
qmake/generators/symbian/symmake.cpp
tools/assistant/lib/qhelpgenerator.cpp
tools/assistant/lib/qhelpsearchquerywidget.cpp
translations/translations.pri
Diffstat (limited to 'src/gui/styles')
-rw-r--r-- | src/gui/styles/qcommonstyle.cpp | 2 | ||||
-rw-r--r-- | src/gui/styles/qmacstyle_mac.mm | 21 | ||||
-rw-r--r-- | src/gui/styles/qs60style.cpp | 41 |
3 files changed, 33 insertions, 31 deletions
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index 2a1d336..3132dd1 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -1608,7 +1608,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, if (toolbutton->toolButtonStyle == Qt::ToolButtonTextUnderIcon) { pr.setHeight(pmSize.height() + 6); - tr.adjust(0, pr.height() - 1, 0, -3); + tr.adjust(0, pr.height() - 1, 0, -2); pr.translate(shiftX, shiftY); if (!hasArrow) { proxy()->drawItemPixmap(p, pr, Qt::AlignCenter, pm); diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index e8298cf..a077cf0 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -2411,7 +2411,12 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW ret = 0; break; case PM_ToolBarFrameWidth: - ret = 0; + ret = 1; + if (widget) { + if (QMainWindow * mainWindow = qobject_cast<QMainWindow *>(widget->parent())) + if (mainWindow->unifiedTitleAndToolBarOnMac()) + ret = 0; + } break; default: ret = QWindowsStyle::pixelMetric(metric, opt, widget); @@ -5726,12 +5731,16 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, break; case CT_ToolButton: if (widget && qobject_cast<const QToolBar *>(widget->parentWidget())) { - sz.rwidth() += 4; - if (sz.height() <= 32) { - // Workaround strange HIToolBar bug when getting constraints. - sz.rheight() += 1; + if (QMainWindow * mainWindow = qobject_cast<QMainWindow *>(widget->parent())) { + if (mainWindow->unifiedTitleAndToolBarOnMac()) { + sz.rwidth() += 4; + if (sz.height() <= 32) { + // Workaround strange HIToolBar bug when getting constraints. + sz.rheight() += 1; + } + return sz; + } } - return sz; } sz.rwidth() += 10; sz.rheight() += 10; diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 9b99161..9025e5b 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -92,10 +92,10 @@ static const qreal goldenRatio = 1.618; const layoutHeader QS60StylePrivate::m_layoutHeaders[] = { // *** generated layout data *** -{240,320,1,15,"QVGA Landscape"}, -{320,240,1,15,"QVGA Portrait"}, -{360,640,1,15,"NHD Landscape"}, -{640,360,1,15,"NHD Portrait"}, +{240,320,1,16,"QVGA Landscape"}, +{320,240,1,16,"QVGA Portrait"}, +{360,640,1,16,"NHD Landscape"}, +{640,360,1,16,"NHD Portrait"}, {352,800,1,12,"E90 Landscape"} // *** End of generated data *** }; @@ -104,10 +104,10 @@ const int QS60StylePrivate::m_numberOfLayouts = const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = { // *** generated pixel metrics *** -{5,0,-909,0,0,2,0,0,-1,7,12,19,13,13,6,200,-909,-909,-909,20,13,2,0,0,21,7,18,-909,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,3,3,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1}, -{5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,-909,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,4,4,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1}, -{7,0,-909,0,0,2,0,0,-1,25,69,28,19,19,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,-909,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,5,5,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1}, -{7,0,-909,0,0,2,0,0,-1,25,68,28,19,19,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,-909,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,5,5,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1}, +{5,0,-909,0,0,2,0,0,-1,7,12,19,13,13,6,200,-909,-909,-909,20,13,2,0,0,21,7,18,-909,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,4,4,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1}, +{5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,-909,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,3,3,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1}, +{7,0,-909,0,0,2,0,0,-1,25,69,28,19,19,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,-909,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,13,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1}, +{7,0,-909,0,0,2,0,0,-1,25,68,28,19,19,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,-909,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,12,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1}, {7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,-909,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1} // *** End of generated data *** }; @@ -2399,22 +2399,15 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, 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; + case CT_ComboBox: { + // Fixing Ui design issues with too wide QComboBoxes and greedy SizeHints + // Make sure, that the combobox says within the screen. + const QSize desktopContentSize = QApplication::desktop()->availableGeometry().size() + -QSize(pixelMetric(PM_LayoutLeftMargin) + pixelMetric(PM_LayoutRightMargin), 0); + sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget). + boundedTo(desktopContentSize); + } + break; #endif default: sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget); |