qskinny/playground/shapes/ShapeItem.h

56 lines
1.4 KiB
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
#include <QskControl.h>
class Stroke;
class QskGradient;
class QPainterPath;
2022-09-26 17:51:28 +02:00
class ShapeItem : public QskControl
{
Q_OBJECT
Q_PROPERTY( Stroke stroke READ stroke WRITE setStroke
RESET resetStroke NOTIFY strokeChanged )
Q_PROPERTY( QskGradient gradient READ gradient WRITE setGradient
RESET resetGradient NOTIFY gradientChanged )
Q_PROPERTY( QPainterPath path READ path WRITE setPath
RESET resetPath NOTIFY pathChanged )
2022-09-26 17:51:28 +02:00
public:
ShapeItem( QQuickItem* parent = nullptr );
~ShapeItem() override;
Stroke stroke() const;
void setStroke( const Stroke& );
void setStroke( const QColor&, qreal width = 1.0 );
void resetStroke();
2022-09-26 17:51:28 +02:00
QskGradient gradient() const;
2022-10-31 14:42:08 +01:00
void setGradient( const QskGradient& );
void resetGradient();
2022-09-26 17:51:28 +02:00
QPainterPath path() const;
void setPath( const QPainterPath& );
void resetPath();
Q_SIGNALS:
void strokeChanged( const Stroke& );
void gradientChanged( const QskGradient& );
void pathChanged( const QPainterPath& );
2022-09-26 17:51:28 +02:00
protected:
void updateNode( QSGNode* ) override;
private:
class PrivateData;
std::unique_ptr< PrivateData > m_data;
2022-09-26 17:51:28 +02:00
};