Results 1 to 4 of 4

Thread: qRegisterMetaType and own class

  1. #1
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default qRegisterMetaType and own class

    Hi,

    I have my own class and I need to send objects of this class by SIGNALs SLOTs mechanism.
    Now I'm using it without registering my class with "qRegisterMetaType" and passing the parameters as value(not references), but I don't have developed the copy constructor. It seems to work, could this produce any problems?

    Thanks,
    Òscar Llarch i Galán

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    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: qRegisterMetaType and own class

    It shouldn't unless you try to send signals across threads. Then Qt will (or at least should) not let you do this.

  3. #3
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: qRegisterMetaType and own class

    Hi,

    And doing this with timers? I use a timer that makes "polling". When "timeout" is triggered it call the slot that make some job and this slot emits a signal that contain an object of my class.

    Thanks,
    Òscar Llarch i Galán

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    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: qRegisterMetaType and own class

    As long as signal arguments don't need to be serialized, there is nothing to worry about. Of course registering the meta type wouldn't hurt

  5. The following user says thank you to wysota for this useful post:

    ^NyAw^ (9th January 2008)

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.