Results 1 to 3 of 3

Thread: action container

  1. #1
    Join Date
    Jun 2015
    Location
    California, USA
    Posts
    61
    Thanks
    43
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11

    Default action container

    I use a QMap<QString, QAction*> for every action (around 200) in the program, where the key is the action's objectName.
    If I was going to have this container be a permanent member of the main window subclass,
    is there an obvious choice between QMap, std::map, QHash and std::unordered_map?
    The order they are stored doesn't matter.

  2. #2
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: action container

    I personally prefer the Qt implementations over the std ones... Since you don't care about ordered retrieval, I'd use QHash in your case.
    I write the best type of code possible, code that I want to write, not code that someone tells me to write!

  3. The following user says thank you to jefftee for this useful post:

    ravas (10th February 2016)

  4. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: action container

    I personally prefer the std implementations over the Qt ones for portability reasons, but I'd vote with jefftee on this one since what you need it for is anything but portable to a non-Qt app.

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

    ravas (10th February 2016)

Similar Threads

  1. Replies: 7
    Last Post: 20th September 2014, 13:03
  2. Container for TCP segments
    By morfis in forum Newbie
    Replies: 6
    Last Post: 31st May 2012, 19:31
  3. Scrollbar in the container
    By anju123 in forum Qt Programming
    Replies: 6
    Last Post: 21st July 2008, 08:44
  4. Quick ? about qSort(Container & container)
    By JimDaniel in forum Qt Programming
    Replies: 2
    Last Post: 15th December 2007, 12:20
  5. No action checked in an exclusive action group
    By SkripT in forum Qt Programming
    Replies: 12
    Last Post: 13th February 2006, 07:19

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.