[Qt-interest] When is QT_FORWARD_DECLARE_CLASS to be used?
Tony Rietwyk
tony.rietwyk at rightsoft.com.au
Sat Apr 18 09:19:01 CEST 2009
Hi Scott,
Thanks for responding. I haven't used it either, so presumably its not
required for our QObject derived classes.
I used the books demo for a new project and noticed that the demos use
undocumented features!
Tony.
> 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.
More information about the Qt-interest-old
mailing list