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 STROKELISTITEM_H 0006 #define STROKELISTITEM_H 0007 0008 #include <memory> 0009 0010 #include <QImage> 0011 #include <QQuickPaintedItem> 0012 0013 #include "stroke.h" 0014 #include "sketchmodel.h" 0015 0016 class StrokeListItem : public QQuickPaintedItem 0017 { 0018 Q_OBJECT 0019 Q_PROPERTY(Stroke::Type type READ type WRITE setType NOTIFY typeChanged) 0020 Q_PROPERTY(SketchModel* model READ model WRITE setModel NOTIFY modelChanged) 0021 public: 0022 explicit StrokeListItem(QQuickItem *parent = nullptr); 0023 0024 Q_INVOKABLE void addStroke(const Stroke &stroke); 0025 Q_INVOKABLE void eraseArea(const QVector2D ¢er, float radius); 0026 0027 void paint(QPainter *painter) override; 0028 0029 Stroke::Type type() const; 0030 SketchModel *model() const; 0031 0032 public slots: 0033 void setType(Stroke::Type type); 0034 void setModel(SketchModel *model); 0035 0036 signals: 0037 void typeChanged(Stroke::Type type); 0038 void modelChanged(SketchModel *model); 0039 0040 private: 0041 Stroke::Type m_type = Stroke::Type::Outline; 0042 SketchModel *m_model = nullptr; 0043 }; 0044 0045 #endif // STROKELISTITEM_H