在子菜单qt中创建滚动条? [英] create a scrollbar in a submenu qt?
问题描述
我有一个地图应用程序和一个子菜单,根据加载的图层,该子菜单已将动态添加的对象(即地图上的点)添加到该子菜单中.我可以通过单击相应的子菜单项来隐藏每个单独的对象(即一个点).有什么组织子菜单的方法吗?当有很多点(即100)时,整个子菜单将占据屏幕.我可以在子菜单中添加滚动条吗?我查看了文档,但找不到支持此功能的任何东西.
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.
推荐答案
来自此错误报告我发现您可以执行以下操作:
From this bug report I was able to find out that you could do the following:
submenu->setStyleSheet("QMenu { menu-scrollable: 1; }");
像魅力一样工作.
这篇关于在子菜单qt中创建滚动条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!