qskinny/playground/shapes/ShapeItem.h

56 lines
1.4 KiB
C
Raw Normal View History

2022-09-26 17:51:28 +02:00
/******************************************************************************
2024-01-17 14:31:45 +01:00
* QSkinny - Copyright (C) The authors
2023-04-06 09:23:37 +02:00
* SPDX-License-Identifier: BSD-3-Clause
2022-09-26 17:51:28 +02:00
*****************************************************************************/
#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
};