qdoc: Eliminate qobject_cast() collision

Two template functions for qboject_cast() are defined
in qwidget.h that confuse qdoc because qdoc doesn't
handle template functions correctly. In this case, the
documentation for all qobject_cast() functions appears
in qobject.cpp where it is declared to be related to
QObject. This fix surrounds the template functions in
qwidget.h with #ifndef Q_QDOC ... #endif, since qdoc doesn't
need to see them.

This fix unmasks a linking bug QTBUG-34564, which will
be fixed separately.

Task-number: QTBUG-34505
Change-Id: I97fd32cc563bfa4a232819c097f41be56adf0114
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
Martin Smith 2013-11-04 14:17:51 +01:00 committed by The Qt Project
parent d1870d9036
commit 2bb6fbbd0f

View File

@ -733,6 +733,7 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QWidget::RenderFlags)
#ifndef Q_QDOC
template <> inline QWidget *qobject_cast<QWidget*>(QObject *o)
{
if (!o || !o->isWidgetType()) return 0;
@ -743,6 +744,7 @@ template <> inline const QWidget *qobject_cast<const QWidget*>(const QObject *o)
if (!o || !o->isWidgetType()) return 0;
return static_cast<const QWidget*>(o);
}
#endif // !Q_QDOC
inline QWidget *QWidget::childAt(int ax, int ay) const
{ return childAt(QPoint(ax, ay)); }