PDA

View Full Version : Defining position for QMenu used by QPushButton



Ghaleon
13th February 2009, 08:24
Hi,

So I want to open QMenu when button is clicked. There is no problem with opening it, but what would be good way to define where menu is opened? As default it shows on below the button, but is there way to define it to be shown for example on the right side of button? I have toolbar on left side of UI with several buttons, so it would be convenient to show sub-menus on the right side of this toolbar. UI is made on dialog.

One way could be to open menu in certain location (QPoint) when button is clicked, but I think that would be little messy. So is there any support in Qt to associate button and menu and define menus location?

talk2amulya
13th February 2009, 09:23
well, one good way of doing it would be to create a custom widget and show it on the click of the button using the connect() method