6#include "QskTickmarks.h"
9static void qskRegisterTickmarks()
11 qRegisterMetaType< QskTickmarks >();
13#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
14 QMetaType::registerEqualsComparator< QskTickmarks >();
18Q_CONSTRUCTOR_FUNCTION( qskRegisterTickmarks )
20QskTickmarks::QskTickmarks()
24QskTickmarks::QskTickmarks(
const QVector< qreal >& minorTicks,
25 const QVector< qreal >& mediumTicks,
const QVector< qreal >& majorTicks )
26 : m_ticks{ minorTicks, mediumTicks, majorTicks }
30QskTickmarks::~QskTickmarks()
34int QskTickmarks::tickCount() const noexcept
36 const auto count = m_ticks[ MajorTick ].count()
37 + m_ticks[ MediumTick ].count()
38 + m_ticks[ MinorTick ].count();
40 return static_cast< int >( count );
44int QskTickmarks::tickCount( TickType type )
const noexcept
46 return static_cast< int >( m_ticks[ type ].count() );
49QVector< qreal > QskTickmarks::ticks( TickType type )
const noexcept
51 return m_ticks[ type ];
54void QskTickmarks::setTicks(TickType type,
const QVector< qreal >& ticks )
56 m_ticks[ type ] = ticks;
59qreal QskTickmarks::tickAt( TickType type,
int index )
const
61 return m_ticks[ type ].at( index );
64void QskTickmarks::reset()
71void QskTickmarks::invert()
73 std::reverse( m_ticks[ 0 ].begin(), m_ticks[ 0 ].end() );
74 std::reverse( m_ticks[ 1 ].begin(), m_ticks[ 1 ].end() );
75 std::reverse( m_ticks[ 2 ].begin(), m_ticks[ 2 ].end() );
78QskHashValue QskTickmarks::hash( QskHashValue seed )
const noexcept
80 seed = qHash( m_ticks[0], seed );
81 seed = qHash( m_ticks[1], seed );
82 seed = qHash( m_ticks[2], seed );
87bool QskTickmarks::operator==(
const QskTickmarks& other )
const noexcept
89 return ( m_ticks[ 0 ] == other.m_ticks[ 0 ] )
90 && ( m_ticks[ 1 ] == other.m_ticks[ 1 ] )
91 && ( m_ticks[ 2 ] == other.m_ticks[ 2 ] );
94#ifndef QT_NO_DEBUG_STREAM
98QDebug operator<<( QDebug debug,
const QskTickmarks& tickmarks )
100 debug << tickmarks.majorTicks()
101 << tickmarks.mediumTicks() << tickmarks.minorTicks();
108#include "moc_QskTickmarks.cpp"