Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquickimage_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QQUICKIMAGE_P_H
6#define QQUICKIMAGE_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
20#include <QtQuick/qsgtextureprovider.h>
21
23
24class QQuickImagePrivate;
25class Q_QUICK_EXPORT QQuickImage : public QQuickImageBase
26{
27 Q_OBJECT
28
29 Q_PROPERTY(FillMode fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged)
30 Q_PROPERTY(qreal paintedWidth READ paintedWidth NOTIFY paintedGeometryChanged)
31 Q_PROPERTY(qreal paintedHeight READ paintedHeight NOTIFY paintedGeometryChanged)
32 Q_PROPERTY(HAlignment horizontalAlignment READ horizontalAlignment WRITE setHorizontalAlignment NOTIFY horizontalAlignmentChanged)
33 Q_PROPERTY(VAlignment verticalAlignment READ verticalAlignment WRITE setVerticalAlignment NOTIFY verticalAlignmentChanged)
34 Q_PROPERTY(QSize sourceSize READ sourceSize WRITE setSourceSize RESET resetSourceSize NOTIFY sourceSizeChanged)
35 Q_PROPERTY(bool mipmap READ mipmap WRITE setMipmap NOTIFY mipmapChanged REVISION(2, 3))
36 Q_PROPERTY(bool autoTransform READ autoTransform WRITE setAutoTransform NOTIFY autoTransformChanged REVISION(2, 5))
37 Q_PROPERTY(QRectF sourceClipRect READ sourceClipRect WRITE setSourceClipRect RESET resetSourceClipRect NOTIFY sourceClipRectChanged REVISION(2, 15))
38 QML_NAMED_ELEMENT(Image)
39 QML_ADDED_IN_VERSION(2, 0)
40
41public:
42 QQuickImage(QQuickItem *parent=nullptr);
43 ~QQuickImage();
44
45 enum HAlignment { AlignLeft = Qt::AlignLeft,
46 AlignRight = Qt::AlignRight,
47 AlignHCenter = Qt::AlignHCenter };
48 Q_ENUM(HAlignment)
49 enum VAlignment { AlignTop = Qt::AlignTop,
50 AlignBottom = Qt::AlignBottom,
51 AlignVCenter = Qt::AlignVCenter };
52 Q_ENUM(VAlignment)
53
54 enum FillMode { Stretch, PreserveAspectFit, PreserveAspectCrop, Tile, TileVertically, TileHorizontally, Pad };
55 Q_ENUM(FillMode)
56
57 FillMode fillMode() const;
58 void setFillMode(FillMode);
59
60 qreal paintedWidth() const;
61 qreal paintedHeight() const;
62
63 QRectF boundingRect() const override;
64
65 HAlignment horizontalAlignment() const;
66 void setHorizontalAlignment(HAlignment align);
67
68 VAlignment verticalAlignment() const;
69 void setVerticalAlignment(VAlignment align);
70
71 bool isTextureProvider() const override { return true; }
72 QSGTextureProvider *textureProvider() const override;
73
74 bool mipmap() const;
75 void setMipmap(bool use);
76
77 void emitAutoTransformBaseChanged() override { Q_EMIT autoTransformChanged(); }
78
79Q_SIGNALS:
80 void fillModeChanged();
81 void paintedGeometryChanged();
82 void horizontalAlignmentChanged(QQuickImage::HAlignment alignment);
83 void verticalAlignmentChanged(QQuickImage::VAlignment alignment);
84 Q_REVISION(2, 3) void mipmapChanged(bool);
85 Q_REVISION(2, 5) void autoTransformChanged();
86
87private Q_SLOTS:
88 void invalidateSceneGraph();
89
90protected:
91 QQuickImage(QQuickImagePrivate &dd, QQuickItem *parent);
92 void pixmapChange() override;
93 void updatePaintedGeometry();
94 void releaseResources() override;
95
96 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
97 QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;
98
99private:
100 Q_DISABLE_COPY(QQuickImage)
101 Q_DECLARE_PRIVATE(QQuickImage)
102};
103
104QT_END_NAMESPACE
105
106#endif // QQUICKIMAGE_P_H
QT_REQUIRE_CONFIG(quick_animatedimage)