简体   繁体   English

将图像添加到QQuickView

[英]Add image to QQuickView

What I need to do is adding an image (available as a QImage object) to a custom QQuickItem. 我需要做的是向自定义QQuickItem添加图像(作为QImage对象提供)。 I override the updatePaintNode() function and add a couple of nodes, one of which should have a triangle-shaped child note. 我重写了updatePaintNode()函数,并添加了两个节点,其中一个节点应具有三角形的子注释。 I´d like to achieve this by using an image of triangle contained in a png-file. 我想通过使用png文件中包含的三角形图像来实现此目的。

Is there any way to do this? 有什么办法吗?

Sorry, I misunderstood your requirements. 抱歉,我误解了您的要求。 You need QQuickWindow::createTextureFromImage to create a QSGTexture, then a QSGSimpleTextureNode with the texture you just created, plus a QSGGeometry to define its geometry. 您需要QQuickWindow :: createTextureFromImage来创建QSGTexture,然后需要具有刚刚创建的纹理的QSGSimpleTextureNode以及QSGGeometry来定义其几何形状。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM