assertions weakened to warnings to prevent property inspectors ( f.e gammaray ), that do not know about the specific semantics of the gradient direction, from crashing

This commit is contained in:
Uwe Rathmann 2024-10-09 07:45:20 +02:00
parent 920f7e24d6
commit d6b9ea4525
2 changed files with 9 additions and 8 deletions

View File

@ -615,10 +615,11 @@ void QskGradient::setLinearDirection( const QskLinearDirection& direction )
QskLinearDirection QskGradient::linearDirection() const
{
Q_ASSERT( m_type == Linear );
if ( m_type != Linear )
{
qWarning() << "Requesting linear attributes from a non linear gradient.";
return QskLinearDirection( 0.0, 0.0, 0.0, 0.0 );
}
return QskLinearDirection( m_values[0], m_values[1], m_values[2], m_values[3] );
}
@ -644,10 +645,11 @@ void QskGradient::setRadialDirection( const QskRadialDirection& direction )
QskRadialDirection QskGradient::radialDirection() const
{
Q_ASSERT( m_type == Radial );
if ( m_type != Radial )
{
qWarning() << "Requesting radial attributes from a non radial gradient.";
return QskRadialDirection( 0.5, 0.5, 0.0 );
}
return QskRadialDirection( m_values[0], m_values[1], m_values[2], m_values[3] );
}
@ -683,10 +685,11 @@ void QskGradient::setConicDirection( const QskConicDirection& direction )
QskConicDirection QskGradient::conicDirection() const
{
Q_ASSERT( m_type == Conic );
if ( m_type != Conic )
{
qWarning() << "Requesting conic attributes from a non conic gradient.";
return QskConicDirection( 0.5, 0.5, 0.0, 0.0 );
}
QskConicDirection dir( m_values[0], m_values[1], m_values[2], m_values[3] );
dir.setAspectRatio( m_values[4] );

View File

@ -12,8 +12,6 @@
#include <qpoint.h>
#include <qline.h>
class QLineF;
class QSK_EXPORT QskLinearDirection
{
Q_GADGET