From 14e51127cf2ba4fdb3469da90fd2f8f26084bb4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 23 Oct 2014 13:58:08 +0200 Subject: Add qobject_cast template specialisation for QWindow greatly improving the performance of qobject_cast Change-Id: If5a1afa6e41f4676f4838ea3ff80f1d89e396dfc Reviewed-by: Gunnar Sletta --- src/gui/kernel/qwindow.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/gui/kernel/qwindow.h') 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(QObject *o) +{ + if (!o || !o->isWindowType()) return 0; + return static_cast(o); +} +template <> inline const QWindow *qobject_cast(const QObject *o) +{ + if (!o || !o->isWindowType()) return 0; + return static_cast(o); +} +#endif // !Q_QDOC + QT_END_NAMESPACE #endif // QWINDOW_H -- cgit v1.2.3