summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjasplin <qt-info@nokia.com>2009-06-02 10:57:42 +0200
committerJason McDonald <jason.mcdonald@nokia.com>2009-06-03 12:44:43 +1000
commit604646c9a688ae7213f42f1d5ca75f15aa12b332 (patch)
tree9abbd5c5301a8d3fb49489a8f01c53e21a3ab503
parent7903d967a045d8b08019cfa2f99c5c3e985a95d6 (diff)
downloadqt4-tools-604646c9a688ae7213f42f1d5ca75f15aa12b332.tar.gz
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 (cherry picked from commit 7314c07a3e443b1d5349b419a03db8d41ca43f7e)
-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 5f7ab80503..01f339baae 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);