Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

create a scrollbar in a submenu qt?

I have a map application and a submenu which has dynamically added objects (i.e. points on a map) added to the submenu, depending on the layer that is loaded. I have the ability to hide each individual objects (i.e. a point) by clicking on the corresponding submenu item. Is there any way to organize the submenu? When there are a lot of points (i.e. 100) the entire submenu takes up the screen. Can I add a scrollbar to a submenu? I looked in the documentation, but couldn't find anything that support this feature.

like image 485
jim Avatar asked Dec 12 '22 10:12

jim


1 Answers

From this bug report I was able to find out that you could do the following:

submenu->setStyleSheet("QMenu { menu-scrollable: 1; }");

Works like a charm.

like image 72
user2045149 Avatar answered Dec 28 '22 09:12

user2045149