Results 1 to 5 of 5

Thread: Is there a simpler way to send the same signal from many objects?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Is there a simpler way to send the same signal from many objects?

    did you see this signal QMenu::triggered.
    an example
    Qt Code:
    1. ...
    2. QMenu *menu = menuBar()->addMenu("Test");
    3. QAction *action = new QAction("1", this);
    4. menu->addAction(action);
    5. action = new QAction("2", this);
    6. menu->addAction(action);
    7. action = new QAction("3", this);
    8. menu->addAction(action);
    9. action = new QAction("4", this);
    10. menu->addAction(action);
    11. action = new QAction("5", this);
    12. menu->addAction(action);
    13.  
    14. connect(menu, SIGNAL(triggered(QAction *)), SLOT(processAction(QAction *)));
    15. ...
    To copy to clipboard, switch view to plain text mode 
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  2. #2
    Join Date
    Nov 2006
    Location
    Shrewsbury, UK
    Posts
    97
    Thanks
    3
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Is there a simpler way to send the same signal from many objects?

    Have you looked at QActionGroup - I think you make a group of QActions mutually exclusive.

    Pete

Similar Threads

  1. Replies: 5
    Last Post: 27th April 2009, 23:29
  2. send own class reference throught signal
    By ^NyAw^ in forum Qt Programming
    Replies: 3
    Last Post: 10th January 2008, 21:55
  3. Can you send a signal to a thread?
    By Dumbledore in forum Qt Programming
    Replies: 1
    Last Post: 9th November 2007, 20:31
  4. Manually send signal to slot
    By donmorr in forum Qt Programming
    Replies: 1
    Last Post: 29th May 2006, 15:03
  5. send signal from QCombobox
    By raphaelf in forum Qt Programming
    Replies: 22
    Last Post: 28th February 2006, 14:18

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.