diff options
Diffstat (limited to 'src/quickshapes/qquickshape_p.h')
-rw-r--r-- | src/quickshapes/qquickshape_p.h | 135 |
1 files changed, 80 insertions, 55 deletions
diff --git a/src/quickshapes/qquickshape_p.h b/src/quickshapes/qquickshape_p.h index 85d6c3231b..effbce1f8e 100644 --- a/src/quickshapes/qquickshape_p.h +++ b/src/quickshapes/qquickshape_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QQUICKSHAPE_P_H #define QQUICKSHAPE_P_H @@ -63,15 +27,15 @@ QT_BEGIN_NAMESPACE class QQuickShapePathPrivate; class QQuickShapePrivate; -void Q_QUICKSHAPES_PRIVATE_EXPORT QQuickShapes_initializeModule(); +void Q_QUICKSHAPES_EXPORT QQuickShapes_initializeModule(); -class Q_QUICKSHAPES_PRIVATE_EXPORT QQuickShapesModule +class Q_QUICKSHAPES_EXPORT QQuickShapesModule { public: static void defineModule(); }; -class Q_QUICKSHAPES_PRIVATE_EXPORT QQuickShapeGradient : public QQuickGradient +class Q_QUICKSHAPES_EXPORT QQuickShapeGradient : public QQuickGradient { Q_OBJECT Q_PROPERTY(SpreadMode spread READ spread WRITE setSpread NOTIFY spreadChanged) @@ -84,8 +48,8 @@ class Q_QUICKSHAPES_PRIVATE_EXPORT QQuickShapeGradient : public QQuickGradient public: enum SpreadMode { PadSpread, - RepeatSpread, - ReflectSpread + ReflectSpread, + RepeatSpread }; Q_ENUM(SpreadMode) @@ -94,14 +58,14 @@ public: SpreadMode spread() const; void setSpread(SpreadMode mode); -signals: +Q_SIGNALS: void spreadChanged(); private: SpreadMode m_spread; }; -class Q_QUICKSHAPES_PRIVATE_EXPORT QQuickShapeLinearGradient : public QQuickShapeGradient +class Q_QUICKSHAPES_EXPORT QQuickShapeLinearGradient : public QQuickShapeGradient { Q_OBJECT Q_PROPERTY(qreal x1 READ x1 WRITE setX1 NOTIFY x1Changed) @@ -124,7 +88,7 @@ public: qreal y2() const; void setY2(qreal v); -signals: +Q_SIGNALS: void x1Changed(); void y1Changed(); void x2Changed(); @@ -135,7 +99,7 @@ private: QPointF m_end; }; -class Q_QUICKSHAPES_PRIVATE_EXPORT QQuickShapeRadialGradient : public QQuickShapeGradient +class Q_QUICKSHAPES_EXPORT QQuickShapeRadialGradient : public QQuickShapeGradient { Q_OBJECT Q_PROPERTY(qreal centerX READ centerX WRITE setCenterX NOTIFY centerXChanged) @@ -169,7 +133,7 @@ public: qreal focalRadius() const; void setFocalRadius(qreal v); -signals: +Q_SIGNALS: void centerXChanged(); void centerYChanged(); void focalXChanged(); @@ -184,7 +148,7 @@ private: qreal m_focalRadius = 0; }; -class Q_QUICKSHAPES_PRIVATE_EXPORT QQuickShapeConicalGradient : public QQuickShapeGradient +class Q_QUICKSHAPES_EXPORT QQuickShapeConicalGradient : public QQuickShapeGradient { Q_OBJECT Q_PROPERTY(qreal centerX READ centerX WRITE setCenterX NOTIFY centerXChanged) @@ -206,7 +170,7 @@ public: qreal angle() const; void setAngle(qreal v); -signals: +Q_SIGNALS: void centerXChanged(); void centerYChanged(); void angleChanged(); @@ -216,7 +180,7 @@ private: qreal m_angle = 0; }; -class Q_QUICKSHAPES_PRIVATE_EXPORT QQuickShapePath : public QQuickPath +class Q_QUICKSHAPES_EXPORT QQuickShapePath : public QQuickPath { Q_OBJECT @@ -232,6 +196,7 @@ class Q_QUICKSHAPES_PRIVATE_EXPORT QQuickShapePath : public QQuickPath Q_PROPERTY(QVector<qreal> dashPattern READ dashPattern WRITE setDashPattern NOTIFY dashPatternChanged) Q_PROPERTY(QQuickShapeGradient *fillGradient READ fillGradient WRITE setFillGradient RESET resetFillGradient) Q_PROPERTY(QSizeF scale READ scale WRITE setScale NOTIFY scaleChanged REVISION(1, 14)) + Q_PROPERTY(PathHints pathHints READ pathHints WRITE setPathHints NOTIFY pathHintsChanged REVISION(6, 7) FINAL) QML_NAMED_ELEMENT(ShapePath) QML_ADDED_IN_VERSION(1, 0) @@ -262,6 +227,18 @@ public: }; Q_ENUM(StrokeStyle) + enum PathHint { + PathLinear = 0x1, + PathQuadratic = 0x2, + PathConvex = 0x4, + PathFillOnRight = 0x8, + PathSolid = 0x10, + PathNonIntersecting = 0x20, + PathNonOverlappingControlPointTriangles = 0x40 + }; + Q_DECLARE_FLAGS(PathHints, PathHint) + Q_FLAG(PathHints) + QQuickShapePath(QObject *parent = nullptr); ~QQuickShapePath(); @@ -299,6 +276,9 @@ public: void setFillGradient(QQuickShapeGradient *gradient); void resetFillGradient(); + PathHints pathHints() const; + void setPathHints(PathHints newPathHints); + Q_SIGNALS: void shapePathChanged(); void strokeColorChanged(); @@ -312,20 +292,29 @@ Q_SIGNALS: void dashOffsetChanged(); void dashPatternChanged(); + Q_REVISION(6, 7) void pathHintsChanged(); + private: Q_DISABLE_COPY(QQuickShapePath) Q_DECLARE_PRIVATE(QQuickShapePath) Q_PRIVATE_SLOT(d_func(), void _q_fillGradientChanged()) }; -class Q_QUICKSHAPES_PRIVATE_EXPORT QQuickShape : public QQuickItem +class Q_QUICKSHAPES_EXPORT QQuickShape : public QQuickItem { Q_OBJECT Q_PROPERTY(RendererType rendererType READ rendererType NOTIFY rendererChanged) Q_PROPERTY(bool asynchronous READ asynchronous WRITE setAsynchronous NOTIFY asynchronousChanged) Q_PROPERTY(bool vendorExtensionsEnabled READ vendorExtensionsEnabled WRITE setVendorExtensionsEnabled NOTIFY vendorExtensionsEnabledChanged) + Q_PROPERTY(RendererType preferredRendererType READ preferredRendererType + WRITE setPreferredRendererType NOTIFY preferredRendererTypeChanged REVISION(6, 6) FINAL) Q_PROPERTY(Status status READ status NOTIFY statusChanged) Q_PROPERTY(ContainsMode containsMode READ containsMode WRITE setContainsMode NOTIFY containsModeChanged REVISION(1, 11)) + Q_PROPERTY(QRectF boundingRect READ boundingRect NOTIFY boundingRectChanged REVISION(6, 6) FINAL) + Q_PROPERTY(FillMode fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged REVISION(6, 7) FINAL) + Q_PROPERTY(HAlignment horizontalAlignment READ horizontalAlignment WRITE setHorizontalAlignment NOTIFY horizontalAlignmentChanged REVISION(6, 7) FINAL) + Q_PROPERTY(VAlignment verticalAlignment READ verticalAlignment WRITE setVerticalAlignment NOTIFY verticalAlignmentChanged REVISION(6, 7) FINAL) + Q_PROPERTY(QQmlListProperty<QObject> data READ data) Q_CLASSINFO("DefaultProperty", "data") QML_NAMED_ELEMENT(Shape) @@ -336,7 +325,8 @@ public: UnknownRenderer, GeometryRenderer, NvprRenderer, - SoftwareRenderer + SoftwareRenderer, + CurveRenderer }; Q_ENUM(RendererType) @@ -353,6 +343,23 @@ public: }; Q_ENUM(ContainsMode) + enum FillMode { + NoResize, + PreserveAspectFit, + PreserveAspectCrop, + Stretch + }; + Q_ENUM(FillMode) + + enum HAlignment { AlignLeft = Qt::AlignLeft, + AlignRight = Qt::AlignRight, + AlignHCenter = Qt::AlignHCenter }; + Q_ENUM(HAlignment) + enum VAlignment { AlignTop = Qt::AlignTop, + AlignBottom = Qt::AlignBottom, + AlignVCenter = Qt::AlignVCenter }; + Q_ENUM(VAlignment) + QQuickShape(QQuickItem *parent = nullptr); ~QQuickShape(); @@ -361,6 +368,11 @@ public: bool asynchronous() const; void setAsynchronous(bool async); + Q_REVISION(6, 6) RendererType preferredRendererType() const; + Q_REVISION(6, 6) void setPreferredRendererType(RendererType preferredType); + + Q_REVISION(6, 6) QRectF boundingRect() const override; + bool vendorExtensionsEnabled() const; void setVendorExtensionsEnabled(bool enable); @@ -373,6 +385,15 @@ public: QQmlListProperty<QObject> data(); + Q_REVISION(6, 7) FillMode fillMode() const; + Q_REVISION(6, 7) void setFillMode(FillMode newFillMode); + + Q_REVISION(6, 7) HAlignment horizontalAlignment() const; + Q_REVISION(6, 7) void setHorizontalAlignment(HAlignment newHorizontalAlignment); + + Q_REVISION(6, 7) VAlignment verticalAlignment() const; + Q_REVISION(6, 7) void setVerticalAlignment(VAlignment newVerticalAlignment); + protected: QSGNode *updatePaintNode(QSGNode *node, UpdatePaintNodeData *) override; void updatePolish() override; @@ -385,8 +406,14 @@ Q_SIGNALS: void asynchronousChanged(); void vendorExtensionsEnabledChanged(); void statusChanged(); + Q_REVISION(6, 6) void preferredRendererTypeChanged(); + Q_REVISION(6, 6) void boundingRectChanged(); Q_REVISION(1, 11) void containsModeChanged(); + Q_REVISION(6, 7) void fillModeChanged(); + Q_REVISION(6, 7) void horizontalAlignmentChanged(); + Q_REVISION(6, 7) void verticalAlignmentChanged(); + private: Q_DISABLE_COPY(QQuickShape) Q_DECLARE_PRIVATE(QQuickShape) @@ -395,6 +422,4 @@ private: QT_END_NAMESPACE -QML_DECLARE_TYPE(QQuickShape) - #endif // QQUICKSHAPE_P_H |