I have pretty specific situation. I want to place a QAction
into QToolbar
and reach following behaviour:
- Checkable
QAction
with icon. - Classic arrow on the right side which is used for showing menu
- By pressing this arrow my
QDialog
should appears on screen instead ofQMenu
-like one
Now I'm a bit confused with implementing all this things together.
For now I've created QAction
added it to toolbar and also created an empty QMenu
because I didn't get the idea of how to add the "dropdown" arrow another way.
So, I also connected my slot to QMenu
aboutToShow()
signal and now, I can create my dialog and exec()
it just before QMenu
shows. But here's the main problem appears: after I did everything with my dialog an click OK
button QMenu
trying to appear, but as it is empty it shows nothing and further actions become available only after I left-click somwhere to "close" this menu.
Is there any way to force QMenu
not to show or can inherit from QMenu
and reimplemnt its behaviour (I've tried to do such trick with exec()
show()
popup()
methods of QMenu
after subclassing from it, but none of them are being called when menu appears on the screen) ?
QMenu( parent )
in your constructor initialization. – Fake