I use a QToolBar in a QGraphicsScene and I'm having some trouble with the extension menu.
In the QToolBar documentation it says:
I use QToolButtons created in QWidgetActions and they are working as expected.When a QToolBar is not a child of a QMainWindow, it looses the ability to populate the extension pop up with widgets added to the toolbar using addWidget(). Please use widget actions created by inheriting QWidgetAction and implementing QWidgetAction::createWidget() instead.
I use the Qt::BypassGraphicsProxyWidget flag in the QToolBar so that the extension menu doesn't get embedded in a QGraphicsProxyWidget when created and displayed. When the QToolBar is resized small enough so that some of the actions in the QToolBar is hidden, the extension button appears.
The problem I'm having is that the extension menu pops up in the wrong position on the screen (far to the left of where the QToolBar is in the QGraphicsScene) and I have no way of positioning it from within my code.
Is there a way to know when the extension menu is about to show or shown and a way to access it? That way I can create and position my own QMenu with the hidden actions in.
Is there an easier way to do this?
Any help is greatly appreciated,
Francois
EDIT: I forgot to mention that when I don't use the Qt::BypassGraphicsProxyWidget flag, the extension menu pops up in the correct position on the graphics scene but underneath other items. An alternative acceptable solution would be if I can somehow force it to the top of the scene's z-order
Bookmarks