Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以设置样式QMenu:item以设置自定义高度?
QMenu:item
我需要它作为弹出菜单,据我所见,这似乎是不可能的,但也许有人肯定知道。
你试过用QSS吗?这对我来说很好:
QSS
QMenu::item { height: 42px; margin: 0px; }
您可以使用pMenu->setStyleSheet("QMenu::item { height: 42px; margin: 0px; }");.
pMenu->setStyleSheet("QMenu::item { height: 42px; margin: 0px; }");
注意:确保您使用::而不是:引用该项目。
::
: