20 Q_PROPERTY(QSize contentsSize READ contentsSize WRITE setContentsSize NOTIFY contentsSizeChanged)
21 Q_PROPERTY(QColor fillColor READ fillColor WRITE setFillColor NOTIFY fillColorChanged)
22 Q_PROPERTY(qreal contentsScale READ contentsScale WRITE setContentsScale NOTIFY contentsScaleChanged)
23 Q_PROPERTY(RenderTarget renderTarget READ renderTarget WRITE setRenderTarget NOTIFY renderTargetChanged)
24 Q_PROPERTY(QSize textureSize READ textureSize WRITE setTextureSize NOTIFY textureSizeChanged)
26 QML_NAMED_ELEMENT(PaintedItem)
27 QML_ADDED_IN_VERSION(2, 0)
28 QML_UNCREATABLE(
"Cannot create instance of abstract class PaintedItem.")
31 explicit QQuickPaintedItem(QQuickItem *parent =
nullptr);
32 ~QQuickPaintedItem() override;
37 InvertedYFramebufferObject
41 enum PerformanceHint {
44 Q_DECLARE_FLAGS(PerformanceHints, PerformanceHint)
45 Q_FLAG(PerformanceHints)
47 void update(
const QRect &rect = QRect());
49 bool opaquePainting()
const;
50 void setOpaquePainting(
bool opaque);
52 bool antialiasing()
const;
53 void setAntialiasing(
bool enable);
56 void setMipmap(
bool enable);
58 PerformanceHints performanceHints()
const;
59 void setPerformanceHint(PerformanceHint hint,
bool enabled =
true);
60 void setPerformanceHints(PerformanceHints hints);
62 QRectF contentsBoundingRect()
const;
64 QSize contentsSize()
const;
65 void setContentsSize(
const QSize &);
66 void resetContentsSize();
68 qreal contentsScale()
const;
69 void setContentsScale(qreal);
71 QSize textureSize()
const;
72 void setTextureSize(
const QSize &size);
74 QColor fillColor()
const;
75 void setFillColor(
const QColor&);
77 RenderTarget renderTarget()
const;
78 void setRenderTarget(RenderTarget target);
80 virtual void paint(QPainter *painter) = 0;
82 bool isTextureProvider()
const override;
83 QSGTextureProvider *textureProvider()
const override;
86 void fillColorChanged();
87 void contentsSizeChanged();
88 void contentsScaleChanged();
89 void renderTargetChanged();
90 void textureSizeChanged();
93 QQuickPaintedItem(QQuickPaintedItemPrivate &dd, QQuickItem *parent =
nullptr);
94 QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;
95 void releaseResources() override;
96 void itemChange(ItemChange,
const ItemChangeData &) override;
99 void invalidateSceneGraph();
102 Q_DISABLE_COPY(QQuickPaintedItem)
103 Q_DECLARE_PRIVATE(QQuickPaintedItem)