some helper stuff and missing stuff

This commit is contained in:
Peter Hartmann 2022-01-11 09:37:24 +01:00
parent a272214e8d
commit 4da45d5606
3 changed files with 32 additions and 16 deletions

View File

@ -420,8 +420,9 @@ static void addColoredBorderRectangles6( QskLinearBox* parent )
{ 0.7, Qt::white }, { 0.7, Qt::white },
{ 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::red, Qt::blue );
box->setBorderGradients( gradient3, gradient3, gradient3, gradient4 ); box->setBorderGradients( gradient4, gradient3, gradient3, gradient3 );
qDebug() << "@@@ hint:" << gradient4.stops() << box->boxBorderColorsHint( QskBox::Panel ).gradientAt(Qt::LeftEdge).stops();
box->setShape( 30, Qt::AbsoluteSize ); box->setShape( 30, Qt::AbsoluteSize );
} }
@ -501,10 +502,20 @@ int main( int argc, char* argv[] )
SkinnyFont::init( &app ); SkinnyFont::init( &app );
SkinnyShortcut::enable( SkinnyShortcut::Quit | SkinnyShortcut::DebugShortcuts ); 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; QskWindow window;
window.addItem( tabView ); window.addItem( tab5 );
window.resize( 600, 600 ); window.resize( 600, 600 );
window.show(); window.show();

View File

@ -15,23 +15,26 @@ static void qskRegisterBoxBorderColors()
QMetaType::registerConverter< QColor, QskBoxBorderColors >( QMetaType::registerConverter< QColor, QskBoxBorderColors >(
[]( const QColor& color ) { return QskBoxBorderColors( color ); } ); []( const QColor& color ) { return QskBoxBorderColors( color ); } );
QMetaType::registerConverter< QskGradient, QskBoxBorderColors >(
[]( const QskGradient& gradient ) { return QskBoxBorderColors( gradient ); } );
} }
Q_CONSTRUCTOR_FUNCTION( qskRegisterBoxBorderColors ) 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( static inline void qskSetGradients(
const QskGradient& left, const QskGradient& top, 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; gradients[ Qsk::Left ] = left;
colors[ Qsk::Top ] = top; gradients[ Qsk::Top ] = top;
colors[ Qsk::Right ] = right; gradients[ Qsk::Right ] = right;
colors[ Qsk::Bottom ] = bottom; gradients[ Qsk::Bottom ] = bottom;
} }
QskBoxBorderColors::QskBoxBorderColors() QskBoxBorderColors::QskBoxBorderColors()

View File

@ -621,10 +621,12 @@ namespace
c[ corner ].centerY - v.dy1( corner ), c[ corner ].centerY - v.dy1( corner ),
c[ corner ].centerX - v.dx2( corner ), c[ corner ].centerX - v.dx2( corner ),
c[ corner ].centerY - v.dy2( corner ), c[ corner ].centerY - v.dy2( corner ),
borderMapBL.colorAt( j ) ); // borderMapTL.colorAt( j ) );
// Color( 255, 255, 0, 255 ) ); Color( 255, 0, 0, 255 ) );
} }
// ### maybe here check whether gradient isn't monochrome and add lines?
{ {
constexpr auto corner = TopRight; constexpr auto corner = TopRight;
@ -644,8 +646,8 @@ namespace
c[ corner ].centerY + v.dy1( corner ), c[ corner ].centerY + v.dy1( corner ),
c[ corner ].centerX - v.dx2( corner ), c[ corner ].centerX - v.dx2( corner ),
c[ corner ].centerY + v.dy2( corner ), c[ corner ].centerY + v.dy2( corner ),
borderMapBL.colorAt( k ) ); // borderMapBL.colorAt( k ) );
// Color( 255, 255, 0, 255 ) ); 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::Right ) ) - 1
+ colorsInGradient( borderColors.gradient( Qsk::Bottom ) ) - 1; + colorsInGradient( borderColors.gradient( Qsk::Bottom ) ) - 1;
qDebug() << "additional lines:" << additionalLines; qDebug() << "additional lines:" << additionalLines << borderColors.gradientAt(Qt::LeftEdge).stops();
borderLineCount += additionalLines; borderLineCount += additionalLines;
} }