Skip to content

Commit

Permalink
QskScaleTickmarks -> QskTickmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
uwerat committed Nov 28, 2023
1 parent bd1f7f2 commit 54761e5
Show file tree
Hide file tree
Showing 13 changed files with 71 additions and 71 deletions.
4 changes: 2 additions & 2 deletions examples/iotdashboard/LightDisplaySkinlet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include <QskArcMetrics.h>
#include <QskTextOptions.h>
#include <QskScaleTickmarks.h>
#include <QskTickmarks.h>
#include <QskBoxShadowNode.h>
#include <QskSGNode.h>

Expand Down Expand Up @@ -156,7 +156,7 @@ QSGNode* LightDisplaySkinlet::updateSubNode(
const auto ticksRect = display->subControlRect( LightDisplay::Tickmarks );
const auto arcMetrics = display->arcMetricsHint( LightDisplay::Tickmarks );

QskScaleTickmarks tickmarks;
QskTickmarks tickmarks;
tickmarks.setMajorTicks( { 0, 22.5, 45, 67.5, 90, 112.5, 135, 157.5, 180 } );

const auto tickLineWidth = display->metric( LightDisplay::Tickmarks );
Expand Down
6 changes: 3 additions & 3 deletions examples/iotdashboard/nodes/RadialTickmarksNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "RadialTickmarksNode.h"

#include <QskScaleTickmarks.h>
#include <QskTickmarks.h>
#include <QskArcMetrics.h>
#include <QtMath>

Expand All @@ -24,7 +24,7 @@ RadialTickmarksNode::~RadialTickmarksNode()
}

void RadialTickmarksNode::update( const QColor& color, const QRectF& rect,
const QskArcMetrics& arcMetrics, const QskScaleTickmarks& tickmarks, int lineWidth )
const QskArcMetrics& arcMetrics, const QskTickmarks& tickmarks, int lineWidth )
{
if( lineWidth != m_lineWidth )
{
Expand All @@ -48,7 +48,7 @@ void RadialTickmarksNode::update( const QColor& color, const QRectF& rect,
const auto radius = 0.5 * rect.width();
const auto needleRadius = radius - arcMetrics.thickness();

using TM = QskScaleTickmarks;
using TM = QskTickmarks;

for( int i = TM::MinorTick; i <= TM::MajorTick; i++ )
{
Expand Down
4 changes: 2 additions & 2 deletions examples/iotdashboard/nodes/RadialTickmarksNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <QSGFlatColorMaterial>

class QskArcMetrics;
class QskScaleTickmarks;
class QskTickmarks;

class RadialTickmarksNode : public QSGGeometryNode
{
Expand All @@ -20,7 +20,7 @@ class RadialTickmarksNode : public QSGGeometryNode
~RadialTickmarksNode() override;

void update( const QColor&, const QRectF&,
const QskArcMetrics&, const QskScaleTickmarks&, int lineWidth );
const QskArcMetrics&, const QskTickmarks&, int lineWidth );

private:
QSGGeometry m_geometry;
Expand Down
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ list(APPEND HEADERS
common/QskPlacementPolicy.h
common/QskPlatform.h
common/QskRgbValue.h
common/QskScaleTickmarks.h
common/QskShadowMetrics.h
common/QskSizePolicy.h
common/QskStateCombination.h
common/QskStippleMetrics.h
common/QskTextColors.h
common/QskTextOptions.h
common/QskTickmarks.h
)

list(APPEND SOURCES
Expand All @@ -61,12 +61,12 @@ list(APPEND SOURCES
common/QskPlatform.cpp
common/QskPlacementPolicy.cpp
common/QskRgbValue.cpp
common/QskScaleTickmarks.cpp
common/QskShadowMetrics.cpp
common/QskSizePolicy.cpp
common/QskStippleMetrics.cpp
common/QskTextColors.cpp
common/QskTextOptions.cpp
common/QskTickmarks.cpp
)

list(APPEND HEADERS
Expand Down
12 changes: 6 additions & 6 deletions src/common/QskGraduation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "QskGraduation.h"
#include "QskFunctions.h"
#include "QskIntervalF.h"
#include "QskScaleTickmarks.h"
#include "QskTickmarks.h"

#include <QDebug>
#include <QtMath>
Expand Down Expand Up @@ -222,10 +222,10 @@ namespace Engine
}
}

QskScaleTickmarks buildTicks(
QskTickmarks buildTicks(
const QskIntervalF& interval, qreal stepSize, int maxMinorSteps )
{
using T = QskScaleTickmarks;
using T = QskTickmarks;

const auto boundingInterval = align( interval, stepSize );

Expand All @@ -252,7 +252,7 @@ namespace Engine
}
}

QskScaleTickmarks tickmarks;
QskTickmarks tickmarks;
tickmarks.setMinorTicks( ticks[T::MinorTick] );
tickmarks.setMediumTicks( ticks[T::MediumTick] );
tickmarks.setMajorTicks( ticks[T::MajorTick] );
Expand All @@ -262,10 +262,10 @@ namespace Engine

}

QskScaleTickmarks QskGraduation::divideInterval(
QskTickmarks QskGraduation::divideInterval(
qreal x1, qreal x2, int maxMajorSteps, int maxMinorSteps, qreal stepSize)
{
QskScaleTickmarks tickmarks;
QskTickmarks tickmarks;

const auto interval = QskIntervalF::normalized( x1, x2 );

Expand Down
4 changes: 2 additions & 2 deletions src/common/QskGraduation.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <QskGlobal.h>
#include <qmetatype.h>

class QskScaleTickmarks;
class QskTickmarks;

namespace QskGraduation
{
Expand All @@ -26,7 +26,7 @@ namespace QskGraduation
Q_DECLARE_FLAGS( Attributes, Attribute )
Q_DECLARE_OPERATORS_FOR_FLAGS( Attributes )

QskScaleTickmarks divideInterval( qreal x1, qreal x2,
QskTickmarks divideInterval( qreal x1, qreal x2,
int maxMajorSteps, int maxMinorSteps, qreal stepSize = 0.0 );

void calculate( Attributes, int maxNumSteps,
Expand Down
18 changes: 9 additions & 9 deletions src/common/QskGraduationMetrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#ifndef QSK_GRADUATION_METRICS_H
#define QSK_GRADUATION_METRICS_H

#include "QskScaleTickmarks.h"
#include "QskTickmarks.h"
#include "QskFunctions.h"
#include <algorithm>
#include <qmetatype.h>
Expand All @@ -19,7 +19,7 @@ class QSK_EXPORT QskGraduationMetrics
Q_PROPERTY( qreal minorTickLength READ minorTickLength WRITE setMinorTickLength )

public:
using TickType = QskScaleTickmarks::TickType;
using TickType = QskTickmarks::TickType;

constexpr QskGraduationMetrics() noexcept = default;
constexpr QskGraduationMetrics( qreal minorTickLength,
Expand Down Expand Up @@ -71,32 +71,32 @@ inline constexpr QskGraduationMetrics::QskGraduationMetrics(

inline constexpr qreal QskGraduationMetrics::majorTickLength() const noexcept
{
return tickLength( QskScaleTickmarks::MajorTick );
return tickLength( QskTickmarks::MajorTick );
}

inline constexpr qreal QskGraduationMetrics::mediumTickLength() const noexcept
{
return tickLength( QskScaleTickmarks::MediumTick );
return tickLength( QskTickmarks::MediumTick );
}

inline constexpr qreal QskGraduationMetrics::minorTickLength() const noexcept
{
return tickLength( QskScaleTickmarks::MinorTick );
return tickLength( QskTickmarks::MinorTick );
}

inline constexpr void QskGraduationMetrics::setMajorTickLength( qreal length ) noexcept
{
setTickLength( QskScaleTickmarks::MajorTick, length );
setTickLength( QskTickmarks::MajorTick, length );
}

inline constexpr void QskGraduationMetrics::setMediumTickLength( qreal length ) noexcept
{
setTickLength( QskScaleTickmarks::MediumTick, length );
setTickLength( QskTickmarks::MediumTick, length );
}

inline constexpr void QskGraduationMetrics::setMinorTickLength( qreal length ) noexcept
{
setTickLength( QskScaleTickmarks::MinorTick, length );
setTickLength( QskTickmarks::MinorTick, length );
}

inline constexpr bool QskGraduationMetrics::operator==(
Expand All @@ -114,7 +114,7 @@ inline constexpr bool QskGraduationMetrics::operator!=(
}

inline constexpr qreal QskGraduationMetrics::tickLength(
const QskScaleTickmarks::TickType type ) const noexcept
const QskTickmarks::TickType type ) const noexcept
{
return m_tickLengths[ type ];
}
Expand Down
32 changes: 16 additions & 16 deletions src/common/QskScaleTickmarks.cpp → src/common/QskTickmarks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@
* SPDX-License-Identifier: BSD-3-Clause
*****************************************************************************/

#include "QskScaleTickmarks.h"
#include "QskTickmarks.h"
#include <algorithm>

static void qskRegisterTickmarks()
{
qRegisterMetaType< QskScaleTickmarks >();
qRegisterMetaType< QskTickmarks >();

#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
QMetaType::registerEqualsComparator< QskScaleTickmarks >();
QMetaType::registerEqualsComparator< QskTickmarks >();
#endif
}

Q_CONSTRUCTOR_FUNCTION( qskRegisterTickmarks )

QskScaleTickmarks::QskScaleTickmarks()
QskTickmarks::QskTickmarks()
{
}

QskScaleTickmarks::~QskScaleTickmarks()
QskTickmarks::~QskTickmarks()
{
}

int QskScaleTickmarks::tickCount() const noexcept
int QskTickmarks::tickCount() const noexcept
{
const auto count = m_ticks[ MajorTick ].count()
+ m_ticks[ MediumTick ].count()
Expand All @@ -35,41 +35,41 @@ int QskScaleTickmarks::tickCount() const noexcept
}


int QskScaleTickmarks::tickCount( TickType type ) const noexcept
int QskTickmarks::tickCount( TickType type ) const noexcept
{
return static_cast< int >( m_ticks[ type ].count() );
}

QVector< qreal > QskScaleTickmarks::ticks( TickType type ) const noexcept
QVector< qreal > QskTickmarks::ticks( TickType type ) const noexcept
{
return m_ticks[ type ];
}

void QskScaleTickmarks::setTicks(TickType type, const QVector< qreal >& ticks )
void QskTickmarks::setTicks(TickType type, const QVector< qreal >& ticks )
{
m_ticks[ type ] = ticks;
}

qreal QskScaleTickmarks::tickAt( TickType type, int index ) const
qreal QskTickmarks::tickAt( TickType type, int index ) const
{
return m_ticks[ type ].at( index );
}

void QskScaleTickmarks::reset()
void QskTickmarks::reset()
{
m_ticks[ 0 ].clear();
m_ticks[ 1 ].clear();
m_ticks[ 2 ].clear();
}

void QskScaleTickmarks::invert()
void QskTickmarks::invert()
{
std::reverse( m_ticks[ 0 ].begin(), m_ticks[ 0 ].end() );
std::reverse( m_ticks[ 1 ].begin(), m_ticks[ 1 ].end() );
std::reverse( m_ticks[ 2 ].begin(), m_ticks[ 2 ].end() );
}

QskHashValue QskScaleTickmarks::hash( QskHashValue seed ) const noexcept
QskHashValue QskTickmarks::hash( QskHashValue seed ) const noexcept
{
seed = qHash( m_ticks[0], seed );
seed = qHash( m_ticks[1], seed );
Expand All @@ -78,7 +78,7 @@ QskHashValue QskScaleTickmarks::hash( QskHashValue seed ) const noexcept
return seed;
}

bool QskScaleTickmarks::operator==( const QskScaleTickmarks& other ) const noexcept
bool QskTickmarks::operator==( const QskTickmarks& other ) const noexcept
{
return ( m_ticks[ 0 ] == other.m_ticks[ 0 ] )
&& ( m_ticks[ 1 ] == other.m_ticks[ 1 ] )
Expand All @@ -89,7 +89,7 @@ bool QskScaleTickmarks::operator==( const QskScaleTickmarks& other ) const noexc

#include <qdebug.h>

QDebug operator<<( QDebug debug, const QskScaleTickmarks& tickmarks )
QDebug operator<<( QDebug debug, const QskTickmarks& tickmarks )
{
debug << tickmarks.majorTicks()
<< tickmarks.mediumTicks() << tickmarks.minorTicks();
Expand All @@ -99,4 +99,4 @@ QDebug operator<<( QDebug debug, const QskScaleTickmarks& tickmarks )

#endif

#include "moc_QskScaleTickmarks.cpp"
#include "moc_QskTickmarks.cpp"
Loading

0 comments on commit 54761e5

Please sign in to comment.