2022-05-13 13:12:05 +00:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2011-11-16 14:39:45 +00:00
|
|
|
|
2012-07-30 09:09:23 +00:00
|
|
|
#ifndef BEZIERCURVE_H
|
|
|
|
#define BEZIERCURVE_H
|
2011-11-16 14:39:45 +00:00
|
|
|
|
2012-07-30 09:09:23 +00:00
|
|
|
//! [1]
|
Say hello to QtQuick module
This change moves the QtQuick 2 types and C++ API (including
SceneGraph) to a new module (AKA library), QtQuick.
99% of this change is moving files from src/declarative to
src/quick, and from tests/auto/declarative to
tests/auto/qtquick2.
The loading of QtQuick 2 ("import QtQuick 2.0") is now delegated to
a plugin, src/imports/qtquick2, just like it's done for QtQuick 1.
All tools, examples, and tests that use QtQuick C++ API have gotten
"QT += quick" or "QT += quick-private" added to their .pro file.
A few additional internal QtDeclarative classes had to be exported
(via Q_DECLARATIVE_PRIVATE_EXPORT) since they're needed by the
QtQuick 2 implementation.
The old header locations (e.g. QtDeclarative/qquickitem.h) will
still be supported for some time, but will produce compile-time
warnings. (To avoid the QtQuick implementation using the
compatibility headers (since QtDeclarative's includepath comes
first), a few include statements were modified, e.g. from
"#include <qsgnode.h>" to "#include <QtQuick/qsgnode.h>".)
There's a change in qtbase that automatically adds QtQuick to the
module list if QtDeclarative is used. Together with the compatibility
headers, this should help reduce the migration pain for existing
projects.
In theory, simply getting an existing QtDeclarative-based project
to compile and link shouldn't require any changes for now -- but
porting to the new scheme is of course recommended, and will
eventually become mandatory.
Task-number: QTBUG-22889
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Change-Id: Ia52be9373172ba2f37e7623231ecb060316c96a7
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
2011-11-23 14:14:07 +00:00
|
|
|
#include <QtQuick/QQuickItem>
|
2011-11-16 14:39:45 +00:00
|
|
|
|
2012-07-30 09:09:23 +00:00
|
|
|
class BezierCurve : public QQuickItem
|
2011-11-16 14:39:45 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2012-07-30 09:09:23 +00:00
|
|
|
Q_PROPERTY(QPointF p1 READ p1 WRITE setP1 NOTIFY p1Changed)
|
|
|
|
Q_PROPERTY(QPointF p2 READ p2 WRITE setP2 NOTIFY p2Changed)
|
|
|
|
Q_PROPERTY(QPointF p3 READ p3 WRITE setP3 NOTIFY p3Changed)
|
|
|
|
Q_PROPERTY(QPointF p4 READ p4 WRITE setP4 NOTIFY p4Changed)
|
|
|
|
|
|
|
|
Q_PROPERTY(int segmentCount READ segmentCount WRITE setSegmentCount NOTIFY segmentCountChanged)
|
2019-09-12 15:03:52 +00:00
|
|
|
//! [3]
|
2019-08-21 16:34:21 +00:00
|
|
|
QML_ELEMENT
|
2019-09-12 15:03:52 +00:00
|
|
|
//! [3]
|
2011-11-16 14:39:45 +00:00
|
|
|
|
|
|
|
public:
|
2021-06-30 09:28:32 +00:00
|
|
|
BezierCurve(QQuickItem *parent = nullptr);
|
2012-07-30 09:09:23 +00:00
|
|
|
~BezierCurve();
|
|
|
|
|
|
|
|
//! [2]
|
2021-06-30 09:31:03 +00:00
|
|
|
QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;
|
2012-07-30 09:09:23 +00:00
|
|
|
//! [2]
|
|
|
|
|
|
|
|
QPointF p1() const { return m_p1; }
|
|
|
|
QPointF p2() const { return m_p2; }
|
|
|
|
QPointF p3() const { return m_p3; }
|
|
|
|
QPointF p4() const { return m_p4; }
|
2011-11-16 14:39:45 +00:00
|
|
|
|
2012-07-30 09:09:23 +00:00
|
|
|
int segmentCount() const { return m_segmentCount; }
|
2011-11-16 14:39:45 +00:00
|
|
|
|
2012-07-30 09:09:23 +00:00
|
|
|
void setP1(const QPointF &p);
|
|
|
|
void setP2(const QPointF &p);
|
|
|
|
void setP3(const QPointF &p);
|
|
|
|
void setP4(const QPointF &p);
|
|
|
|
|
|
|
|
void setSegmentCount(int count);
|
2011-11-16 14:39:45 +00:00
|
|
|
|
|
|
|
signals:
|
2012-07-30 09:09:23 +00:00
|
|
|
void p1Changed(const QPointF &p);
|
|
|
|
void p2Changed(const QPointF &p);
|
|
|
|
void p3Changed(const QPointF &p);
|
|
|
|
void p4Changed(const QPointF &p);
|
2011-11-16 14:39:45 +00:00
|
|
|
|
2012-07-30 09:09:23 +00:00
|
|
|
void segmentCountChanged(int count);
|
2011-11-16 14:39:45 +00:00
|
|
|
|
|
|
|
private:
|
2012-07-30 09:09:23 +00:00
|
|
|
QPointF m_p1;
|
|
|
|
QPointF m_p2;
|
|
|
|
QPointF m_p3;
|
|
|
|
QPointF m_p4;
|
2011-11-16 14:39:45 +00:00
|
|
|
|
2012-07-30 09:09:23 +00:00
|
|
|
int m_segmentCount;
|
2011-11-16 14:39:45 +00:00
|
|
|
};
|
2012-07-30 09:09:23 +00:00
|
|
|
//! [1]
|
|
|
|
|
|
|
|
#endif
|
2011-11-16 14:39:45 +00:00
|
|
|
|