QQuickItem::clipRect clips QSGNode in QQuickItem::updatePaintNode()
-
I made a QML component based on QQuickItem. I redefined the QQuickItem::clipRect() method in it in order to clip nested components (childrens) along a certain border, which is smaller than the size of the component itself. In the QQuickItem::updatePaintNode() method I paint a custom QSGNode based on QSGGeometryNode/QSGGeometry/QSGFlatColorMaterial. The problem is that when I need the geometry in QQuickItem::clipRect() and clip: true on the component, the rendered QSGNode is clipped along the boundary specified in QQuickItem::clipRect(). What needs to be done to get the QSGNode to be drawn outside of QQuickItem::clipRect()?
-
@posix said in QQuickItem::clipRect clips QSGNode in QQuickItem::updatePaintNode():
What needs to be done to get the QSGNode to be drawn outside of QQuickItem::clipRect()?
clip: false
-
@sierdzio I need to draw a border and cut off the center, something like this:
+---------------+ QSGNode drawed border | +-----------+ | | | Clipped | | | | childs at | | | | center | | | | | | | +-----------+ | +---------------+
Is this impossible to do?
-
@sierdzio yes, I also thought that it would be possible to do this in QML using nested components, but I need to do it in C++.
The problem is that QSGNode, when clip: true, calculates its outer bounds from QQuickItem::clipRect(), and not from QQuickItem::boundingRect(). If there was a way to change this, the problem would be solved.