summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorjasplin <qt-info@nokia.com>2009-06-02 10:57:42 +0200
committerjasplin <qt-info@nokia.com>2009-06-02 11:50:31 +0200
commit7314c07a3e443b1d5349b419a03db8d41ca43f7e (patch)
tree4e6c6c2fda0ecb8f1ac8f3fbbf40b59d8e79eaff /src/gui
parent8f16a4f1638fd661e74c6aa60822cd9ef17e5003 (diff)
BT: Fixed crash on Mac caused by erroneous handling of native focus events.
On Mac, a widget with a NoFocus policy could still get focus (if only temporarily) as the result of a native focus event. In particular, a line edit with a completer should not lose focus (if only for a brief moment) as a result of the completer popup being shown. This will for example cause an item delegate to think that the user has navigated away from the cell and delete the line edit as a result. This will in turn cause the completer to access a null pointer. Reviewed-by: Richard Moe Gustavsen Task-number: 254456 and 254460
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qwidget_mac.mm5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index f8634281ff..c82b87d09a 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -1296,8 +1296,11 @@ OSStatus QWidgetPrivate::qt_widget_event(EventHandlerCallRef er, EventRef event,
if(part == kControlFocusNoPart){
if (widget->hasFocus())
QApplicationPrivate::setFocusWidget(0, Qt::OtherFocusReason);
- } else
+ } else if (widget->focusPolicy() != Qt::NoFocus) {
widget->setFocus();
+ } else {
+ handled_event = false;
+ }
}
if(!HIObjectIsOfClass((HIObjectRef)hiview, kObjectQWidget))
CallNextEventHandler(er, event);