summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPrasanth Ullattil <prasanth.ullattil@nokia.com>2010-01-07 13:11:28 (GMT)
committerPrasanth Ullattil <prasanth.ullattil@nokia.com>2010-01-07 13:16:33 (GMT)
commit63e248aae7aecce2299bfd7941bd37fdfc136dcf (patch)
treeaffc56c79068fce2c6e80ec02b93cdde4cd2a577
parent5339d24dc09525a67295adf98e9042971f4a9b2e (diff)
downloadQt-63e248aae7aecce2299bfd7941bd37fdfc136dcf.zip
Qt-63e248aae7aecce2299bfd7941bd37fdfc136dcf.tar.gz
Qt-63e248aae7aecce2299bfd7941bd37fdfc136dcf.tar.bz2
Mac style doesn't honour QStyle::State_HasFocus for non-widgets.
This patch draws the focus frame for widgets other than QLineEdit (e.g. for line edits in Webkit). The frame is drawn outside the rectangle passed in the option-rect. Task-number: QTBUG-5530 Reviewed-by: MortenS
-rw-r--r--src/gui/styles/qmacstyle_mac.mm12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm
index 4075cf7..53740fc 100644
--- a/src/gui/styles/qmacstyle_mac.mm
+++ b/src/gui/styles/qmacstyle_mac.mm
@@ -3109,6 +3109,18 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
break;
case PE_PanelLineEdit:
QWindowsStyle::drawPrimitive(pe, opt, p, w);
+ // Draw the focus frame for widgets other than QLineEdit (e.g. for line edits in Webkit).
+ // Focus frame is drawn outside the rectangle passed in the option-rect.
+ if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
+ if ((opt->state & State_HasFocus) && !qobject_cast<const QLineEdit*>(w)) {
+ int vmargin = pixelMetric(QStyle::PM_FocusFrameVMargin);
+ int hmargin = pixelMetric(QStyle::PM_FocusFrameHMargin);
+ QStyleOptionFrame focusFrame = *panel;
+ focusFrame.rect = panel->rect.adjusted(-hmargin, -vmargin, hmargin, vmargin);
+ drawControl(CE_FocusFrame, &focusFrame, p, w);
+ }
+ }
+
break;
case PE_FrameTabWidget:
if (const QStyleOptionTabWidgetFrame *twf