开发者

How to draw an ellipse/circle over QGraphicsScene in a QGraphicsView

开发者 https://www.devze.com 2023-01-16 02:03 出处:网络
I have a QGraphicsView with a QGraphicsScene. That QGraphicsScene contains a QPixmap. It is possible to drag the scene. On top of that scene I have a HUD with QLabels, QPushButtons and other stuff. Wh

I have a QGraphicsView with a QGraphicsScene. That QGraphicsScene contains a QPixmap. It is possible to drag the scene. On top of that scene I have a HUD with QLabels, QPushButtons and other stuff. When I drag the scene around, the HUD elements never change their position. So far it works all perfect. But now I need to add a new element to this HUD, an ellipse/circle. But all the stuff I tried, isn't working properly. The problem, if you are over that circle, with the mouse, it must be still possible to grab and drag the scene. So I need only a visible circle, that is completely ignored by the mou开发者_运维知识库se or any other action. How can I do that?


If setting the circle widget to disabled using setEnabled(false) doesn't give you the desired effect, try calling setAttribute(Qt::WA_TransparentForMouseEvents, true) on it.

0

精彩评论

暂无评论...
验证码 换一张
取 消