Popup Menu For Tool Button
I have a groupbox with few Icon Buttons, it has to be displayed as a popup menu when clicked on the ToolButton. How can I do this in Qt?
I have connected the Click to a Function:
connect(ui.toolButton_29, SIGNAL(clicked()),this, SLOT(openDialog()));
Class::class()
ui.groupBox->hide();
void Class:: openDialog()
ui.groupBox->show();
The GroupBox is displayed when the ToolButton is Clicked but it is shown Under other widgets. I ant it to be displayed at the top of other widgets. I would be really glad to seek help.
Thank you in Advance!
Re: Popup Menu For Tool Button
Not sure what you mean but if you want the box to be displayed as a floating widget on top of some other window, set a Qt::Popup flag on it.
Re: Popup Menu For Tool Button
Hello!! I want that as a Popup on a toolBox when the button is clicked. But, there is no setViewMode in ui.groupbox to set the widget to Popup. Could you provide a snippet?
Re: Popup Menu For Tool Button
setWindowFlags(Qt::Popup). The widget should not have a parent and you will have to control its geometry by hand.
Re: Popup Menu For Tool Button
Thank you very much @Wysota. It worked fine!