I'm using a QPair as a key, and I want to use another comparison function and not the given one.
I tried to derived QPair an use it as a key:
Qt Code:
  1. template <class T1, class T2>
  2. struct stEvPairKey : QPair<T1, T2>
  3. {
  4. stEvPairKey() : QPair<T1, T2>() {}
  5. stEvPairKey(const T1 &t1, const T2 &t2) : QPair<T1, T2>(t1, t2) {}
  6. };
  7. template <class T1, class T2>
  8. bool operator==(const stEvPairKey<T1, T2> &p1, const stEvPairKey<T1, T2> &p2)
  9. {
  10. return (p1.first == p2.first) && (p1.second & p2.second);
  11. }
To copy to clipboard, switch view to plain text mode 

and use this struct as a key:
Qt Code:
  1. QHash<stEvPairKey<int, unsigned long>, CMyClass*> m_hash;
To copy to clipboard, switch view to plain text mode 

But never goes into my "operator==".
The function you give:
Qt Code:
  1. quint32 qHash(const Key &key);
To copy to clipboard, switch view to plain text mode 
is to compute the hash value for the key, but not to compare 2 keys.

What is wrong?

Thank you.