Results 1 to 2 of 2

Thread: Creating slots in Designer

  1. #1
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    387
    Thanks
    101
    Thanked 15 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Creating slots in Designer

    When you are editing signals and slots in Designer, there is a possibility to add a custom slot to a widget. What's the point of this operation? How would you "fill in" the code of this slot, since you don't really have access to the source of the widget?

  2. #2
    Join Date
    Feb 2009
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Creating slots in Designer

    You "fill in" the code of the extra slots when you define the class which uses the designer form.
    Using the slots in designer only results in one line of code connecting the widgets (which dosen't require the slots to be implemented because the signal and slot arguments of QObject::connect are just char*).
    If you have a QPushButton connecting to a custom slot of your QWidget form this code could look something like this:
    Qt Code:
    1. QObject::connect(neatPushButton, SIGNAL(clicked()), yourForm, SLOT(foo()));
    To copy to clipboard, switch view to plain text mode 
    So you just have to define and implement the slot in the class using the form. (which makes the direct approach pretty pointless; you would have to write a QWidget subclass either way)

Similar Threads

  1. Jambi - Eclipse - Designer - Slots
    By ronnyf in forum Newbie
    Replies: 2
    Last Post: 2nd February 2009, 15:35
  2. Replies: 12
    Last Post: 23rd June 2008, 08:05
  3. Replies: 4
    Last Post: 9th August 2007, 08:20
  4. Replies: 2
    Last Post: 12th July 2007, 09:55
  5. Adding slots in Designer
    By jamos in forum Qt Tools
    Replies: 5
    Last Post: 18th May 2006, 23:28

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.