diff --git a/examples/boxes/main.cpp b/examples/boxes/main.cpp index 9cacb1d6..aa21a6a8 100644 --- a/examples/boxes/main.cpp +++ b/examples/boxes/main.cpp @@ -420,8 +420,9 @@ static void addColoredBorderRectangles6( QskLinearBox* parent ) { 0.7, Qt::white }, { 1.0, Qt::black } } ); QskGradient gradient3( Qt::green ); - QskGradient gradient4( Qt::Vertical, Qt::magenta, Qt::cyan ); - box->setBorderGradients( gradient3, gradient3, gradient3, gradient4 ); + QskGradient gradient4( Qt::Vertical, Qt::red, Qt::blue ); + box->setBorderGradients( gradient4, gradient3, gradient3, gradient3 ); + qDebug() << "@@@ hint:" << gradient4.stops() << box->boxBorderColorsHint( QskBox::Panel ).gradientAt(Qt::LeftEdge).stops(); box->setShape( 30, Qt::AbsoluteSize ); } @@ -501,10 +502,20 @@ int main( int argc, char* argv[] ) SkinnyFont::init( &app ); SkinnyShortcut::enable( SkinnyShortcut::Quit | SkinnyShortcut::DebugShortcuts ); - auto* tabView = new TabView(); + // ### remove: +// auto* tabView = new TabView(); + + auto* tab5 = new QskLinearBox( Qt::Horizontal, 5 ); + tab5->setMargins( 20 ); +// addColoredBorderRectangles1( tab5 ); +// addColoredBorderRectangles2( tab5 ); +// addColoredBorderRectangles3( tab5 ); +// addColoredBorderRectangles4( tab5 ); +// addColoredBorderRectangles5( tab5 ); + addColoredBorderRectangles6( tab5 ); QskWindow window; - window.addItem( tabView ); + window.addItem( tab5 ); window.resize( 600, 600 ); window.show(); diff --git a/src/common/QskBoxBorderColors.cpp b/src/common/QskBoxBorderColors.cpp index 4bee8c17..ad21f589 100644 --- a/src/common/QskBoxBorderColors.cpp +++ b/src/common/QskBoxBorderColors.cpp @@ -15,23 +15,26 @@ static void qskRegisterBoxBorderColors() QMetaType::registerConverter< QColor, QskBoxBorderColors >( []( const QColor& color ) { return QskBoxBorderColors( color ); } ); + + QMetaType::registerConverter< QskGradient, QskBoxBorderColors >( + []( const QskGradient& gradient ) { return QskBoxBorderColors( gradient ); } ); } Q_CONSTRUCTOR_FUNCTION( qskRegisterBoxBorderColors ) -static inline void qskSetGradients( const QskGradient& c, QskGradient* colors ) +static inline void qskSetGradients( const QskGradient& c, QskGradient* gradients ) { - colors[ 0 ] = colors[ 1 ] = colors[ 2 ] = colors[ 3 ] = c; + gradients[ 0 ] = gradients[ 1 ] = gradients[ 2 ] = gradients[ 3 ] = c; } static inline void qskSetGradients( const QskGradient& left, const QskGradient& top, - const QskGradient& right, const QskGradient& bottom, QskGradient* colors ) + const QskGradient& right, const QskGradient& bottom, QskGradient* gradients ) { - colors[ Qsk::Left ] = left; - colors[ Qsk::Top ] = top; - colors[ Qsk::Right ] = right; - colors[ Qsk::Bottom ] = bottom; + gradients[ Qsk::Left ] = left; + gradients[ Qsk::Top ] = top; + gradients[ Qsk::Right ] = right; + gradients[ Qsk::Bottom ] = bottom; } QskBoxBorderColors::QskBoxBorderColors() diff --git a/src/nodes/QskBoxRendererEllipse.cpp b/src/nodes/QskBoxRendererEllipse.cpp index b63b3cc8..b26b587b 100644 --- a/src/nodes/QskBoxRendererEllipse.cpp +++ b/src/nodes/QskBoxRendererEllipse.cpp @@ -621,10 +621,12 @@ namespace c[ corner ].centerY - v.dy1( corner ), c[ corner ].centerX - v.dx2( corner ), c[ corner ].centerY - v.dy2( corner ), - borderMapBL.colorAt( j ) ); -// Color( 255, 255, 0, 255 ) ); +// borderMapTL.colorAt( j ) ); + Color( 255, 0, 0, 255 ) ); } + // ### maybe here check whether gradient isn't monochrome and add lines? + { constexpr auto corner = TopRight; @@ -644,8 +646,8 @@ namespace c[ corner ].centerY + v.dy1( corner ), c[ corner ].centerX - v.dx2( corner ), c[ corner ].centerY + v.dy2( corner ), - borderMapBL.colorAt( k ) ); -// Color( 255, 255, 0, 255 ) ); +// borderMapBL.colorAt( k ) ); + Color( 255, 255, 0, 255 ) ); } { @@ -1235,7 +1237,7 @@ void QskBoxRenderer::renderRectellipse( const QRectF& rect, + colorsInGradient( borderColors.gradient( Qsk::Right ) ) - 1 + colorsInGradient( borderColors.gradient( Qsk::Bottom ) ) - 1; - qDebug() << "additional lines:" << additionalLines; + qDebug() << "additional lines:" << additionalLines << borderColors.gradientAt(Qt::LeftEdge).stops(); borderLineCount += additionalLines; }