diff --git a/examples/iotdashboard/CircularProgressBarSkinlet.cpp b/examples/iotdashboard/CircularProgressBarSkinlet.cpp index d8bdece1..b2902d6e 100644 --- a/examples/iotdashboard/CircularProgressBarSkinlet.cpp +++ b/examples/iotdashboard/CircularProgressBarSkinlet.cpp @@ -6,7 +6,6 @@ #include "CircularProgressBarSkinlet.h" #include "CircularProgressBar.h" -#include #include #include @@ -42,7 +41,6 @@ QSGNode* CircularProgressBarSkinlet::updateSubNode( } case BarRole: { - const auto subControl = CircularProgressBar::Bar; return updateArcNode( skinnable, node, CircularProgressBar::Bar, bar->window() ); } diff --git a/examples/iotdashboard/Skin.cpp b/examples/iotdashboard/Skin.cpp index 7d05d61c..f803eabb 100644 --- a/examples/iotdashboard/Skin.cpp +++ b/examples/iotdashboard/Skin.cpp @@ -116,6 +116,8 @@ void Skin::initHints( const Palette& palette ) // the bar gradient is defined through the top bar items above ed.setArcMetrics( CircularProgressBar::Groove, { 8.53, 90 * 16, -360 * 16 } ); + // the span angle will be set in the progress bar, we just give a dummy + // value here: ed.setArcMetrics( CircularProgressBar::Bar, { 8.53, 90 * 16, -180 * 16 } ); ed.setFontRole( TimeTitleLabel::Text, Skin::TitleFont ); diff --git a/src/common/QskArcMetrics.cpp b/src/common/QskArcMetrics.cpp index 7729bf59..7e68b553 100644 --- a/src/common/QskArcMetrics.cpp +++ b/src/common/QskArcMetrics.cpp @@ -1,5 +1,5 @@ /****************************************************************************** - * QSkinny - Copyright (C) 2016 Uwe Rathmann + * QSkinny - Copyright (C) 2021 Uwe Rathmann * This file may be used under the terms of the QSkinny License, Version 1.0 *****************************************************************************/ @@ -110,8 +110,8 @@ QDebug operator<<( QDebug debug, const QskArcMetrics& metrics ) debug << "Arc" << '('; debug << "width:" << metrics.width(); - debug << "start angle:" << metrics.startAngle(); - debug << "span angle:" << metrics.spanAngle(); + debug << ", start angle:" << metrics.startAngle(); + debug << ", span angle:" << metrics.spanAngle(); debug << ", size mode:" << metrics.sizeMode(); debug << ')'; diff --git a/src/common/QskArcMetrics.h b/src/common/QskArcMetrics.h index 4678d714..19a29287 100644 --- a/src/common/QskArcMetrics.h +++ b/src/common/QskArcMetrics.h @@ -1,5 +1,5 @@ /****************************************************************************** - * QSkinny - Copyright (C) 2016 Uwe Rathmann + * QSkinny - Copyright (C) 2021 Uwe Rathmann * This file may be used under the terms of the QSkinny License, Version 1.0 *****************************************************************************/ diff --git a/src/controls/QskSkinHintTableEditor.cpp b/src/controls/QskSkinHintTableEditor.cpp index 7eb12f46..8671993c 100644 --- a/src/controls/QskSkinHintTableEditor.cpp +++ b/src/controls/QskSkinHintTableEditor.cpp @@ -474,11 +474,11 @@ QskBoxBorderColors QskSkinHintTableEditor::boxBorderColors( QskAspect aspect ) c return colorHint< QskBoxBorderColors >( aspectBorder( aspect ) ); } -void QskSkinHintTableEditor::setArcMetrics( QskAspect aspect, qreal startAngle, - qreal endAngle, qreal width, Qt::SizeMode sizeMode ) +void QskSkinHintTableEditor::setArcMetrics( QskAspect aspect, qreal width, + int startAngle, int spanAngle, Qt::SizeMode sizeMode ) { setMetricHint( aspectArc( aspect ), - QskArcMetrics( startAngle, endAngle, width, sizeMode ) ); + QskArcMetrics( width, startAngle, spanAngle, sizeMode ) ); } void QskSkinHintTableEditor::setArcMetrics( QskAspect aspect, diff --git a/src/controls/QskSkinHintTableEditor.h b/src/controls/QskSkinHintTableEditor.h index e0bc0749..8b991321 100644 --- a/src/controls/QskSkinHintTableEditor.h +++ b/src/controls/QskSkinHintTableEditor.h @@ -223,8 +223,8 @@ class QSK_EXPORT QskSkinHintTableEditor // arcMetrics - void setArcMetrics( QskAspect, - qreal, qreal, qreal, Qt::SizeMode = Qt::AbsoluteSize ); + void setArcMetrics( QskAspect, qreal, int, int, + Qt::SizeMode = Qt::AbsoluteSize ); void setArcMetrics( QskAspect, const QskArcMetrics&, QskStateCombination = QskStateCombination() ); diff --git a/src/controls/QskSkinlet.cpp b/src/controls/QskSkinlet.cpp index cf2a0891..75e7cede 100644 --- a/src/controls/QskSkinlet.cpp +++ b/src/controls/QskSkinlet.cpp @@ -344,6 +344,7 @@ QSGNode* QskSkinlet::updateArcNode( const QskSkinnable* skinnable, const auto margins = skinnable->marginHint( subControl ); const auto arcRect = rect.marginsRemoved( margins ); + if ( arcRect.isEmpty() ) return nullptr; diff --git a/src/nodes/QskArcNode.cpp b/src/nodes/QskArcNode.cpp index 54b7370b..69a7d6c0 100644 --- a/src/nodes/QskArcNode.cpp +++ b/src/nodes/QskArcNode.cpp @@ -1,13 +1,11 @@ /********************************************************************** - * QSkinny - Copyright (C) 2016 Uwe Rathmann + * QSkinny - Copyright (C) 2021 Uwe Rathmann * This file may be used under the terms of the QSkinny License, Version 1.0 *****************************************************************************/ #include "QskArcNode.h" #include "QskArcRenderer.h" -#include - QskArcNode::QskArcNode() { } @@ -19,11 +17,10 @@ QskArcNode::~QskArcNode() void QskArcNode::setArcData( const QRectF& rect, const QskArcMetrics& metrics, const QskGradient &gradient, QQuickWindow* window ) { - m_rect = rect; m_metrics = metrics; m_gradient = gradient; - update( window, QskTextureRenderer::AutoDetect, m_rect.toRect() ); + update( window, QskTextureRenderer::AutoDetect, rect.toRect() ); } void QskArcNode::paint( QPainter* painter, const QSizeF &size ) diff --git a/src/nodes/QskArcNode.h b/src/nodes/QskArcNode.h index ac981a41..5a2a013a 100644 --- a/src/nodes/QskArcNode.h +++ b/src/nodes/QskArcNode.h @@ -1,5 +1,5 @@ /********************************************************************** - * QSkinny - Copyright (C) 2016 Uwe Rathmann + * QSkinny - Copyright (C) 2021 Uwe Rathmann * This file may be used under the terms of the QSkinny License, Version 1.0 *****************************************************************************/ @@ -23,7 +23,6 @@ class QSK_EXPORT QskArcNode : public QskPaintedNode uint hash() const override; private: - QRectF m_rect; QskArcMetrics m_metrics; QskGradient m_gradient; }; diff --git a/src/nodes/QskArcRenderer.h b/src/nodes/QskArcRenderer.h index 3a2d7f7d..96e4c066 100644 --- a/src/nodes/QskArcRenderer.h +++ b/src/nodes/QskArcRenderer.h @@ -1,5 +1,5 @@ /****************************************************************************** - * QSkinny - Copyright (C) 2016 Uwe Rathmann + * QSkinny - Copyright (C) 2021 Uwe Rathmann * This file may be used under the terms of the QSkinny License, Version 1.0 *****************************************************************************/