Results 1 to 5 of 5

Thread: how to set Push Button PopMenu Signals?

  1. #1
    Join Date
    Jun 2009
    Location
    India
    Posts
    143
    Thanks
    16
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Question how to set Push Button PopMenu Signals?

    Hi I am creating a Push Button named "Start" with below Pop up menus
    Qt Code:
    1. QMenu *menu=new QMenu();
    2. menu->addAction("GPS");
    3. menu->addAction("Serial Port");
    4. menu->addAction("Browser");
    5. pushButton->setMenu(menu);
    To copy to clipboard, switch view to plain text mode 

    Now when i click any one of the pop up menu how do i create signals for that?

    i couldnt able to find signals for popup menu.

    Please help
    Last edited by wysota; 4th July 2009 at 12:15. Reason: missing [code] tags

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: how to set Push Button PopMenu Signals?

    addAction() returns a QAction object that emits a QAction::triggered() signal when the action is activated.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jun 2009
    Location
    India
    Posts
    143
    Thanks
    16
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: how to set Push Button PopMenu Signals?

    Quote Originally Posted by wysota View Post
    addAction() returns a QAction object that emits a QAction::triggered() signal when the action is activated.

    Can you Please explain with a example how i do i connect a signal for the below action

    Qt Code:
    1. QMenu *menu=new QMenu();
    2. menu->addAction("Start");
    3. pushButton->setMenu(menu);
    To copy to clipboard, switch view to plain text mode 
    We tried using the below connect :

    Qt Code:
    1. connect(Start, SIGNAL(trigerred()), this, SLOT(startmenu()) );
    To copy to clipboard, switch view to plain text mode 
    It gave an error

    error: ‘Start’ was not declared in this scope.
    Please Help
    Last edited by jpn; 6th July 2009 at 20:24. Reason: missing [code] tags

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: how to set Push Button PopMenu Signals?

    Qt Code:
    1. QAction *Start = menu->addAction("Start");
    2. connect(Start, SIGNAL(...), ..., SLOT(...));
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. The following user says thank you to wysota for this useful post:

    augusbas (6th July 2009)

  6. #5
    Join Date
    Jun 2009
    Location
    India
    Posts
    143
    Thanks
    16
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Talking Re: how to set Push Button PopMenu Signals?

    Quote Originally Posted by wysota View Post
    Qt Code:
    1. QAction *Start = menu->addAction("Start");
    2. connect(Start, SIGNAL(...), ..., SLOT(...));
    To copy to clipboard, switch view to plain text mode 

    Thanks a lot Wysota , it worked out fantastically

Similar Threads

  1. Designing the display content of a push button
    By cookie1909 in forum Newbie
    Replies: 4
    Last Post: 16th April 2009, 22:24
  2. Line edit and push button
    By dela in forum Newbie
    Replies: 1
    Last Post: 10th December 2008, 16:10
  3. shape of push button
    By Seema Rao in forum Qt Programming
    Replies: 23
    Last Post: 2nd April 2008, 01:05
  4. Push Button problem!!
    By Seema Rao in forum Qt Programming
    Replies: 1
    Last Post: 22nd April 2006, 16:31
  5. Push button double click
    By curtisw in forum Qt Programming
    Replies: 3
    Last Post: 15th February 2006, 16:40

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.