return by value
This commit is contained in:
parent
a7b3b26f20
commit
b618599e62
|
@ -79,10 +79,10 @@ namespace
|
|||
auto* const slider = new QskSlider( Qt::Horizontal, parent );
|
||||
slider->setMinimum( min );
|
||||
slider->setMaximum( max );
|
||||
slider->setValue( sensor->angle()[ axis ] );
|
||||
slider->setValue( sensor->angles()[ axis ] );
|
||||
|
||||
QObject::connect(slider, &QskSlider::valueChanged, sensor, [axis, sensor](const qreal v){
|
||||
auto angles = sensor->angle();
|
||||
auto angles = sensor->angles();
|
||||
angles[axis] = v;
|
||||
sensor->setAngle(angles);
|
||||
});
|
||||
|
|
|
@ -32,10 +32,10 @@ class QSK_EXPORT QskLevelingSensor : public QskControl
|
|||
void subControlRotationChanged( QskAspect::Subcontrol subControl, const QVector3D& degrees );
|
||||
|
||||
public:
|
||||
Q_REQUIRED_RESULT const Tickmarks& tickmarks( Qt::Axis axis ) const;
|
||||
Q_REQUIRED_RESULT const TickmarksLabels& tickmarkLabels( Qt::Axis axis ) const;
|
||||
Q_REQUIRED_RESULT const QVector3D& angle() const;
|
||||
Q_REQUIRED_RESULT const QVector3D& subControlRotation( QskAspect::Subcontrol subControl ) const;
|
||||
Q_REQUIRED_RESULT Tickmarks tickmarks( Qt::Axis axis ) const;
|
||||
Q_REQUIRED_RESULT TickmarksLabels tickmarkLabels( Qt::Axis axis ) const;
|
||||
Q_REQUIRED_RESULT QVector3D angles() const;
|
||||
Q_REQUIRED_RESULT QVector3D subControlRotation( QskAspect::Subcontrol subControl ) const;
|
||||
|
||||
private:
|
||||
class PrivateData;
|
||||
|
|
|
@ -65,7 +65,7 @@ QSK_SUBCONTROL( QskLevelingSensor, TickmarksZLabels )
|
|||
class QskLevelingSensor::PrivateData
|
||||
{
|
||||
public:
|
||||
QVector3D m_angle = { 45, 45, 45 };
|
||||
QVector3D m_angles = { 45, 45, 45 };
|
||||
Tickmarks m_tickmarks[ 3 ];
|
||||
TickmarksLabels m_tickmarksLabels[ 3 ];
|
||||
std::unordered_map< QskAspect::Subcontrol, QVector3D > m_subControlRotation;
|
||||
|
@ -95,14 +95,14 @@ void QskLevelingSensor::setTickmarksLabels( const Qt::Axis axis, TickmarksLabels
|
|||
|
||||
void QskLevelingSensor::setAngle( const QVector3D& degrees )
|
||||
{
|
||||
if ( compareExchange( m_data->m_angle, degrees ) )
|
||||
if ( compareExchange( m_data->m_angles, degrees ) )
|
||||
{
|
||||
update();
|
||||
Q_EMIT anglesChanged( m_data->m_angle );
|
||||
Q_EMIT anglesChanged( m_data->m_angles );
|
||||
}
|
||||
}
|
||||
|
||||
const QskScaleTickmarks& QskLevelingSensor::tickmarks( const Qt::Axis axis ) const
|
||||
QskScaleTickmarks QskLevelingSensor::tickmarks( const Qt::Axis axis ) const
|
||||
{
|
||||
if ( isAxis( axis ) )
|
||||
{
|
||||
|
@ -112,7 +112,7 @@ const QskScaleTickmarks& QskLevelingSensor::tickmarks( const Qt::Axis axis ) con
|
|||
return invalid;
|
||||
}
|
||||
|
||||
const QskLevelingSensor::TickmarksLabels& QskLevelingSensor::tickmarkLabels(
|
||||
QskLevelingSensor::TickmarksLabels QskLevelingSensor::tickmarkLabels(
|
||||
const Qt::Axis axis ) const
|
||||
{
|
||||
if ( isAxis( axis ) )
|
||||
|
@ -123,12 +123,12 @@ const QskLevelingSensor::TickmarksLabels& QskLevelingSensor::tickmarkLabels(
|
|||
return invalid;
|
||||
}
|
||||
|
||||
const QVector3D& QskLevelingSensor::angle() const
|
||||
QVector3D QskLevelingSensor::angles() const
|
||||
{
|
||||
return m_data->m_angle;
|
||||
return m_data->m_angles;
|
||||
}
|
||||
|
||||
const QVector3D& QskLevelingSensor::subControlRotation(
|
||||
QVector3D QskLevelingSensor::subControlRotation(
|
||||
const QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
static const QVector3D notFound;
|
||||
|
|
|
@ -50,9 +50,9 @@ namespace
|
|||
, r2( QskLevelingSensorSkinlet::outerRadius( sensor ) )
|
||||
, cX( QskLevelingSensorSkinlet::center( sensor ).x() )
|
||||
, cY( QskLevelingSensorSkinlet::center( sensor ).y() )
|
||||
, sX( r1 / sensor->angle().x() )
|
||||
, sY( r1 / sensor->angle().y() )
|
||||
, sZ( r1 / sensor->angle().z() )
|
||||
, sX( r1 / sensor->angles().x() )
|
||||
, sY( r1 / sensor->angles().y() )
|
||||
, sZ( r1 / sensor->angles().z() )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -286,7 +286,7 @@ QSGNode* QskLevelingSensorSkinlet::updateSubNode< R::Horizon >(
|
|||
const auto subControl = Q::Horizon;
|
||||
const State< QskAspect::Subcontrol > state( sensor, subControl );
|
||||
|
||||
const auto dY = 2 * sensor->angle().y();
|
||||
const auto dY = 2 * sensor->angles().y();
|
||||
const auto pY = qBound( 0.0, 0.5 + ( -state.rX / dY ), 1.0 );
|
||||
|
||||
const auto shape = QskBoxShapeMetrics{ state.r1 };
|
||||
|
|
Loading…
Reference in New Issue