Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QHash implementation for QDate and QDateTime
Forum Updated to NodeBB v4.3 + New Features

QHash implementation for QDate and QDateTime

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 4.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • napajejenunedk0N Offline
    napajejenunedk0N Offline
    napajejenunedk0
    wrote on last edited by
    #1

    Suggest a qHash implementation for QDate and QDateTime that has the least performance penalty.

    The implementation having the highest performance will be one that uses plain integer values and bitwise operations.
    The following integer properties will be used for:

    • QDate: year/month/day
    • QDateTime: year/month/day/hour/minute/second/millisecond

    An implementation that would give a unique result is the following:

    Transform the QDate/QDateTime to string using the following templates:

    QDate: yyyy/MM/dd
    QDateTime: yyyy/MM/dd/hh/mm/ss/zzz

    use the already provided qHash( const QString& ) function to generate the hash code

    Such implementation has a great performance overhead since strings are involved instead of plain integer values.

    I am curious to find out why QDate and QDateTime doesn't have a qHash implementation companions in the QtSDK.
    Are there implementation specifics that prevent those Qt integral types from being qHash-ed?

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      You might want to file your suggestion in "JIRA":https://bugreports.qt.nokia.com/secure/Dashboard.jspa
      In this forum you might get some feedback from others on your suggestion, but the Qt development team is not tracking feature suggestions here.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • napajejenunedk0N Offline
        napajejenunedk0N Offline
        napajejenunedk0
        wrote on last edited by
        #3

        I'll do it right now.

        1 Reply Last reply
        0
        • K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          Thanks. You may want to publish a link to your suggestion here. This allows others in favor of your suggestion to vote for it.

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          0
          • napajejenunedk0N Offline
            napajejenunedk0N Offline
            napajejenunedk0
            wrote on last edited by
            #5

            https://bugreports.qt.nokia.com/browse/QTBUG-23079

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved