[Interest] Non rectangular clipPath for QQuickItems
Richard Öhlinger
r.oehlinger at avibit.com
Wed Sep 2 16:15:31 CEST 2015
Hello!
I'm porting our Quick 1 application to Quick 2.
In our application we had an triangle shaped item with a clipping path.
All child Items in QML (e.g. our Buttons) will be clipped to that
triangular shape
//in C'tor:
this->setFlag(QGraphicsItem::ItemHasNoContents, false);
this->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true);
//in paint just drawing the triangle
painter->drawPath(m_painterPath);
but the most important thing was overriding the QGraphicsItem::shape()
method which returned the triangular shape which Quick 1 would use for
clipping
But how would I do that with a QQuickItem?
I've ported the drawing of the triangle by overriding
QQuickItem::updatePaintNode.
There I'd return a QSGClipNode which would perform the nessesary
clipping, but this will only clip the SG-children. But QML child Items
won't be scene graph children.
Does anyone have a solution?
br
Richard
More information about the Interest
mailing list