Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top