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>
This commit is contained in:
parent
87eb3ea190
commit
14e51127cf
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user