Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to create a resizable QMenu

Tags:

c++

qt

qt5

I have a popup QMenu displaying lot of icons in a QListView:

QMenu*menu=createMenu();
QListView*list=createList();
QWidgetAction*action=new QWidgetAction(menu);
action->setDefaultWidget(list);
menu->addAction(action);
menu->show();

A Non Resizable QMenu

Is there a way to make it resizable ? i.e. I would like to be able to drag the corner of the popup menu and resize the popup menu with the mouse. I was not able to find this on google or in Qt documentation.

like image 710
Arnaud Avatar asked Apr 02 '14 12:04

Arnaud


1 Answers

Try like this:

...
QListView*list=createList();
Qt::WindowFlags winFlags = list->windowFlags();
winFlags = winFlags & ~Qt::MSWindowsFixedSizeDialogHint;
list->setWindowFlags(winFlags);
...

Or same thing on menu

like image 113
Marek R Avatar answered Oct 27 '22 05:10

Marek R