Results 1 to 3 of 3

Thread: signal slot connection

  1. #1
    Join Date
    May 2006
    Posts
    28
    Thanks
    8
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default signal slot connection

    Hi,
    I have an application that allows allows new widgets to be created, much like an MDI interface.
    I make a new menu Action when I create a new widget so the user can raise() the selected widget from a Windows Menu.

    I have trouble when the user clicks on one of the menu actions.

    Qt Code:
    1. {
    2. boardWindow->menuAction = new QAction(text, this);
    3. menuWindow->addAction(boardWindow->menuAction) ;
    4.  
    5. connect(boardWindow->menuAction, SIGNAL(triggered()), this, SLOT(selectWindow(boardWindow->menuAction->text())));
    6. }
    7.  
    8.  
    9. void MainWindow::selectWindow(QString text)
    10. {}
    To copy to clipboard, switch view to plain text mode 

    I want to do something like above, pass the text or the QAction that initiated the signal. So that I can determine which one it is and thus raise() the appropriate widget.

    I keep the menu Actions in a vector of class
    Qt Code:
    1. class BoardWindow // For a new board vector.
    2. {
    3. public:
    4. QAction* menuAction;
    5. boost::shared_ptr<MainBoard> mainBoard;
    6. int identifier; // A unique id
    7. };
    To copy to clipboard, switch view to plain text mode 

    Any ideas, there must be a way, probably very simple.
    Thanks.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: signal slot connection

    J-P Nurmi

  3. The following 2 users say thank you to jpn for this useful post:

    Big Duck (4th July 2006), bitChanger (6th September 2007)

  4. #3
    Join Date
    May 2006
    Posts
    28
    Thanks
    8
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: signal slot connection

    Yeah just found it in some threads after I posted, should do the trick. thanks

Similar Threads

  1. signal not getting communicated to slot
    By quickNitin in forum Qt Programming
    Replies: 17
    Last Post: 2nd June 2006, 04:56
  2. Manually send signal to slot
    By donmorr in forum Qt Programming
    Replies: 1
    Last Post: 29th May 2006, 15:03
  3. Replies: 2
    Last Post: 17th May 2006, 21:01
  4. signal slot conection using a string, not a SLOT
    By rianquinn in forum Qt Programming
    Replies: 6
    Last Post: 5th February 2006, 18:52
  5. No such signal...
    By chaimar in forum Qt Programming
    Replies: 12
    Last Post: 24th January 2006, 22:33

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.