File indexing completed on 2024-05-05 12:59:56
0001 // This file is part of Washi Pad 0002 // SPDX-FileCopyrightText: 2018 Kevin Ottens <ervin@kde.org> 0003 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0004 0005 #ifndef STROKEITEM_H 0006 #define STROKEITEM_H 0007 0008 #include <QQuickPaintedItem> 0009 0010 #include "stroke.h" 0011 0012 class StrokeItem : public QQuickPaintedItem 0013 { 0014 Q_OBJECT 0015 Q_PROPERTY(Stroke stroke READ stroke WRITE setStroke NOTIFY strokeChanged) 0016 public: 0017 explicit StrokeItem(QQuickItem *parent = nullptr); 0018 0019 Stroke stroke() const; 0020 void setStroke(const Stroke &stroke); 0021 0022 Q_INVOKABLE void addSample(const StrokeSample &sample); 0023 0024 void paint(QPainter *painter) override; 0025 0026 signals: 0027 void strokeChanged(const Stroke &stroke); 0028 0029 private: 0030 Stroke m_stroke; 0031 }; 0032 0033 #endif // STROKEITEM_H