QT QStyleSheet使用记录

2 篇文章 0 订阅
1 篇文章 0 订阅
  • 常用样式的qss记录,对应QT资源中的styleSheet_name.qss文件
*{ background-color: #FFFFFF; color:black; font:13px "微软雅黑"; }
QWidget{ border:none; }
.QFrame{ border:1px solid #FFFFFF; background-color:#C9D7E0;}

QSplitter::handle{ background-color:#E6ECF2; }

QTabWidget::pane{ border:1px solid #C9D7E0; }

QLineEdit,QSpinBox,QDoubleSpinBox,QTimeEdit,QDateEdit{ border: 1px solid #C9D7E0; padding: 2px; border-radius: 2px;}

QSpinBox::up-button, QDoubleSpinBox::up-button{ width: 20px; border-left:1px solid #C9D7E0; border-bottom:1px solid #C9D7E0; margin-bottoom:-1px}
QSpinBox::down-button, QDoubleSpinBox::down-button{ width: 20px; border-left:1px solid #C9D7E0; }
QSpinBox::up-arrow, QDoubleSpinBox::up-arrow{ background: url(:/Img/top_triangle.png) no-repeat center; }
QSpinBox::down-arrow, QDoubleSpinBox::down-arrow{ background: url(:/Img/bottom_triangle.png) no-repeat center; }

QTimeEdit::up-button, QDateEdit::up-button{ width: 20px; border-left:1px solid #C9D7E0; border-bottom:1px solid #C9D7E0; margin-bottoom:-1px}
QTimeEdit::down-button, QDateEdit::down-button{ width: 20px; border-left:1px solid #C9D7E0; }
QTimeEdit::up-arrow, QDateEdit::up-arrow{ background: url(:/Img/top_triangle.png) no-repeat center; }
QTimeEdit::down-arrow, QDateEdit::down-arrow{ background: url(:/Img/bottom_triangle.png) no-repeat center; }

QPushButton{ border: 1px solid #C9D7E0; padding-left:6px; padding-right:6px; border-radius: 2px; background-color: rgb(232,238,244);}
QPushButton:hover{ background-color: rgb(54,133,237);}
#pushButton_name{ background-color: #3685ED; font:15px; color:white; padding:4px;}

QComboBox{ border: 1px solid #C9D7E0; padding: 2px; border-radius: 2px;}
QComboBox::drop-down{ width: 15px; border:0; }
QComboBox::drop-down:hover{ background-color: #D4E6FD; }
QComboBox::down-arrow {image: url(:/Img/bottom_triangle.png); }

QCheckBox{ spacing:3px; color:black; }
QCheckBox::indicator{ border:1px solid #C9D7E0; background-color:white; width:14px; height:14px; border-radius:2px;}
QCheckBox::indicator:hover, QCheckBox::indicator:checked:hover{ background-color:rgb(180,215,243); }
QCheckBox::indicator:checked{ background: white url(:/Img/box_checked.png) no-repeat center; border:1px solid #3685ED; }

QScrollBar:vertical{ background: #FFFFFF; border: none; margin:20px 0px 20px 0px;}
QScrollBar::handle:vertical{ background:#DBDEE3; border: none; min-height: 20px; border-radius: 4px; margin-left:3px; margin-right:3px;}
QScrollBar::add-line:vertical{ background:#DBDEE3; border: none; height:17; subcontrol-position: bottom; subcontrol-origin: margin;}
QScrollBar::sub-line:vertical{ background:#DBDEE3; border: none; height:17; subcontrol-position: top; subcontrol-origin: margin;}
QScrollBar::up-arrow:vertical{ image: url(:/Img/top_triangle.png); }
QScrollBar::down-arrow:vertical{ image: url(:/Img/bottom_triangle.png); }
QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { background: transparent; }
QScrollBar:horizontal{ background: #FFFFFF; border: none; margin:0px 20px 0px 20px;}
QScrollBar::handle:horizontal{ background:#DBDEE3; border: none; min-width: 20px; border-radius: 4px; margin-top:3px; margin-bottom:3px;}
QScrollBar::add-line:horizontal{ background:#DBDEE3; border: none; width:17; subcontrol-position: right; subcontrol-origin: margin;}
QScrollBar::sub-line:horizontal{ background:#DBDEE3; border: none; width:17; subcontrol-position: left; subcontrol-origin: margin;}
QScrollBar::right-arrow:horizontal{ image: url(:/Img/right_triangle.png); }
QScrollBar::left-arrow:horizontal{ image: url(:/Img/left_triangle.png); }
QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal { background: transparent; }

QTabBar QToolButton{ border:1px solid #939CAD; }
QTabBar::tab{ background-color: white; color:black; border:none;  min-height:30px; padding-left:20px; padding-right:20px; }
QTabBar::tab:!selected:hover{ background-color:#C4DBFD; }
QTabBar::tab:selected{ background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:0.8, stop:0 rgba(196, 219, 253, 255), stop:0.8 rgba(255, 255, 255, 0));  border-top:3px solid #3685ED;}
#tab_name>QTabBar::tab:!selected:hover{ background-color:#C4DBFD; }

QHeaderView::section { background-color: #F8FAFE; color:#939CAD; border: 1px solid #E6ECF2; border-left:0; border-top:0;}
QTableView{ alternate-background-color: #FAFAFA; border: 0; gridline-color: #E6ECF2;}
QTableView::item:selected{ background: #C4DBFD; color:black; }
QTableView::indicator{ border:1px solid #C9D7E0; background-color:white; width:14px; height:14px; border-radius:2px;}
QTableView::indicator:hover, QTableView::indicator:checked:hover{ background-color:rgb(180,215,243); }
QTableView::indicator:checked{ background: white url(:/Img/box_checked.png) no-repeat center; border:1px solid #3685ED; }

QListView{ gridline-color: #E6ECF2; }
QListView::item:selected{ background: #C4DBFD; }

QMenu::item:hover, QMenu::item:selected{ background-color:#C4DBFD; }
  • 资源文件qrc文件的基本格式及内容记录,对应QT资源的resource_name.qrc文件
<RCC>
    <qresource prefix="/">
        <file>Img/bottom_triangle.png</file>
        <file>Img/box_checked.png</file>
        <file>Img/green_triangle.png</file>
        <file>Img/left_triangle.png</file>
        <file>Img/red_triangle.png</file>
        <file>Img/right_triangle.png</file>
        <file>Img/top_triangle.png</file>
    </qresource>
</RCC>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值