2011-10-02 63 views

回答

0

当您为使用setMenu()一个QPushButton菜单,菜单将继续作为自己的实体存在,因此您可以使用适当的选择器将QMenu对象本身作为目标。 A QMenu支持盒子模型。一些示例样式可以在here找到。

0

在QT样式表,你可以风格,是其他部件的成员,像这样的小部件:

QPushButton QMenu 
{ 
    /* blahblah */ 
} 

哪里QPushButton是父控件,并且QMenu是孩子。它也适用于其他可分类物品和伪状态,例如

QPushButton QMenu::separator 
{ 
    height: 1px; 
    border-bottom: 1px solid lightGray; 
    background: #5A5A5A; 
    margin-left: 2px; 
    margin-right: 0px; 
    margin-top: 2px; 
    margin-bottom: 2px; 
}