5#include <private/qquickpainteditem_p.h>
7#include <QtQuick/private/qsgdefaultpainternode_p.h>
8#include <QtQuick/private/qsgcontext_p.h>
9#include <private/qsgadaptationlayer_p.h>
87 , fillColor(
Qt::transparent)
89 , opaquePainting(
false)
121 if (
d->textureProvider)
139 if (
rect.isNull() && !
d->dirtyRect.isNull())
156 return d->opaquePainting;
173 if (
d->opaquePainting == opaque)
176 d->opaquePainting = opaque;
190 return d->antialiasing;
255 return d->performanceHints;
269 PerformanceHints oldHints =
d->performanceHints;
271 d->performanceHints |=
hint;
273 d->performanceHints &= ~hint;
274 if (oldHints !=
d->performanceHints)
288 if (
d->performanceHints == hints)
290 d->performanceHints = hints;
297 return d->textureSize;
318 if (
d->textureSize ==
size)
320 d->textureSize =
size;
337 QSizeF sz =
d->contentsSize *
d->contentsScale;
360 return d->contentsSize;
367 if (
d->contentsSize ==
size)
370 d->contentsSize =
size;
398 return d->contentsScale;
405 if (
d->contentsScale ==
scale)
434 if (
d->fillColor ==
c)
462 return d->renderTarget;
516 if (
d->textureProvider) {
517 d->textureProvider->node =
nullptr;
518 d->textureProvider->fireTextureChanged();
525 node =
d->sceneGraphContext()->createPainterNode(
this);
529 bool hasTextureSize =
d->textureSize.width() > 0 &&
d->textureSize.height() > 0;
534 && (
d->contentsScale != 1
535 || (
d->contentsSize.width() > 0 &&
d->contentsSize.height() > 0))) {
547 *
window()->effectiveDevicePixelRatio();
563 if (
d->textureProvider) {
564 d->textureProvider->node = node;
565 d->textureProvider->fireTextureChanged();
577 if (
d->textureProvider) {
579 d->textureProvider =
nullptr;
584void QQuickPaintedItem::invalidateSceneGraph()
587 delete d->textureProvider;
588 d->textureProvider =
nullptr;
615 qWarning(
"QQuickPaintedItem::textureProvider: can only be queried on the rendering thread of an exposed window");
618 if (!
d->textureProvider)
620 d->textureProvider->node =
d->node;
621 return d->textureProvider;
637#include "moc_qquickpainteditem.cpp"
The QColor class provides colors based on RGB, HSV or CMYK values.
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
void setFlag(Flag flag, bool enabled=true)
Enables the specified flag for this item if enabled is true; if enabled is false, the flag is disable...
virtual QSGTextureProvider * textureProvider() const
Returns the texture provider for an item.
QQuickWindow * window() const
Returns the window in which this item is rendered.
qreal width
This property holds the width of this item.
virtual void itemChange(ItemChange, const ItemChangeData &)
Called when change occurs for this item.
qreal height
This property holds the height of this item.
qreal scale
\qmlproperty real QtQuick::Item::scale This property holds the scale factor for this item.
ItemChange
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
@ ItemDevicePixelRatioHasChanged
void update()
Schedules a call to updatePaintNode() for this item.
virtual bool isTextureProvider() const
Returns true if this item is a texture provider.
QQuickPaintedItemPrivate()
void fireTextureChanged()
QSGTexture * texture() const override
Returns a pointer to the texture object.
The QQuickPaintedItem class provides a way to use the QPainter API in the QML Scene Graph.
QSize contentsSize
Obsolete method for setting the contents size.
void contentsScaleChanged()
void setMipmap(bool enable)
If enable is true, mipmapping is enabled on the associated texture.
void setPerformanceHints(PerformanceHints hints)
Sets the performance hints to hints.
void setTextureSize(const QSize &size)
QColor fillColor
The item's background fill color.
void itemChange(ItemChange, const ItemChangeData &) override
\reimp
QSGNode * updatePaintNode(QSGNode *, UpdatePaintNodeData *) override
\reimp
void setRenderTarget(RenderTarget target)
void setContentsScale(qreal)
void setFillColor(const QColor &)
RenderTarget renderTarget
The item's render target.
PerformanceHint
This enum describes flags that you can enable to improve rendering performance in QQuickPaintedItem.
QSGTextureProvider * textureProvider() const override
\reimp
bool mipmap() const
Returns true if mipmaps are enabled; otherwise, false is returned.
QQuickPaintedItem(QQuickItem *parent=nullptr)
Constructs a QQuickPaintedItem with the given parent item.
bool isTextureProvider() const override
\reimp
void releaseResources() override
\reimp
QRectF contentsBoundingRect() const
PerformanceHints performanceHints() const
Returns the performance hints.
void setPerformanceHint(PerformanceHint hint, bool enabled=true)
Sets the given performance hint on the item if enabled is true; otherwise clears the performance hint...
QSize textureSize
Defines the size of the texture.
void setContentsSize(const QSize &)
~QQuickPaintedItem() override
Destroys the QQuickPaintedItem.
void setAntialiasing(bool enable)
If enable is true, antialiased painting is enabled.
void renderTargetChanged()
bool opaquePainting() const
Returns true if this item is opaque; otherwise, false is returned.
bool antialiasing() const
Returns true if antialiased painting is enabled; otherwise, false is returned.
void setOpaquePainting(bool opaque)
If opaque is true, the item is opaque; otherwise, it is considered as translucent.
void textureSizeChanged()
RenderTarget
This enum describes QQuickPaintedItem's render targets.
void contentsSizeChanged()
qreal contentsScale
Obsolete method for scaling the contents.
static void schedule(QQuickWindow *window, QObject *object)
\qmltype Window \instantiates QQuickWindow \inqmlmodule QtQuick
\inmodule QtCore\reentrant
QRect toAlignedRect() const noexcept
constexpr qreal height() const noexcept
Returns the height of the rectangle.
constexpr qreal width() const noexcept
Returns the width of the rectangle.
\inmodule QtCore\reentrant
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
virtual QSGTexture * texture() const =0
virtual void setTextureSize(const QSize &size)=0
virtual void setSmoothPainting(bool s)=0
virtual void setPreferredRenderTarget(QQuickPaintedItem::RenderTarget target)=0
virtual void setLinearFiltering(bool linearFiltering)=0
virtual void setFastFBOResizing(bool dynamic)=0
virtual void setDirty(const QRect &dirtyRect=QRect())=0
virtual void setFillColor(const QColor &c)=0
virtual void setSize(const QSize &size)=0
virtual void setContentsScale(qreal s)=0
virtual void setOpaquePainting(bool opaque)=0
virtual void setMipmapping(bool mipmapping)=0
The QSGTextureProvider class encapsulates texture based entities in QML.
void textureChanged()
This signal is emitted when the texture changes.
constexpr qreal width() const noexcept
Returns the width.
constexpr qreal height() const noexcept
Returns the height.
static QThread * currentThread()
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
int qRound(qfloat16 d) noexcept
GLfloat GLfloat GLfloat w
[0]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLfloat GLfloat GLfloat GLfloat h
GLenum GLenum GLenum GLenum GLenum scale
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent