Coder's Guild Mailing List

Q_OBJECT

Posted by Steve Hawkinson on 1999-08-23

Qt uses a preprocessor called ?mach? I think.  It will go through this
code and change it into legal C++.  I think the 'Q_OBJECT' is a #define
and this would be legal C++, but the 'public slots:' gets changed into
legal C++ by the ?mach? preprocessor, I believe.

	Steve
 
> Date: Sat, 26 Jun 1999 16:50:46 -0500
> From: "ADnoctum" <adnoctum@xxxxxxx.xxx>
> Subject: Q_OBJECT
> 
> I was reading the sources of the KDE/Qt library and i found some weird
> things:
> 
> class KButton : public QButton
> {
>     Q_OBJECT    // This one...
> 
> public:
>     ~KButton();
> 
> protected:
>     virtual void leaveEvent( QEvent *_ev );
>     virtual void enterEvent( QEvent *_ev );
> 
> public slots:    // ... and this to.
>     virtual void drawButton( QPainter *_painter );
>     virtual void drawButtonLabel( QPainter *_painter );
>     void paint( QPainter *_painter );
> };
> 
> All the classes has the "Q_OBJECT" and a "public slots:" words that i don't
> have seen in another place żIs this legal in C++?.