add hash function

This commit is contained in:
Rick Vogel 2023-11-07 19:11:00 +01:00
parent bb10d682b2
commit 9419a32ab1
1 changed files with 10 additions and 0 deletions

View File

@ -40,6 +40,8 @@ class QSK_EXPORT QskTickmarksMetrics
Q_REQUIRED_RESULT constexpr qreal ratio( int index ) const noexcept; Q_REQUIRED_RESULT constexpr qreal ratio( int index ) const noexcept;
constexpr void setRatio(int index, qreal ratio) noexcept; constexpr void setRatio(int index, qreal ratio) noexcept;
Q_REQUIRED_RESULT QskHashValue hash( QskHashValue seed = 0 ) const noexcept;
private: private:
qreal m_minorRatio = 0.0; qreal m_minorRatio = 0.0;
qreal m_mediumRatio = 0.0; qreal m_mediumRatio = 0.0;
@ -131,4 +133,12 @@ inline constexpr void QskTickmarksMetrics::setRatio( int index, qreal ratio ) no
} }
} }
inline QskHashValue QskTickmarksMetrics::hash( const QskHashValue seed ) const noexcept
{
auto hash = qHash( m_minorRatio, seed );
hash = qHash( m_mediumRatio, hash );
hash = qHash( m_majorRatio, hash );
return hash;
}
#endif #endif