qskinny/playground/shapes/ShapeItem.h

40 lines
922 B
C
Raw Normal View History

2022-09-26 17:51:28 +02:00
/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* This file may be used under the terms of the 3-clause BSD License
*****************************************************************************/
#pragma once
2022-10-31 14:42:08 +01:00
#include <QskGradient.h>
2022-09-26 17:51:28 +02:00
#include <QskControl.h>
#include <QPen>
#include <QPainterPath>
2022-09-26 17:51:28 +02:00
class ShapeItem : public QskControl
{
Q_OBJECT
public:
ShapeItem( QQuickItem* parent = nullptr );
~ShapeItem() override;
void setPen( const QPen& );
QPen pen() const;
2022-10-31 14:42:08 +01:00
void setGradient( const QskGradient& );
const QskGradient& gradient() const;
2022-09-26 17:51:28 +02:00
void setPath( const QPainterPath& );
QPainterPath path() const;
protected:
void updateNode( QSGNode* ) override;
private:
2022-09-27 15:06:44 +02:00
QPainterPath scaledPath( const QRectF& ) const;
2022-09-26 17:51:28 +02:00
QPen m_pen;
2022-10-31 14:42:08 +01:00
QskGradient m_gradient;
2022-09-26 17:51:28 +02:00
QPainterPath m_path;
};