PDA

View Full Version : Q_DECLARE_PUBLIC and other things I dont understand ?



tonnot
6th October 2010, 10:58
I have found at QT files then next 'way' of declare a class :
Anybody can help me to understand it ? Any doc ?

At file.h :
class QLCDNumberPrivate;

At file cpp :
class QLCDNumberPrivate : public QFramePrivate
{
Q_DECLARE_PUBLIC(QLCDNumber)

////////////////////////////////////////// at global.h
#define Q_DECLARE_PRIVATE(Class) \
inline Class##Private* d_func() { return reinterpret_cast<Class##Private *>(qGetPtrHelper(d_ptr)); } \
inline const Class##Private* d_func() const { return reinterpret_cast<const Class##Private *>(qGetPtrHelper(d_ptr)); } \
friend class Class##Private;

#define Q_DECLARE_PRIVATE_D(Dptr, Class) \
inline Class##Private* d_func() { return reinterpret_cast<Class##Private *>(Dptr); } \
inline const Class##Private* d_func() const { return reinterpret_cast<const Class##Private *>(Dptr); } \
friend class Class##Private;

#define Q_DECLARE_PUBLIC(Class) \
inline Class* q_func() { return static_cast<Class *>(q_ptr); } \
inline const Class* q_func() const { return static_cast<const Class *>(q_ptr); } \
friend class Class;

wysota
6th October 2010, 11:03
These are all things private to Qt implementation. You don't need to worry about it. And there are no docs about it outside Qt development team.