Results 1 to 2 of 2

Thread: Button with signals and slots

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

    Default Button with signals and slots

    I have a class that creates a button. A piece of the code is:
    *******************************************
    connect(btnCreateAccount, SIGNAL(clicked()), this, SLOT(btnCreateAccount_Clicked()));
    }


    void LoginUi::btnCreateAccount_Clicked()
    {
    QUrl url("http://www.google.com");
    QDesktopServices:penUrl(url);
    }
    *******************************************

    In this code when the button is pressed the btnCreateAccount_Clicked() function is called. To do this I had to create a new entrance for the function in the "public slots:" field.

    I am not inheriting from QPushButton.

    Is it possible to overwrite the Clicked() signal for that button, so I don't have to create a new entrance in the "public slots:" ?

  2. #2
    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: Button with signals and slots

    No, you have to declare a slot if you want to use it. Come on, it's not that much work!

Similar Threads

  1. Signals and Slots question
    By Thoosle in forum Qt Programming
    Replies: 5
    Last Post: 5th December 2006, 00:24
  2. Nested signals and slots
    By vishva in forum Qt Programming
    Replies: 2
    Last Post: 18th August 2006, 09:47
  3. Signals and Slots in dll
    By ankurjain in forum Qt Programming
    Replies: 8
    Last Post: 29th March 2006, 08:12
  4. Order of signals and slots
    By Morea in forum Newbie
    Replies: 1
    Last Post: 26th February 2006, 22:09
  5. Problem with Signals and Slots
    By Kapil in forum Newbie
    Replies: 11
    Last Post: 15th February 2006, 11:35

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.