Results 1 to 2 of 2

Thread: I need help for signals

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2006
    Posts
    57
    Thanks
    12
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question I need help for signals

    Well i was created a QT Dialog and i need create a signal for this dialog, in such a way that when it does click in a button I warned that I did click to him (this outside of dialog).
    Then i need a tutorial for create a signals to use in connect
    Thanks

  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: I need help for signals

    You could use "signal chaining" (connecting a signal to another signal) for achieving this. See the example below:
    Qt Code:
    1. class MyDialog : public QDialog
    2. {
    3. // don't forget this macro whenever you declare
    4. // custom signals and/or slots
    5. Q_OBJECT
    6.  
    7. public:
    8. MyDialog(QWidget* parent = 0);
    9.  
    10. // declare a custom signal
    11. signals:
    12. void someButtonClicked();
    13. };
    14.  
    15. MyDialog::MyDialog(QWidget* parent) : QDialog(parent)
    16. {
    17. // form a connection between the button and the dialog
    18. connect(someButtonInTheDialog, SIGNAL(clicked()), this, SIGNAL(someButtonClicked()));
    19. }
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    avis_phoenix (30th September 2007)

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.