QString qss = "QMenu{color:#E8E8E8;background:#4D4D4D;margin:2px;}\
QMenu::item{padding:3px 20px 3px 20px;}\
QMenu::indicator{width:13px;height:13px;}\
QMenu::item:selected{color:#E8E8E8;border:0px solid #575757;background:#1E90FF;}\
QMenu::separator{height:1px;background:#757575;}";
QMenu menu;
menu.setStyleSheet(qss); //可以给菜单设置样式
menu.addAction(QStringLiteral("展开"));
menu.addSeparator(); //添加一个分隔线
menu.addAction(QStringLiteral("折叠"));
menu.exec(QCursor::pos()); //显示菜单
menu菜单格式
猜你喜欢
转载自blog.csdn.net/qq_36809882/article/details/103633670
今日推荐
周排行