Results 1 to 3 of 3

Thread: access menubar items by name

  1. #1
    Join Date
    Oct 2009
    Posts
    90
    Thanks
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default access menubar items by name

    hi
    how can I access menubar items by their action names?

    regrads
    navid

  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: access menubar items by name

    If you don't have pointers to all the actions in your menu then you can store them in a QHash<QString,QAction*> or you can use qFindChild() to find an object by name knowing its type and parent.
    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
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: access menubar items by name

    Be carefull: There is no mechanism that prevents you from creating two actions with the same name. You cannot be sure that the object name is a unique identifier.
    It's nice to be important but it's more important to be nice.

Similar Threads

  1. Replies: 5
    Last Post: 27th November 2009, 13:57
  2. Some menubar items can not be clicked
    By richardander in forum Qt Programming
    Replies: 4
    Last Post: 11th March 2009, 00:26
  3. Can't click menubar items / QPixMap doesn't show
    By richardander in forum Qt Programming
    Replies: 1
    Last Post: 30th December 2008, 10:45
  4. Dynamic access of ui items
    By Matze-o in forum Qt Programming
    Replies: 1
    Last Post: 6th November 2008, 23:13
  5. Selective highlighting of Items
    By Kapil in forum Qt Programming
    Replies: 3
    Last Post: 26th May 2006, 12:20

Tags for this Thread

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.