在Qt中,对于上下文菜单项,如何隐藏图标的空间 [英] In Qt, for a context menu item, how to hide the space of the icon
本文介绍了在Qt中,对于上下文菜单项,如何隐藏图标的空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在为小部件添加使用QAction
的上下文菜单.
现在,动作文本旁边有一些空白.我假设这是与QAction
关联的QIcon
关联的空间.现在如何隐藏此空间.我尝试这样做:
I am adding a context menu using QAction
for a widget.
Now, there is some white space beside the text of the action. I assume this is the space where the QIcon
association with the QAction
should have been there. Now how do I hide this space. I tried doing:
action->setIcon(QIcon());
但似乎仍然行不通.
请让我知道您是否有办法在文本前删除该空格.
Kindly let me know if you have the way to remove that space before the text.
推荐答案
我不知道是否有特定于操作或菜单的方法,但是您可以使用样式将其删除.
I don't know if there is a way specific to the action or the menu, but you could probably remove it using a style.
这篇关于在Qt中,对于上下文菜单项,如何隐藏图标的空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文