# QssDemos
**Repository Path**: ariol/QssDemos
## Basic Information
- **Project Name**: QssDemos
- **Description**: No description available
- **Primary Language**: C++
- **License**: GPL-3.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2021-05-25
- **Last Updated**: 2021-05-25
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# QssDemos
Qt控件样式设置
- 边框
border
border-top
border-right
border-bottom
border-left
border-image
- 外边距
margin
margin-top
margin-right
margin-bottom
margin-left
- 内边框
padding
padding-top
padding-right
padding-bottom
padding-left
- 边角
border-radius
border-top-left-radius
border-top-right-radius
border-bottom-right-radius
border-bottom-left-radius
- 背景色
background
background-color
- 前景色
color
- 图片
image url("...")
- 表格
alternate-background //交替色
gridline-color //栅格
selection-background-color
selection-color
注:需在CPP文件添加 table->setAlternatingRowColors(true);
- 选中表格单元格后表头字体不高亮
QHeaderView::setHighlightSections(false);
- 下拉框
对下拉列表的样式设置需要在CPP代码里面手动设置:
//禁用item0
ui->comboBox->setItemData(0, 0, Qt::UserRole - 1);
//取消禁用item2
ui->comboBox->setItemData(2, -1, Qt::UserRole - 1);
//设置代理,以应用QSS
ui->comboBox->setView(new QListView);
Control-Name|Qss-MainPoints
-|-
[QCheckBox](https://github.com/tgtsml/QssDemos/blob/master/QCheckBox.txt)|::indicator, :checked, :unchecked, :indeterminate
[QComboBox](https://github.com/tgtsml/QssDemos/blob/master/QComboBox.txt)|::item, ::selected, ::drop-down, ::down-arrow
[QCompleter](https://github.com/tgtsml/QssDemos/blob/master/QCompleter.txt)|::item, QCompleter::popup()
[QScrollBar](https://github.com/tgtsml/QssDemos/blob/master/QScrollBar.txt)|::handle, ::sub-line, ::add-line, ::up-arrow, ::down-arrow, ::sub-page, ::add-page, ::left-arrow, ::right-arrow
[QSlider](https://github.com/tgtsml/QssDemos/blob/master/QSlider.txt)|::groove, ::handle, ::add-page, ::sub-page
[QTableView](https://github.com/tgtsml/QssDemos/blob/master/QTableView.txt)|QHeaderView::section, selection-background-color, selection-color, alternate-background-color
- Sub-Controls
```
::add-line
::add-page
::branch
::chunk
::close-button
::corner
::down-arrow
::down-button
::drop-down
::float-button
::groove
::indicator
::handle
::icon
::item
::left-arrow
::left-corner
::menu-arrow
::menu-button
::menu-indicator
::right-arrow
::pane
::right-corner
::scroller
::section
::separator
::sub-line
::sub-page
::tab
::tab-bar
::tear
::tearoff
::text
::title
::up-arrow
::up-button
```
- Pseudo-State
```
:active
:adjoins-item
:alternate
:bottom
:checked
:closable
:closed
:default
:disabled
:editable
:edit-focus
:enabled
:exclusive
:first
:flat
:floatable
:focus
:has-children
:has-siblings
:horizontal
:hover
:indeterminate
:last
:left
:maximized
:middle
:minimized
:movable
:no-frame
:non-exclusive
:off
:on
:only-one
:open
:next-selected
:pressed
:previous-selected
:read-only
:right
:selected
:top
:unchecked
:vertical
:window
```