문제

I created a subclass of QToolBar to make a context tool bar associate with QGraphicsItem.

What I want to add is a small triangle point to where my toolbar popped up. I know that QPainter can't draw outside the QToolBar. But is there a way to draw from pic 1 to pic 2

From this

To this

Sorry. My pics are awful. But you could understand.

도움이 되었습니까?

해결책

Maybe you should create a new widget (or a tiny frameless, borderless window), with only the small triangle and put it at the required position (ie: the x coordinate should be the mouseX - width_of_window/2 and the Y coordinate should be mouseX - height_of_window).

Make sure the widget (windows) is hidden when the scrollbar is not shown, and show it at the calculated global coordinates on a mouse action.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top