Results 1 to 7 of 7

Thread: signal slot confusion

  1. #1
    Join Date
    Sep 2008
    Posts
    54
    Thanks
    3
    Thanked 10 Times in 5 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    2

    Default signal slot confusion

    When reading the manual about auto-connect signal/slots I was getting confused a little.

    I create a form with the designer and create some signals and slots.

    Uic gives me a ui_XXX.h

    I use that in my NewWidget.

    Do or do I not have to MOC my NewWidget.h.

    And is there anyone with an example of 3-th party slots usage?

    Regards,

    Marcel

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: signal slot confusion

    Aren't you using qmake? It takes care of uic and moc, automatically.
    J-P Nurmi

  3. #3
    Join Date
    Sep 2008
    Posts
    54
    Thanks
    3
    Thanked 10 Times in 5 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    2

    Default Re: signal slot confusion

    Hello,

    No I am justing using VCPROJ files. Due to our own Object + Signal Slots we want to avoid moc-ing an object that inherits our own Object.

    Regards,

    Marcel

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

    Default Re: signal slot confusion

    Quote Originally Posted by mstegehu View Post
    Do or do I not have to MOC my NewWidget.h.
    It depends what you have there. If you declare new signals or slots in NewWidget then you should run moc on it.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: signal slot confusion

    Let qmake generate the .vcproj for you (and re-generate it whenever you add/remove a Q_OBJECT macro) and you're fine. By the way, just in case.. it's "qmake -tp vc".
    J-P Nurmi

  6. #6
    Join Date
    Sep 2008
    Posts
    54
    Thanks
    3
    Thanked 10 Times in 5 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    2

    Default Re: signal slot confusion

    wysota,

    So, the designer UI file with auto connect signals and slot generates a .h file that does not need to be moc-ed anymore.

    I thought one needed Meta information of the object and signals slots to connect them. So how is that done when the uic generated .h file has no Q_OBJECT macro. Or is that what the call to QMetaObject::connectSlotsByName(BaseObject) is for combined with the setting of the ObjectNames?

    Regards,

    Marcel

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

    Default Re: signal slot confusion

    Quote Originally Posted by mstegehu View Post
    I thought one needed Meta information of the object and signals slots to connect them.
    Only if you declare the signals or the slots in this particular class. But files generated from UI files are not widgets, so they can't be moced. You need to provide your own subclass of QWidget that needs mocing.

    So how is that done when the uic generated .h file has no Q_OBJECT macro.
    Because it's not a QObject.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 8
    Last Post: 27th August 2009, 14:51
  2. pthread instead QThread
    By brevleq in forum Qt Programming
    Replies: 8
    Last Post: 23rd December 2008, 07:16
  3. Connection of custon signals/slots
    By brevleq in forum Qt Programming
    Replies: 2
    Last Post: 23rd December 2008, 07:04
  4. Replies: 12
    Last Post: 18th September 2008, 15:04
  5. signal slot conection using a string, not a SLOT
    By rianquinn in forum Qt Programming
    Replies: 6
    Last Post: 5th February 2006, 18:52

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
  •  
Qt is a trademark of The Qt Company.