Quantcast
Channel: Installation and Deployment
Viewing all articles
Browse latest Browse all 22112

How to draw a transparent hole inside a QQuickView / QQuickWindow based on a custom QQuickItem?

$
0
0
Hello, I have the following problem, I do not manage to create a transparent hole inside a QQuickView, through a customed QQuitItem. Here is what I have: – a C++ custom QQuickItem, CustomQQuickItem, which is registered in qml so I can access it from a QML file – a C++ main application, creating a QQuickView. – a main QML file as follows: import QtQuick 2.0 import LWQQuickItem 1.0   Rectangle {     id:idScreenUIZ0_0     width: 800     height: 480     color: "blue"       CustomQQuickItem {         id: idCustomQuickItem         x: 100         y: 100         width: 500         height: 100     } } I would like my CustomQQuickItem instance to ‘draw’ transparency in the QQuickView with the given position and size (100,100,500,100). So I overrode the QSGNode * updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) method of the QQuickItem to do this transparent hole. QSGNode * LWQQuickItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) {       //    retrieve window in which the QQuickItem is drawn     // Returns the window in which this item is rendered.     QQuickWindow *pQQuickWindow;     pQQuickWindow = QQuickItem::window();       if (pQQuickWindow != NULL)     {         // Here I would like to draw a transparent area in the window itself         pQQuickWindow->setColor(QColor(0,0,0,0));         ;     }     else     {         qDebug()<<"qquickwindow not found!";     }       //Not sure what I should return here     return oldNode;   } Anyone has any idea if this is possible at all? basically, is it possible to: – either draw directly in the underlying window a transparent area ? – or define a specific scene graph node that will draw a transparent area in the rendering window? Thank you for providing me any hint to help me achieve this. Regards, Bill

Viewing all articles
Browse latest Browse all 22112

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>