2022-12-03 17:19:07 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
2023-04-06 09:23:37 +02:00
|
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
2022-12-03 17:19:07 +01:00
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#include "GeometricShape.h"
|
|
|
|
#include "Stroke.h"
|
|
|
|
|
|
|
|
#include <SkinnyShapeFactory.h>
|
|
|
|
|
|
|
|
GeometricShape::GeometricShape( QQuickItem* parent )
|
|
|
|
: ShapeItem( parent )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
GeometricShape::GeometricShape( Figure figure, QQuickItem* parent )
|
|
|
|
: GeometricShape( parent )
|
|
|
|
{
|
|
|
|
setFigure( figure );
|
|
|
|
}
|
|
|
|
|
|
|
|
void GeometricShape::setFigure( Figure figure )
|
|
|
|
{
|
|
|
|
m_figure = figure;
|
|
|
|
|
|
|
|
using namespace SkinnyShapeFactory;
|
|
|
|
setPath( shapePath( static_cast< Shape >( figure ), QSizeF( 50, 50 ) ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
GeometricShape::Figure GeometricShape::figure() const
|
|
|
|
{
|
|
|
|
return m_figure;
|
|
|
|
}
|
|
|
|
|
|
|
|
void GeometricShape::setBorder( const QColor& color )
|
|
|
|
{
|
|
|
|
Stroke stroke( color );
|
|
|
|
#if 0
|
|
|
|
stroke.setCosmetic( true );
|
|
|
|
#endif
|
|
|
|
|
|
|
|
stroke.setWidth( stroke.isCosmetic() ? 8 : 2 );
|
|
|
|
stroke.setJoinStyle( Stroke::MiterJoin );
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
stroke.setLineStyle( Stroke::DashLine );
|
|
|
|
stroke.setColor( QskRgb::toTransparent( color, 100 ) );
|
|
|
|
#endif
|
|
|
|
setStroke( stroke );
|
|
|
|
}
|
|
|
|
|
|
|
|
QColor GeometricShape::border() const
|
|
|
|
{
|
|
|
|
return stroke().color();
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "moc_GeometricShape.cpp"
|