![Peter Hartmann](/assets/img/avatar_default.png)
* add QskArcNode and QskArcRenderer * IOT example: Use QskArcNode instead of own arc node * move some functionality to the arc renderer * add QskArcMetrics * add methods to QskSkinlet * remove circular bar graph node We can now use updateArcNode() and don't need our own method. * support linear gradients in the arc renderer * clean up * incorporate Uwe's changes * add overloads for updateArcNode() when the angles are set dynamically The angles don't always come from the style, so we need overloads in QskSkinlet to set them dynamically.
53 lines
1.5 KiB
C++
53 lines
1.5 KiB
C++
/******************************************************************************
|
|
* QSkinny - Copyright (C) 2021 Uwe Rathmann
|
|
* This file may be used under the terms of the QSkinny License, Version 1.0
|
|
*****************************************************************************/
|
|
|
|
#include "CircularProgressBarSkinlet.h"
|
|
#include "CircularProgressBar.h"
|
|
|
|
#include <QskPaintedNode.h>
|
|
|
|
#include <QEasingCurve>
|
|
#include <QPainter>
|
|
|
|
CircularProgressBarSkinlet::CircularProgressBarSkinlet( QskSkin* skin )
|
|
: QskSkinlet( skin )
|
|
{
|
|
setNodeRoles( { GrooveRole, BarRole } );
|
|
}
|
|
|
|
CircularProgressBarSkinlet::~CircularProgressBarSkinlet()
|
|
{
|
|
}
|
|
|
|
QRectF CircularProgressBarSkinlet::subControlRect(
|
|
const QskSkinnable*, const QRectF& contentsRect, QskAspect::Subcontrol ) const
|
|
{
|
|
return contentsRect;
|
|
}
|
|
|
|
QSGNode* CircularProgressBarSkinlet::updateSubNode(
|
|
const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node ) const
|
|
{
|
|
switch( nodeRole )
|
|
{
|
|
case GrooveRole:
|
|
{
|
|
return updateArcNode( skinnable, node, CircularProgressBar::Groove );
|
|
}
|
|
case BarRole:
|
|
{
|
|
const qreal startAngle = 90 * 16;
|
|
const auto bar = static_cast< const CircularProgressBar* >( skinnable );
|
|
const qreal spanAngle = bar->valueAsRatio() * -5760;
|
|
return updateArcNode( skinnable, node, startAngle, spanAngle,
|
|
CircularProgressBar::Bar );
|
|
}
|
|
}
|
|
|
|
return Inherited::updateSubNode( skinnable, nodeRole, node );
|
|
}
|
|
|
|
#include "moc_CircularProgressBarSkinlet.cpp"
|