Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-86457

Define qHash functions for more basic Qt types like QPoint

    XMLWordPrintable

    Details

    • Type: Suggestion
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None
    • Commits:
      fb65b32d7621f065ec854f1e72828720bffb3b39 (qt/qtbase/dev)

      Description

      To use QPoint in a QSet or QHash, you have to have a qHash function for it:

      https://doc.qt.io/qt-5/qhash.html#the-qhash-hashing-function

      For some reason, Qt doesn't define a qHash function for QPoint. This leads to people defining their own:

      https://stackoverflow.com/questions/24498993/cannot-use-qpoint-as-qhash-key

      Incidentally, in my case, another library that I'm using defines its own qHash for QPoint in a header that I'd rather not include (because it's for unrelated stuff). Yet if I try to define my own, I get an error about qHash being redefined. This would not be an issue if Qt defined hash functions for all of its applicable types.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            thiago Thiago Macieira
            Reporter:
            mitch_curtis Mitch Curtis
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes