try to convert if start/end values have different types

This commit is contained in:
Uwe Rathmann 2022-03-29 11:15:08 +02:00
parent 848a22b2a2
commit 511c6ddcd3

View File

@ -104,6 +104,25 @@ void QskVariantAnimator::setup()
{ {
m_interpolator = nullptr; m_interpolator = nullptr;
if ( m_startValue.userType() != m_endValue.userType() )
{
/*
Convert one value so that the types are matching.
As a side effect startValue()/endValue() won't return what had
been set setStartValue()/setEndValue() !
*/
if ( m_startValue.canConvert( m_endValue.userType() ) )
{
m_startValue.convert( m_endValue.userType() );
}
else if ( m_endValue.canConvert( m_startValue.userType() ) )
{
m_endValue.convert( m_startValue.userType() );
}
}
const auto type = m_startValue.userType(); const auto type = m_startValue.userType();
if ( type == m_endValue.userType() ) if ( type == m_endValue.userType() )
{ {