Results 1 to 2 of 2

Thread: Signal and slots

  1. #1
    Join Date
    Jul 2006
    Location
    Cagliari - Sardinia - Italy
    Posts
    26
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11

    Question Signal and slots

    Hi all, I've a little question about Signal and Slot.
    If I have a signal connected to more than one slot, it's possible to estabilish which slot is called first?
    For example, I've three comboboxes. When I activate some item in the first one, i want to clear the other ones, and I want to insert new items into them. So I've connected acivated signal of the first one combo to clear() slot of the other ones, and the same activated signal to another slot that fills combos. But, when I activate an item in the first one combo, the other ones remain empty. This because, clear() slot is call after slot that fills combos.
    I hope I've been clear

    Thanks

  2. #2
    Join Date
    Jan 2006
    Posts
    128
    Thanked 28 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Signal and slots

    Quote Originally Posted by villy View Post
    If I have a signal connected to more than one slot, it's possible to estabilish which slot is called first?
    Taken From docs:
    If several slots are connected to one signal, the slots will be executed one after the other, in an arbitrary order, when the signal is emitted.

    Quote Originally Posted by villy View Post
    For example, I've three comboboxes. When I activate some item in the first one, i want to clear the other ones, and I want to insert new items into them. So I've connected acivated signal of the first one combo to clear() slot of the other ones, and the same activated signal to another slot that fills combos. But, when I activate an item in the first one combo, the other ones remain empty. This because, clear() slot is call after slot that fills combos.
    I hope I've been clear

    Thanks
    How about creating a new slot:
    Qt Code:
    1. void SomeClass::SomeSlot()
    2. {
    3. //Clear combobox(es)
    4. //fill combobox(es)
    5. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Signals and Slots question
    By Thoosle in forum Qt Programming
    Replies: 5
    Last Post: 5th December 2006, 00:24
  2. Replies: 2
    Last Post: 17th May 2006, 21:01
  3. no such signal QListBox::currentChanged()
    By jopie bakker in forum Newbie
    Replies: 2
    Last Post: 2nd March 2006, 15:17
  4. Emiting signal, which NOT connected to any slots
    By krivenok in forum Qt Programming
    Replies: 7
    Last Post: 27th February 2006, 16:32
  5. Problem with Signal and Slots
    By Kapil in forum Installation and Deployment
    Replies: 2
    Last Post: 10th February 2006, 08:51

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.