简体   繁体   English

QGraphicsRectItem上的drawForeground

[英]drawForeground on QGraphicsRectItem

I need a way for a QGraphicsRectItem to draw on top of its children. 我需要一种方法让QGraphicsRectItem在其子项之上绘制。 I have a item that contains several children items. 我有一个包含几个子项的项。 At a specific height I need to draw a line over the child items. 在特定的高度,我需要在子项上画一条线。

Is there a way to implement a drawForeground in a QGraphicsItems similar to the drawForeground in QGraphicsScene ? 有没有实现的方式drawForegroundQGraphicsItems类似drawForegroundQGraphicsScene

If at all possible I would prefer to not have to draw the line for each child item. 如果可能的话,我宁愿不必为每个子项画线。

I'm not entirely sure what you are trying to do but I suspect you will encounter a great deal of grief trying to fight the framework by trying to make a part of the parent draw over its child items. 我不确定您要做什么,但我怀疑您会因尝试使父项从其子项中抽取一部分而与框架作斗争,因此会遇到很多痛苦。 Perhaps you can add a top level child that is over the other child items covering a limited area, and renders the same content as the parent and includes the special overlay lines you want? 也许您可以在覆盖有限区域的其他子项之上添加顶级子项,并呈现与父项相同的内容,并包含所需的特殊叠加线?

It might also suit your purpose to draw right over the scene from the graphics view. 它也可能适合您从图形视图在场景上方绘制的目的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM