[Interest] Non rectangular clipPath for QQuickItems

Curtis Mitch mitch.curtis at theqtcompany.com
Mon Sep 7 11:50:19 CEST 2015


How about this?

http://stackoverflow.com/a/31585681/904422

> -----Original Message-----
> From: interest-bounces+mitch.curtis=theqtcompany.com at qt-project.org
> [mailto:interest-bounces+mitch.curtis=theqtcompany.com at qt-project.org] On
> Behalf Of Richard Öhlinger
> Sent: Monday, 7 September 2015 11:46 AM
> To: interest at qt-project.org
> Subject: Re: [Interest] Non rectangular clipPath for QQuickItems
> 
> 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
> 
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list