Results 1 to 3 of 3

Thread: Delegates and Signal/Slot

  1. #1
    Join Date
    Aug 2008
    Location
    Iowa, USA
    Posts
    21
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Delegates and Signal/Slot

    How do I go about connecting delegate signals or delegate slots to other things? I did a quick search on these forums for delegates and didn't find anything, and I've checked over Qt Assistant, also briefly, and cannot seem to find an example.

    Does someone know how to go about connect delegates, have an example for me to look at, or know where in the Qt Assistant I need to be looking?

    Thank you.

  2. #2
    Join Date
    Aug 2008
    Location
    Iowa, USA
    Posts
    21
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Delegates and Signal/Slot

    Found the correct example to follow. Check out http://doc.trolltech.com/4.4/itemviews-pixelator.html if you want to see how to connect delegates.

    The main point, at least for me, was to create the delegate before hand so you still maintain a reference to it. Don't simply create the delegate when calling setItemDelegate. At that point, the delegate is no different than anything else as far as Signal/Slot is concerned.

  3. #3
    Join Date
    Oct 2008
    Location
    Beijing China
    Posts
    77
    Thanks
    21
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Delegates and Signal/Slot

    i had tried:

    MyDelegate *delegate = new MyDelegate;
    someView->setItemDelegate(delegaare);
    connect(delegate, SIGNAL(delegate's signal()),
    someWidget, SLOT(someWidget's slot()));

    in MyDelegate implementation:

    MyDelegate::createEditor(..)
    {
    //after create the editor
    connect (editor, SIGNAL(editor's signal()), this, SLOT(delegate's slot()));
    }

    MyDelegate::delegate's slot()
    {
    emit delegate's signal();
    }


    it makes troubles when being used, however, it works.

Similar Threads

  1. Passing a pointer in Signal/Slot Connection
    By mclark in forum Qt Programming
    Replies: 4
    Last Post: 6th November 2007, 19:04
  2. What argument types for Signal/Slot?
    By DPinLV in forum Qt Programming
    Replies: 5
    Last Post: 2nd August 2006, 19:08
  3. What if not Signal/Slot
    By munna in forum General Discussion
    Replies: 2
    Last Post: 26th May 2006, 06:48
  4. Signal/slot connections of deleted items
    By Michiel in forum Newbie
    Replies: 2
    Last Post: 24th March 2006, 16:44
  5. Replies: 4
    Last Post: 23rd January 2006, 16:51

Tags for this Thread

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.