Results 1 to 2 of 2

Thread: How to delete reference to on_Action.... slot

  1. #1
    Join Date
    Jun 2012
    Posts
    219
    Thanks
    28
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to delete reference to on_Action.... slot

    Qt Designer has a nice feature that lets you set up a template for slots associated with an action. You just right mouse click on the action, then click on "Go to Slot".

    It sets up a prototype for a slot, and creates an empty method named something like "on_action.." The connection between signal and slot is done automatically. Sweet!

    But, what if I no longer want anything to happen on that signal? For example, I decided to use a "toggled" signal instead of the "triggered" signal. I can't figure out how to get rid the stuff associated with the triggered signal.

    Deleting the proto and code for the slot result in an undefined reference at link time from a moc file. It tried rerunning qmake, but that didn't fix.

    I'm thinking there's an easy way, but I can't figure it out.


    Added after 44 minutes:


    After deleting the proto and slot code, a clean build fixed it up.
    Last edited by davethomaspilot; 7th April 2015 at 21:30.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to delete reference to on_Action.... slot

    Quote Originally Posted by davethomaspilot View Post
    It sets up a prototype for a slot, and creates an empty method named something like "on_action.." The connection between signal and slot is done automatically. Sweet!
    And it is a very bad feature since it is based on the name of the sender object.

    I wouldn't recommend to do that in any real world application, explicit connects are far more robust.

    Cheers,
    _

Similar Threads

  1. Replies: 8
    Last Post: 7th November 2012, 14:10
  2. Replies: 3
    Last Post: 20th January 2012, 15:23
  3. Replies: 0
    Last Post: 19th January 2012, 15:52
  4. Replies: 4
    Last Post: 19th February 2009, 11:10
  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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.