Avoid qobject_cast
authorAaron Kennedy <aaron.kennedy@nokia.com>
Thu, 17 May 2012 10:06:17 +0000 (11:06 +0100)
committerQt by Nokia <qt-info@nokia.com>
Fri, 18 May 2012 08:37:33 +0000 (10:37 +0200)
This is slightly faster, and also avoids accessing the object's meta
object that would cause any lazily created meta objects from being built.

Change-Id: I0a78e09511c120bdbe707a1efc91ba480ab7680c
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
src/gui/kernel/qguiapplication.cpp

index 03c28a7..570f3f7 100644 (file)
@@ -1007,7 +1007,8 @@ bool QGuiApplication::notify(QObject *object, QEvent *event)
     }
 #endif
 
-    QGuiApplicationPrivate::sendQWindowEventToQPlatformWindow(qobject_cast<QWindow *>(object), event);
+    if (object->isWindowType())
+        QGuiApplicationPrivate::sendQWindowEventToQPlatformWindow(static_cast<QWindow *>(object), event);
     return QCoreApplication::notify(object, event);
 }