Qt手动设置滚动条的qss样式

 

QScrollBar:vertical {
     width: 14px;
     margin: 16px 0 16px 0;
     background: #eaeaea;
}

QScrollBar::handle:vertical {
     background: #c8c8c8;
     min-height: 16px;
     border-left: 1px solid #cccccc;
     border-right: 1px solid #cccccc;
     border-top: 1px solid #ffffff;
     border-bottom: 1px solid #bbbbbb;
}

QScrollBar::handle:vertical:hover {
     background: #606060;
     min-height: 16px;
     border-left: 1px solid #cccccc;
     border-right: 1px solid #cccccc;
     border-top: 1px solid #ffffff;
     border-bottom: 1px solid #bbbbbb;
}

 QScrollBar::add-line:vertical {
     background: #eaeaea;
     height: 15px;
     subcontrol-position: bottom;
     subcontrol-origin: margin;
     border-top: 1px solid #ffffff;
}

QScrollBar::sub-line:vertical {
     background: #eaeaea;
     height: 15px;
     subcontrol-position: top;
     subcontrol-origin: margin;
     border-bottom: 1px solid #bbbbbb;
}

 QScrollBar::add-line:vertical:hover {
     background: #606060;
     height: 15px;
     subcontrol-position: bottom;
     subcontrol-origin: margin;
     border-top: 1px solid #ffffff;
}

QScrollBar::sub-line:vertical:hover {
     background: #606060;
     height: 15px;
     subcontrol-position: top;
     subcontrol-origin: margin;
     border-bottom: 1px solid #bbbbbb;
}

QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
     background: none;
}


QScrollBar:horizontal {
     height: 14px;
     margin: 0 16px 0 16px;
     background: #eaeaea;
}

QScrollBar::handle:horizontal {
     background: #c8c8c8;
     min-width: 16px;
     border-left: 1px solid #cccccc;
     border-right: 1px solid #cccccc;
     border-left: 1px solid #ffffff;
     border-right: 1px solid #bbbbbb;
}

QScrollBar::handle:horizontal:hover {
     background: #606060;
     min-width: 16px;
     border-left: 1px solid #cccccc;
     border-right: 1px solid #cccccc;
     border-left: 1px solid #ffffff;
     border-right: 1px solid #bbbbbb;
}

QScrollBar::add-line:horizontal {
     background: #eaeaea;
     width: 15px;
     subcontrol-position: right;
     subcontrol-origin: margin;
     border-left: 1px solid #ffffff;
}

QScrollBar::sub-line:horizontal {
     background: #eaeaea;
     width: 15px;
     subcontrol-position: left;
     subcontrol-origin: margin;
     border-right: 1px solid #bbbbbb;
}


QScrollBar::add-line:horizontal:hover {
     background: #606060;
     width: 15px;
     subcontrol-position: right;
     subcontrol-origin: margin;
     border-left: 1px solid #ffffff;
}

QScrollBar::sub-line:horizontal:hover {
     background: #606060;
     width: 15px;
     subcontrol-position: left;
     subcontrol-origin: margin;
     border-right: 1px solid #bbbbbb;
}

QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal {
     background: none;
}

 

 posted on 2017-09-04 18:20  Lucien.Bao  阅读(575)  评论(0编辑  收藏  举报