KDStateMachineEditor API Documentation 2.1
Loading...
Searching...
No Matches
quickpainterpath_p.h
Go to the documentation of this file.
1/*
2 This file is part of the KDAB State Machine Editor Library.
3
4 SPDX-FileCopyrightText: 2015 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
5 Author: Kevin Funk <kevin.funk@kdab.com>
6
7 SPDX-License-Identifier: LGPL-2.1-only OR LicenseRef-KDAB-KDStateMachineEditor
8
9 Licensees holding valid commercial KDAB State Machine Editor Library
10 licenses may use this file in accordance with the KDAB State Machine Editor
11 Library License Agreement provided with the Software.
12
13 Contact info@kdab.com if any conditions of this licensing are not clear to you.
14*/
15
16#ifndef KDSME_QUICK_QUICKPAINTERPATH_P_H
17#define KDSME_QUICK_QUICKPAINTERPATH_P_H
18
21
22#include <QObject>
23#include <QPainterPath>
24
25QT_BEGIN_NAMESPACE
26class QPoint;
27QT_END_NAMESPACE
28
29class QuickPainterPathStroker : public QObject
30{
31 Q_OBJECT
32 Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged)
33
34public:
35 explicit QuickPainterPathStroker(QObject *parent = nullptr);
36
37 qreal width() const;
38 void setWidth(qreal width);
39
40 Q_INVOKABLE QPainterPath createStroke(const QPainterPath &path) const;
41
42Q_SIGNALS:
43 void widthChanged(qreal width);
44
45private:
46 QPainterPathStroker m_stroker;
47};
48
49class QuickPainterPath : public QObject
50{
51 Q_OBJECT
52 Q_PROPERTY(QPainterPath path READ path WRITE setPath NOTIFY pathChanged)
53 Q_PROPERTY(QPointF startPoint READ startPoint NOTIFY startPointChanged)
54 Q_PROPERTY(QPointF endPoint READ endPoint NOTIFY endPointChanged)
55 Q_PROPERTY(bool isEmpty READ isEmpty NOTIFY isEmptyChanged)
56
57public:
58 explicit QuickPainterPath(QObject *parent = nullptr);
59
60 QPainterPath path() const;
61 void setPath(const QPainterPath &path);
62
63 QPointF startPoint() const;
64 QPointF endPoint() const;
65 bool isEmpty() const;
66
67 // BEGIN: Replicating QPainterPath API
68 Q_INVOKABLE void moveTo(QPointF point);
69 Q_INVOKABLE void lineTo(QPointF endPoint);
70 Q_INVOKABLE void clear();
71
72 Q_INVOKABLE bool contains(QPointF point) const;
73 Q_INVOKABLE qreal angleAtPercent(qreal t) const;
74 // END
75
76Q_SIGNALS:
77 void pathChanged(const QPainterPath &path);
78 void startPointChanged(const QPointF &startPoint);
79 void endPointChanged(const QPointF &endPoint);
81
82private:
83 void updateState(const QPainterPath &path);
84
85 QPainterPath m_path;
86
87 QPointF m_startPoint;
88 QPointF m_endPoint;
89 bool m_isEmpty;
90};
91
93{
94 Q_OBJECT
95
96 Q_PROPERTY(QPainterPath path READ path WRITE setPath NOTIFY pathChanged)
97
98public:
99 explicit QuickPainterPathGeometryItem(QQuickItem *parent = nullptr);
100
101 QPainterPath path() const;
102 void setPath(const QPainterPath &path);
103
104Q_SIGNALS:
105 void pathChanged(const QPainterPath &path);
106
107private:
108 void updateData();
109
110 QOpenGL2PEXVertexArray m_vertexCoordinates;
111 QPainterPath m_path;
112};
113
114#endif // QUICKPAINTERPATH_P_H
void pathChanged(const QPainterPath &path)
Q_INVOKABLE QPainterPath createStroke(const QPainterPath &path) const
void widthChanged(qreal width)
Q_INVOKABLE qreal angleAtPercent(qreal t) const
Q_INVOKABLE void lineTo(QPointF endPoint)
Q_INVOKABLE void clear()
void pathChanged(const QPainterPath &path)
void startPointChanged(const QPointF &startPoint)
void endPointChanged(const QPointF &endPoint)
void isEmptyChanged(bool isEmpty)
Q_INVOKABLE void moveTo(QPointF point)
Q_INVOKABLE bool contains(QPointF point) const
void setPath(const QPainterPath &path)

© Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
KDStateMachineEditor
Create Qt State Machine metacode using a graphical user interface
https://github.com/KDAB/KDStateMachineEditor
Generated on Tue Jul 15 2025 15:21:47 for KDStateMachineEditor API Documentation by doxygen 1.9.8