setStyleSheet 一些QSS设置的集合

setStyleSheet 设置的一些集合,一部分源码和截图来自

http://blog.sina.com.cn/s/articlelist_2801495241_0_1.html

 

1. 设置QLabel字体颜色

version_title->setStyleSheet("color:white;");

2.设置button透明

medal_button->setStyleSheet("background:transparent;");

3.设置QSplitter背景

main_splitter->setStyleSheet("QSplitter::handle{background:lightgray;}");

4.设置button圆弧大小,背景颜色,字体颜色,鼠标放到按键上的背景颜色。

power_button->setStyleSheet("QPushButton{border-radius:20px; background:rgb(110, 190, 10); color:white;}"
  "QPushButton:hover{background:rgb(140, 220, 35);}");

按键设置http://blog.csdn.net/xj626852095/article/details/10430653

5.设置button的背景图片

login_button->setStyleSheet("QPushButton{color:green; border-image:url(:/contentWidget/login);}"
  "QPushButton:hover{color:rgb(110, 190, 10);}");

6.颜色设置 和 透明设置

register_button->setStyleSheet("color:rgb(0, 120, 230); background:transparent;");

 

7.设置QToolButton背景透明,鼠标指到时显现背景,圆角5px,边界线1px

 

recovery_button = new QToolButton();
 recovery_button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    QPixmap recovery_pixmap(":/contentWidget/recovery");
 recovery_button->setIcon(recovery_pixmap);
 recovery_button->setIconSize(recovery_pixmap.size());
 recovery_button->setFixedSize(recovery_pixmap.width()+50, recovery_pixmap.height()+35);
 recovery_button->setStyleSheet("QToolButton{background:transparent;}"
        "QToolButton:hover{border-radius:5px; border:1px solid rgb(210, 225, 230);}");

 

8.QTabWidget 设置

tab_widget->setStyleSheet("QTabWidget::pane{border: 1px;}"
  "QTabWidget::tab-bar{alignment:center;}"
        "QTabBar::tab{background:transparent;color:white; min-width:10ex; min-height:5ex; }"
  "QTabBar::tab:hover{background:rgb(255, 255, 255, 100);}"
  "QTabBar::tab:selected{border-color: white;background:white;color:green;}");

 

9.QLineEdit 输入框的的设置

this->setStyleSheet("QLineEdit{border-width: 1px; border-radius: 4px; font-size:12px; color: black; border:1px solid gray;}"
      "QLineEdit:hover{border-width: 1px; border-radius: 4px; font-size:12px; color: black; border:1px solid rgb(70, 200, 50);}");

  • 4
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值