Results 1 to 6 of 6

Thread: Q_object

  1. #1
    Join Date
    Jan 2006
    Posts
    46
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Q_object

    What is the Q_OBJECT macro, please? I don't mean what's the code
    corresponding to it, but what does it do?

    Mariane

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    85
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Q_object

    It defines some class members needed for reflection and other special Qt features provided by classes derived from QObject.

  3. #3
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    99
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Q_object

    You have to put the Q_OBJECT macro in every class where you want to use signals and slots.
    You can read more about it in the documentation : signals and slots.

    Cheers

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Q_object

    Quote Originally Posted by Everall
    You have to put the Q_OBJECT macro in every class where you want to use signals and slots.
    This is not exactly true. You can omit the macro if you derive from a class which had it defined and you don't introduce any new signals or slots. If any of these two conditions is not met, you have to use that macro.

  5. #5
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    99
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Q_object

    @Wysota :Yes, you explained it in a better analytical way.

    What do you think of the following :

    You have to put the Q_OBJECT macro in every class where you want to use your own signals and slots.

    Cheers

  6. #6
    Join Date
    Jan 2006
    Posts
    46
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Q_object

    Thank you

    Mariane

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.