diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-22 20:41:32 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-22 20:41:32 (GMT) |
commit | 03b97ec038a12c8206f57f94fcd08c43614876e9 (patch) | |
tree | 632c78d2ffd2501eca3d073feffdc856b2bab94a /src | |
parent | 8ca52f2a9de95ff475537517c7ee965f70ca8aa6 (diff) | |
parent | 9b363e44f372fee183290e010ceecf9e75282ce2 (diff) | |
download | Qt-03b97ec038a12c8206f57f94fcd08c43614876e9.zip Qt-03b97ec038a12c8206f57f94fcd08c43614876e9.tar.gz Qt-03b97ec038a12c8206f57f94fcd08c43614876e9.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public:
Increase KeypadNavigation focus visibility
Fixing keypad navigation focus frame
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/styles/qs60style.cpp | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 750e19f..6448417 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -1964,40 +1964,37 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, case CE_MenuScroller: break; case CE_FocusFrame: { - // The pen width should nearly fill the layoutspacings around the widget - const int penWidth = - qMin(pixelMetric(QS60Style::PM_LayoutVerticalSpacing), pixelMetric(QS60Style::PM_LayoutHorizontalSpacing)) - - 2; // But keep 1 pixel distance to the focus widget and 1 pixel to the adjacent widgets - #ifdef QT_KEYPAD_NAVIGATION bool editFocus = false; if (const QFocusFrame *focusFrame = qobject_cast<const QFocusFrame*>(widget)) { if (focusFrame->widget() && focusFrame->widget()->hasEditFocus()) editFocus = true; } - const qreal opacity = editFocus ? 0.65 : 0.45; // Trial and error factors. Feel free to improve. + const qreal opacity = editFocus ? 1 : 0.75; // Trial and error factors. Feel free to improve. #else - const qreal opacity = 0.5; + const qreal opacity = 0.85; #endif - // Because of Qts coordinate system, we need to tweak the rect by .5 pixels, otherwise it gets blurred. - const qreal rectAdjustment = (penWidth % 2) ? -.5 : 0; - - // Make sure that the pen stroke is inside the rect - const QRectF adjustedRect = - QRectF(option->rect).adjusted( - rectAdjustment + penWidth, - rectAdjustment + penWidth, - -rectAdjustment - penWidth, - -rectAdjustment - penWidth - ); - - const qreal roundRectRadius = penWidth * goldenRatio; + // We need to reduce the focus frame size if LayoutSpacing is smaller than FocusFrameMargin + // Otherwise, we would overlay adjacent widgets. + const int frameHeightReduction = + qMin(0, pixelMetric(QStyle::PM_LayoutVerticalSpacing) + - pixelMetric(QStyle::PM_FocusFrameVMargin)); + const int frameWidthReduction = + qMin(0, pixelMetric(QStyle::PM_LayoutHorizontalSpacing) + - pixelMetric(QStyle::PM_FocusFrameHMargin)); + const int rounding = + qMin(pixelMetric(QStyle::PM_FocusFrameVMargin), + pixelMetric(QStyle::PM_LayoutVerticalSpacing)); + const QRect frameRect = + option->rect.adjusted(-frameWidthReduction, -frameHeightReduction, + frameWidthReduction, frameHeightReduction); + QPainterPath framePath; + framePath.addRoundedRect(frameRect, rounding, rounding); painter->save(); painter->setRenderHint(QPainter::Antialiasing); painter->setOpacity(opacity); - painter->setPen(QPen(option->palette.color(QPalette::Text), penWidth)); - painter->drawRoundedRect(adjustedRect, roundRectRadius, roundRectRadius); + painter->fillPath(framePath, option->palette.color(QPalette::Text)); painter->restore(); } break; |