Results 1 to 3 of 3

Thread: Very quick question: Can you use a pointer as a key in a QHash?

  1. #1
    Join Date
    Apr 2010
    Posts
    77
    Thanks
    10
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Very quick question: Can you use a pointer as a key in a QHash?

    Can you use a pointer as a key in a QHash?

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Very quick question: Can you use a pointer as a key in a QHash?

    Sure. You don't even need to provide a qHash() overload because one is generated for you by the template. Why do you ask?

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

    Jeffb (14th March 2012)

  4. #3
    Join Date
    Apr 2010
    Posts
    77
    Thanks
    10
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: Very quick question: Can you use a pointer as a key in a QHash?

    Just wanted to make sure.
    Had to decide whether to use a QMultiHash of values to Node ptrs or a QHash of Node ptrs to values.
    The second one allows me to remove a row without having to iterate through the results of a find.

    Thanks for that.
    Jeff

Similar Threads

  1. QtVariant pointer from QHash list
    By rmat in forum Qt Programming
    Replies: 3
    Last Post: 9th August 2011, 10:28
  2. Quick Bindvalue Question
    By tpf80 in forum Qt Programming
    Replies: 7
    Last Post: 6th February 2009, 21:09
  3. Quick RegExp question
    By stealth86 in forum Qt Programming
    Replies: 3
    Last Post: 26th July 2007, 08:23
  4. Quick spacing question
    By bruccutler in forum Newbie
    Replies: 4
    Last Post: 8th March 2007, 20:46
  5. QHash::unite() question
    By aMan in forum Newbie
    Replies: 10
    Last Post: 5th November 2006, 17:57

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.