small fixes

This commit is contained in:
Peter Hartmann 2022-01-10 16:33:29 +01:00
parent 236fd7f14a
commit a272214e8d
2 changed files with 14 additions and 7 deletions

View File

@ -421,7 +421,7 @@ static void addColoredBorderRectangles6( QskLinearBox* parent )
{ 1.0, Qt::black } } ); { 1.0, Qt::black } } );
QskGradient gradient3( Qt::green ); QskGradient gradient3( Qt::green );
QskGradient gradient4( Qt::Vertical, Qt::magenta, Qt::cyan ); QskGradient gradient4( Qt::Vertical, Qt::magenta, Qt::cyan );
box->setBorderGradients( gradient1, gradient2, gradient3, gradient4 ); box->setBorderGradients( gradient3, gradient3, gradient3, gradient4 );
box->setShape( 30, Qt::AbsoluteSize ); box->setShape( 30, Qt::AbsoluteSize );
} }

View File

@ -99,6 +99,11 @@ namespace
int m_stepCount; int m_stepCount;
bool m_inverted; bool m_inverted;
}; };
int colorsInGradient( const QskGradient& gradient )
{
return gradient.isMonochrome() ? 1 : gradient.stops().count();
}
} }
namespace namespace
@ -1224,13 +1229,15 @@ void QskBoxRenderer::renderRectellipse( const QRectF& rect,
{ {
borderLineCount = 4 * ( stepCount + 1 ) + 1; borderLineCount = 4 * ( stepCount + 1 ) + 1;
const int additionalLines = -1 const int additionalLines =
+ borderColors.gradient( Qsk::Left ).stops().count() - 1 colorsInGradient( borderColors.gradient( Qsk::Left ) ) - 1
+ borderColors.gradient( Qsk::Top ).stops().count() - 1 + colorsInGradient( borderColors.gradient( Qsk::Top ) ) - 1
+ borderColors.gradient( Qsk::Right ).stops().count() - 1 + colorsInGradient( borderColors.gradient( Qsk::Right ) ) - 1
+ borderColors.gradient( Qsk::Bottom ).stops().count() - 1; + colorsInGradient( borderColors.gradient( Qsk::Bottom ) ) - 1;
borderLineCount += qMax( additionalLines, 0 ); qDebug() << "additional lines:" << additionalLines;
borderLineCount += additionalLines;
} }
int lineCount = borderLineCount + fillLineCount; int lineCount = borderLineCount + fillLineCount;