Krita Source Code Documentation
Loading...
Searching...
No Matches
KoShapeQtQuickLabel.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2024 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6#ifndef KOSHAPEQTQUICKLABEL_H
7#define KOSHAPEQTQUICKLABEL_H
8
9#include <QQuickPaintedItem>
10
17class KoShapeQtQuickLabel: public QQuickPaintedItem
18{
19 Q_OBJECT
20 Q_PROPERTY(QString svgData READ svgData WRITE setSvgData NOTIFY svgDataChanged)
22 Q_PROPERTY(int padding READ padding WRITE setPadding NOTIFY paddingChanged)
23 Q_PROPERTY(bool fullColor READ fullColor WRITE setFullColor NOTIFY fullColorChanged)
25 Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged)
26 Q_PROPERTY(QRectF documentRect READ documentRect WRITE setDocumentRect NOTIFY documentRectChanged)
27 Q_PROPERTY(QRectF minimumRect READ minimumRect NOTIFY minimumRectChanged)
28
29 QML_NAMED_ELEMENT(KoShapeQtQuickLabel)
30public:
31 KoShapeQtQuickLabel(QQuickItem *parent = nullptr);
33
39 Q_ENUM(ScalingType)
40
41 // QQuickPaintedItem interface
42public:
43 void paint(QPainter *painter) override;
44 QString svgData() const;
45 void setSvgData(const QString &newSvgData);
46
51 QColor foregroundColor() const;
52 void setForegroundColor(const QColor &newForegroundColor);
53
59 int padding() const;
60 void setPadding(int newPadding);
61
67 bool fullColor() const;
68 void setFullColor(bool newFullColor);
69
75 void setScalingType(const ScalingType type);
76
81 Qt::Alignment alignment() const;
82 void setAlignment(const Qt::Alignment align);
83
88 QRectF documentRect() const;
89 void setDocumentRect(const QRectF &rect);
90
98 QRectF minimumRect() const;
99
100 void componentComplete() override;
101
102Q_SIGNALS:
104
106
108
110
112
114
116
118
120
121private Q_SLOTS:
122 void updateShapes();
123
125
126private:
127 struct Private;
128 const QScopedPointer<Private> d;
129};
130
131#endif // KOSHAPEQTQUICKLABEL_H
The KoShapeQtQuickLabel class.
@ FitWidth
Scale document view to document width. Use alignment to position top or bottom on the document.
@ Fit
Default koshapepainter behaviour, fit whole document into widget bounds.
@ FitHeight
Scale document view to document height. Use alignment to position left or right on the document.
void setPadding(int newPadding)
void foregroundColorChanged()
void setForegroundColor(const QColor &newForegroundColor)
void paint(QPainter *painter) override
void setSvgData(const QString &newSvgData)
void setAlignment(const Qt::Alignment align)
void setFullColor(bool newFullColor)
void setScalingType(const ScalingType type)
const QScopedPointer< Private > d
void componentComplete() override
void setDocumentRect(const QRectF &rect)