turn around gradients

This commit is contained in:
Peter Hartmann 2022-01-14 10:19:45 +01:00
parent d74711bfd8
commit c867406aaf
2 changed files with 13 additions and 12 deletions

View File

@ -397,18 +397,18 @@ static void addColoredBorderRectangles3( QskLinearBox* parent, bool rounded )
{ 0.6, Qt::magenta },
{ 1.0, Qt::green } } );
QskGradient gradient2( Qt::Vertical, { { 0.0, Qt::darkYellow },
{ 0.3, Qt::darkGray },
{ 0.2, Qt::cyan },
{ 1.0, Qt::darkMagenta } } );
QskGradient gradient3( Qt::Vertical, { { 0.0, Qt::darkGreen },
{ 0.25, Qt::darkBlue },
{ 0.5, Qt::darkRed },
{ 0.75, Qt::yellow },
{ 1.0, Qt::magenta } } );
QskGradient gradient3( Qt::Vertical, { { 0.0, Qt::red },
{ 0.25, Qt::green },
{ 0.5, Qt::blue },
{ 0.75, Qt::magenta },
{ 1.0, Qt::cyan } } );
QskGradient gradient4( Qt::Vertical, { { 0.0, Qt::red },
{ 0.3, Qt::green },
{ 0.7, Qt::blue },
{ 1.0, Qt::cyan } } );
box->setBorderGradients( gradient1, gradient2, gradient3, gradient4 );
box->setBorderGradients( gradient3, gradient3, gradient3, gradient3 );
if( rounded )
box->setShape( 30, Qt::AbsoluteSize );
@ -530,8 +530,10 @@ int main( int argc, char* argv[] )
auto* tab5 = new QskLinearBox( Qt::Horizontal, 5 );
tab5->setMargins( 20 );
tab5->setSpacing( 20 );
addColoredBorderRectangles1( tab5, false );
addColoredBorderRectangles1( tab5, true );
// addColoredBorderRectangles1( tab5, false );
// addColoredBorderRectangles1( tab5, true );
addColoredBorderRectangles3( tab5, false );
addColoredBorderRectangles3( tab5, true );
window.addItem( tab5 );
#endif

View File

@ -560,8 +560,7 @@ namespace
for( int l = 1; l <= additionalStopCount; ++l )
{
auto p = s.at( l ).position();
// ### umdrehen:
auto p = ( 1 - s.at( l ).position() );
float xStart = x11 + p * ( x21 - x11 ),
yStart = y11 + p * ( y21 - y11 ),
xEnd = x12 + p * ( x22 - x12 ),
@ -571,7 +570,7 @@ namespace
qDebug() << " end:" << x21 << y21 << x22 << y22;
qDebug() << " gradient stop:" << xStart << yStart << xEnd << yEnd;
lines[ l ].setLine( xStart, yStart, xEnd, yEnd, s.at( l ).color() );
lines[ additionalStopCount - l + 1 ].setLine( xStart, yStart, xEnd, yEnd, s.at( l ).color() );
}
}