QT之qss教程-QMenuBar

29 篇文章 11 订阅
22 篇文章 10 订阅


QMainWindow::separator {
	background:yellow;
	width:10px;
	height:10px;
}

QMainWindow::separator:hover {
	background:red;
}

QMenu {
	/* 背景色 */
	background-color:white;
	
	/* 边框 */
	border:2px solid red;
	
	/* 边框周围距离 */
	margin:24px;
}

QMenu::item {
	/* 背景颜色透明 */
	background-color:transparent;
	
	/* 内边框 */
	padding:20 25 20 20px;
	
	/* 外边框 */
	border:4px solid transparent;
}

/* 选中条目时 */
QMenu::item:selected {
	background-color:#654321;
	border-color:darkblue;
	background:rgba(100,100,100,150);
}

/* 条目被选中时,ui->action_O->setCheckable(true); */
QMenu::icon::checked {
	background:red;
	border:3px inset red;
	position:absolute;
	
	/* 一点位移 */
	top:2px;
	right:2px;
	bottom:4px;
	left:4px;
}

/* 分隔符 */
QMenu::separator {
	height:10px;
	background:lightblue;
	margin-left:10px;
	margin-right:5px;
}

QMenu::indicator {
	width:20px;
	height:20px;
}

/* non-exclusive indicator = check box style indicator (see QActionGroup::setExclusive) */
QMenu::indicator:non-exclusive:unchecked {
    image: url(:/images/checkbox_unchecked.png);
}

QMenu::indicator:non-exclusive:unchecked:selected {
    image: url(:/images/checkbox_unchecked_hover.png);
}

QMenu::indicator:non-exclusive:checked {
    image: url(:/images/checkbox_checked.png);
}

QMenu::indicator:non-exclusive:checked:selected {
    image: url(:/images/checkbox_checked_hover.png);
}

/* exclusive indicator = radio button style indicator (see QActionGroup::setExclusive) */
QMenu::indicator:exclusive:unchecked {
    image: url(:/images/radiobutton_unchecked.png);
}

QMenu::indicator:exclusive:unchecked:selected {
    image: url(:/images/radiobutton_unchecked_hover.png);
}

QMenu::indicator:exclusive:checked {
    image: url(:/images/radiobutton_checked.png);
}

QMenu::indicator:exclusive:checked:selected {
    image: url(:/images/radiobutton_checked_hover.png);
}

/* 菜单栏 */
QMenuBar {
	background-color:qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 lightgray, stop:1 darkgray);
}

QMenuBar::item {
	/* 条目之间的距离 */
	spacing:50px;
	
	/* 条目内边框 */
	padding:10 50px;
	
	/* 背景颜色 */
	background:transparent;
	
	/* 倒角 */
	border-radius:4px;
}


  • 4
    点赞
  • 25
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值