diff options
author | Sami Merilä <sami.merila@nokia.com> | 2009-05-12 16:07:50 (GMT) |
---|---|---|
committer | Sami Merilä <sami.merila@nokia.com> | 2009-05-12 16:07:50 (GMT) |
commit | c88983acaf7034ee1ecc1f02ab3426d1e924c0dd (patch) | |
tree | 5e736d794abd825d6e53e9920b4d7fa038bb4378 | |
parent | bd92bc77c98c5d6ceea5996702fb4db9bfac3c0f (diff) | |
download | Qt-c88983acaf7034ee1ecc1f02ab3426d1e924c0dd.zip Qt-c88983acaf7034ee1ecc1f02ab3426d1e924c0dd.tar.gz Qt-c88983acaf7034ee1ecc1f02ab3426d1e924c0dd.tar.bz2 |
S60Style: Slightly better drawing code for QTreeView node indicators.
-rw-r--r-- | src/gui/styles/qs60style.cpp | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index ee9bca8..24c1608 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -2120,17 +2120,6 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti #endif QCommonStyle::drawPrimitive(element, option, painter, widget); } else { - if (option->state & State_Children) { - QS60StyleEnums::SkinParts skinPart = - (option->state & State_Open) ? QS60StyleEnums::SP_QgnIndiHlColSuper : QS60StyleEnums::SP_QgnIndiHlExpSuper; - int minDimension = qMin(option->rect.width(), option->rect.height()); - const int resizeValue = minDimension >> 1; - minDimension += resizeValue; // Adjust the icon bigger because of empty space in svg icon. - QRect iconRect(option->rect.topLeft(), QSize(minDimension, minDimension)); - iconRect.translate(3, 2 - resizeValue); - QS60StylePrivate::drawSkinPart(skinPart, painter, iconRect, flags); - } - const bool rightLine = option->state & State_Item; const bool downLine = option->state & State_Sibling; const bool upLine = option->state & (State_Open | State_Children | State_Item | State_Sibling); @@ -2152,10 +2141,26 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti QS60StylePrivate::drawSkinPart(skinPart, painter, option->rect, (flags | QS60StylePrivate::SF_ColorSkinned)); } + + if (option->state & State_Children) { + QS60StyleEnums::SkinParts skinPart = + (option->state & State_Open) ? QS60StyleEnums::SP_QgnIndiHlColSuper : QS60StyleEnums::SP_QgnIndiHlExpSuper; + int minDimension = qMin(option->rect.width(), option->rect.height()); + const int resizeValue = minDimension >> 1; + minDimension += resizeValue; // Adjust the icon bigger because of empty space in svg icon. + QRect iconRect(option->rect.topLeft(), QSize(minDimension, minDimension)); + int verticalMagic(0); + // magic values for positioning svg icon. + if (option->rect.width() <= option->rect.height()) + verticalMagic = 3; + iconRect.translate(3, verticalMagic - resizeValue); + iconRect.adjust(-3,5,0,0); + QS60StylePrivate::drawSkinPart(skinPart, painter, iconRect, flags); + } } - } - break; - + } + break; + // todo: items are below with #ifdefs "just in case". in final version, remove all non-required cases case PE_FrameLineEdit: case PE_IndicatorButtonDropDown: |