注释只为解释,qss语法并不能直接这样写,美化控件时,下面的所有选项并不需要全部进行设置,自行选择
一、QListView
QListView可以用来以列表的形式展示数据
二、qss样式
QListView
{
//子类中使用的备用颜色。如果未设置此属性,则默认值为调色板的AlternateBase角色设置的值
alternate-background-color: yellow;
}
QListView
{
//控制QListVIew中选择是覆盖整个行还是仅覆盖文本的范围
show-decoration-selected: 1; /* make the selection span the entire width of the view */
}
QListView::item:alternate //替换状态
{
background: #EEEEEE;
}
QListView::item:selected //选中项
{
border: 1px solid #6a6ea9;
}
//鼠标放上去或键盘选择就选中,激活需要鼠标点击
QListView::item:selected:!active //选中项处于没有处于活动窗口中时
{
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #ABAFE5, stop: 1 #8588B2);
}
QListView::item:selected:active //选中并处于激活状态时
{
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #6a6ea9, stop: 1 #888dd9);
}
QListView::item:hover //鼠标放上去时
{
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #FAFBFE, stop: 1 #DCDEF1);
}