code reorganized

This commit is contained in:
Uwe Rathmann 2024-06-12 12:40:33 +02:00
parent 69098643ff
commit 194edf8866
3 changed files with 31 additions and 26 deletions

View File

@ -73,32 +73,36 @@ namespace
}
}
};
class Arc : public ShadowedArc
{
public:
Arc()
{
setStartAngle( 45.0 );
setSpanAngle( 270.0 );
setThickness( 10.0 );
setFillGradient( Qt::darkRed );
setBorderWidth( 0 );
setBorderColor( Qt::darkYellow );
setShadowColor( Qt::black );
setSpreadRadius( 0.0 );
setBlurRadius( 4.0 );
setOffsetX( 2.0 );
setOffsetY( 2.0 );
}
};
}
ArcPage::ArcPage( QQuickItem* parent )
: QskLinearBox( Qt::Vertical, parent )
{
auto arc = new ShadowedArc();
auto arc = new Arc();
arc->setMargins( 40 ); // some extra space for testing the offsets
{
// initial settings
arc->setStartAngle( 45.0 );
arc->setSpanAngle( 270.0 );
arc->setThickness( 10.0 );
arc->setFillColor( Qt::darkRed );
arc->setBorderWidth( 0 );
arc->setBorderColor( Qt::darkYellow );
arc->setShadowColor( Qt::black );
arc->setSpreadRadius( 0.0 );
arc->setBlurRadius( 4.0 );
arc->setOffsetX( 2.0 );
arc->setOffsetY( 2.0 );
}
auto panel = new ControlPanel( arc );
panel->setSizePolicy( Qt::Vertical, QskSizePolicy::Fixed );

View File

@ -101,7 +101,7 @@ ShadowedArc::ShadowedArc( QQuickItem* parent )
setArcMetrics( { 0.0, 360.0, 1.0, Qt::RelativeSize } );
setFillColor( Qt::darkRed );
setFillGradient( Qt::darkRed );
setBorderWidth( 0 );
setBorderColor( Qt::gray );
@ -216,14 +216,14 @@ qreal ShadowedArc::blurRadius() const
return shadowMetrics().blurRadius();
}
void ShadowedArc::setFillColor( const QColor& color )
void ShadowedArc::setFillGradient( const QskGradient& gradient )
{
setColor( Arc, color );
setGradientHint( Arc, gradient );
}
QColor ShadowedArc::fillColor() const
QskGradient ShadowedArc::fillGradient() const
{
return color( Arc );
return gradientHint( Arc );
}
void ShadowedArc::setShadowColor( const QColor& color )

View File

@ -9,6 +9,7 @@
class QskShadowMetrics;
class QskArcMetrics;
class QskGradient;
class ShadowedArc : public QskControl
{
@ -35,7 +36,7 @@ class ShadowedArc : public QskControl
qreal blurRadius() const;
QColor borderColor() const;
QColor fillColor() const;
QskGradient fillGradient() const;
QColor shadowColor() const;
public Q_SLOTS:
@ -52,7 +53,7 @@ class ShadowedArc : public QskControl
void setBlurRadius( qreal );
void setBorderColor( const QColor& );
void setFillColor( const QColor& );
void setFillGradient( const QskGradient& );
void setShadowColor( const QColor& );
private: