Results 1 to 2 of 2

Thread: How to get Qmenu menuitem text

  1. #1
    Join Date
    Nov 2010
    Posts
    22
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Windows Symbian S60 Maemo/MeeGo

    Default How to get Qmenu menuitem text

    Hi all

    Hope someone can help me. I have managed to add a context menu to a listwidget with currentley only one menu item called "Get details"


    Qt Code:
    1. QAction* menuItem = new QAction("Get details",0);
    2. pop_menu->addAction(menuItem);
    To copy to clipboard, switch view to plain text mode 


    What i wanted was something like the below:

    Qt Code:
    1. If (pop_menu->menuItem->clicked())
    2. {
    3. Do this
    4. }
    To copy to clipboard, switch view to plain text mode 

    Is this possible?

  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 get Qmenu menuitem text

    Use signals and slots to connect the action's triggered() signal to a slot you want executed.
    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.


Similar Threads

  1. Focus in QT MenuItem
    By sk.qt in forum Newbie
    Replies: 2
    Last Post: 20th October 2010, 11:02
  2. QMenu with a Text separator
    By NoRulez in forum Qt Programming
    Replies: 2
    Last Post: 16th September 2010, 12:30
  3. how to increase menuitem's height and width?
    By aoo7wangyan in forum Qt Programming
    Replies: 1
    Last Post: 13th July 2009, 10:00
  4. QAction text color (QMenu)
    By StefanK in forum Qt Programming
    Replies: 1
    Last Post: 20th March 2009, 15:14
  5. Replies: 1
    Last Post: 3rd September 2008, 14:16

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.