summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@nokia.com>2009-08-24 13:40:35 (GMT)
committerRichard Moe Gustavsen <richard.gustavsen@nokia.com>2009-08-25 09:50:43 (GMT)
commitf29e1bc7b7a593ef65defa3543b0feea455c7cdb (patch)
tree5ecc60a34015593b57d31a4efddd4c6c3868307f
parent913d75047dd5aa4a8e1d9b51a58c7be7e75f3d89 (diff)
downloadQt-f29e1bc7b7a593ef65defa3543b0feea455c7cdb.zip
Qt-f29e1bc7b7a593ef65defa3543b0feea455c7cdb.tar.gz
Qt-f29e1bc7b7a593ef65defa3543b0feea455c7cdb.tar.bz2
Cocoa: bugfix for autocads plugin project
Seems like the QMacNativeWidget was almost not testet at all. It all breaks down when embedding QLineEdits (with respect to focus). This is a first patch that fixes this issue.
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm9
-rw-r--r--src/gui/kernel/qwidget.cpp4
-rw-r--r--src/gui/kernel/qwidget_mac.mm8
3 files changed, 21 insertions, 0 deletions
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 5a0209d..5ab7ed2 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -976,6 +976,15 @@ extern "C" {
return qwidget->focusPolicy() != Qt::NoFocus;
}
+- (BOOL)resignFirstResponder
+{
+ // Seems like the following test only triggers if this
+ // view is inside a QMacNativeWidget:
+ if (qwidget == QApplication::focusWidget())
+ QApplicationPrivate::setFocusWidget(0, Qt::OtherFocusReason);
+ return YES;
+}
+
- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal
{
Q_UNUSED(isLocal);
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 5e720df..6ffac2c 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -6231,6 +6231,10 @@ bool QWidget::isActiveWindow() const
if(qt_mac_is_macdrawer(tlw) &&
tlw->parentWidget() && tlw->parentWidget()->isActiveWindow())
return true;
+
+ extern bool qt_mac_insideKeyWindow(const QWidget *); //qwidget_mac.cpp
+ if (QApplication::testAttribute(Qt::AA_MacPluginApplication) && qt_mac_insideKeyWindow(tlw))
+ return true;
#endif
if(style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, this)) {
if(tlw->windowType() == Qt::Tool &&
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index ea5a53e..53d1b6e 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -301,6 +301,14 @@ bool qt_mac_is_macdrawer(const QWidget *w)
return (w && w->parentWidget() && w->windowType() == Qt::Drawer);
}
+bool qt_mac_insideKeyWindow(const QWidget *w)
+{
+#ifdef QT_MAC_USE_COCOA
+ return [[reinterpret_cast<NSView *>(w->winId()) window] isKeyWindow];
+#endif
+ return false;
+}
+
bool qt_mac_set_drawer_preferred_edge(QWidget *w, Qt::DockWidgetArea where) //users of Qt for Mac OS X can use this..
{
if(!qt_mac_is_macdrawer(w))