summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@digia.com>2014-10-23 13:58:08 +0200
committerLaszlo Agocs <laszlo.agocs@digia.com>2014-10-29 09:39:23 +0100
commit14e51127cf2ba4fdb3469da90fd2f8f26084bb4b (patch)
tree26a3099d268ab08810910c95d5191f19022f7aab /src
parent87eb3ea1904756362ce5474838b25b5b00193dc5 (diff)
Add qobject_cast template specialisation for QWindow
greatly improving the performance of qobject_cast<QWindow *> Change-Id: If5a1afa6e41f4676f4838ea3ff80f1d89e396dfc Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qwindow.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h
index 7cd25b010f..473d275b56 100644
--- a/src/gui/kernel/qwindow.h
+++ b/src/gui/kernel/qwindow.h
@@ -356,6 +356,19 @@ private:
friend Q_GUI_EXPORT QWindowPrivate *qt_window_private(QWindow *window);
};
+#ifndef Q_QDOC
+template <> inline QWindow *qobject_cast<QWindow*>(QObject *o)
+{
+ if (!o || !o->isWindowType()) return 0;
+ return static_cast<QWindow*>(o);
+}
+template <> inline const QWindow *qobject_cast<const QWindow*>(const QObject *o)
+{
+ if (!o || !o->isWindowType()) return 0;
+ return static_cast<const QWindow*>(o);
+}
+#endif // !Q_QDOC
+
QT_END_NAMESPACE
#endif // QWINDOW_H