[Qt-interest] When is QT_FORWARD_DECLARE_CLASS to be used?
Scott Aron Bloom
Scott.Bloom at sabgroup.com
Sat Apr 18 07:45:36 CEST 2009
In the code... Its defined as the following
#ifndef QT_NAMESPACE
# define QT_FORWARD_DECLARE_CLASS(name) class name;
#else
# define QT_FORWARD_DECLARE_CLASS(name) \
QT_BEGIN_NAMESPACE class name; QT_END_NAMESPACE \
using QT_PREPEND_NAMESPACE(name);
#endif
So they qt developers created a shortcut for forward declaring a class
that would take care of the namespace optionally being there...
Honestly.. Ive never used the macro... but I don't think it would hurt,
especially if you plan on using the namespace...
BTW. its in qglobal.h
Scott
> -----Original Message-----
> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-
> bounces at trolltech.com] On Behalf Of Tony Rietwyk
> Sent: Friday, April 17, 2009 10:26 PM
> To: qt-interest at trolltech.com
> Subject: [Qt-interest] When is QT_FORWARD_DECLARE_CLASS to be used?
>
> Hi Everybody,
>
> In 4.5.0, demos\books\bookdelegate.h has:
>
> #ifndef BOOKDELEGATE_H
> #define BOOKDELEGATE_H
>
> #include <QModelIndex>
> #include <QPixmap>
> #include <QSize>
> #include <QSqlRelationalDelegate>
>
> QT_FORWARD_DECLARE_CLASS(QPainter)
>
> class BookDelegate : public QSqlRelationalDelegate
> {
> public:
>
> ... etc.
>
>
> Is QT_FORWARD_DECLARE_CLASS also required in our code?
>
> It's not in the QtAssistant index, and searching only provides links
to demos.
>
> Can someone provide the missing documentation.
>
> Thanks,
>
> Tony.
>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list