diff options
author | Sami Merila <sami.merila@nokia.com> | 2011-03-23 15:30:45 (GMT) |
---|---|---|
committer | Sami Merila <sami.merila@nokia.com> | 2011-03-23 15:30:45 (GMT) |
commit | 9a42d9815b73e5ceb25360af02936bcb0454a965 (patch) | |
tree | 04083135820b747b55db671487268cca70f093e3 /src/gui/styles/qs60style.cpp | |
parent | 1dbd4a629bb5e2392bf2c7ea096ad3d77a265e5f (diff) | |
download | Qt-9a42d9815b73e5ceb25360af02936bcb0454a965.zip Qt-9a42d9815b73e5ceb25360af02936bcb0454a965.tar.gz Qt-9a42d9815b73e5ceb25360af02936bcb0454a965.tar.bz2 |
Icon in QMessageBox::question is deformed on Symbian
MessageBox icons are deformed on Qt/S60, since style creates all icons with 1:1
width:height ratio. Based on S60 documentation messagebox icons
are of 4:3 ratio. This is the same ratio between all the S60 releases.
Task-number: QTBUG-14953
Reviewed-by: Laszlo Agocs
Diffstat (limited to 'src/gui/styles/qs60style.cpp')
-rw-r--r-- | src/gui/styles/qs60style.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index a9e10a3..1320f5e 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -3353,9 +3353,9 @@ bool QS60Style::event(QEvent *e) QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const { - const int iconDimension = QS60StylePrivate::pixelMetric(PM_ToolBarIconSize); - const QRect iconSize = (!option) ? QRect(0, 0, iconDimension, iconDimension) : option->rect; QS60StyleEnums::SkinParts part; + qreal iconHeightMultiplier = 1.0; + qreal iconWidthMultiplier = 1.0; QS60StylePrivate::SkinElementFlags adjustedFlags; if (option) adjustedFlags = (option->state & State_Enabled || option->state == 0) ? @@ -3364,15 +3364,20 @@ QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon, switch(standardIcon) { case SP_MessageBoxWarning: + // By default, S60 messagebox icons have 4:3 ratio. Value is from S60 LAF documentation. + iconHeightMultiplier = 1.33; part = QS60StyleEnums::SP_QgnNoteWarning; break; case SP_MessageBoxInformation: + iconHeightMultiplier = 1.33; part = QS60StyleEnums::SP_QgnNoteInfo; break; case SP_MessageBoxCritical: + iconHeightMultiplier = 1.33; part = QS60StyleEnums::SP_QgnNoteError; break; case SP_MessageBoxQuestion: + iconHeightMultiplier = 1.33; part = QS60StyleEnums::SP_QgnNoteQuery; break; case SP_ArrowRight: @@ -3427,11 +3432,13 @@ QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon, adjustedFlags |= QS60StylePrivate::SF_PointEast; part = QS60StyleEnums::SP_QgnIndiSubmenu; break; - default: return QCommonStyle::standardIconImplementation(standardIcon, option, widget); } const QS60StylePrivate::SkinElementFlags flags = adjustedFlags; + const int iconDimension = QS60StylePrivate::pixelMetric(PM_ToolBarIconSize); + const QRect iconSize = (!option) ? + QRect(0, 0, iconDimension * iconWidthMultiplier, iconDimension * iconHeightMultiplier) : option->rect; const QPixmap cachedPixMap(QS60StylePrivate::cachedPart(part, iconSize.size(), 0, flags)); return cachedPixMap.isNull() ? QCommonStyle::standardIconImplementation(standardIcon, option, widget) : QIcon(cachedPixMap); |