[Interest] Non rectangular clipPath for QQuickItems

Richard Öhlinger r.oehlinger at avibit.com
Mon Sep 7 11:46:10 CEST 2015


Isn't there anyone who knows how to clip an Item and all its children in 
a non-rectangular fashion?

Maybe It could be done with a ShaderEffect? I had a look at OpacityMask 
but I could not figure out how to use it in my context.

br
Richard

On 09/02/2015 04:15 PM, Richard Öhlinger wrote:
> 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
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest




More information about the Interest mailing list