• 4913阅读
  • 7回复

请教关于QListView 的问题 [复制链接]

上一主题 下一主题
离线zlz1215312
 
只看楼主 倒序阅读 楼主  发表于: 2009-12-23
— 本帖被 XChinux 从 General Qt Programming 移动到本区(2011-01-02) —
请教各位老大  怎么才能改变QListView选中行的颜色? (默认的是深蓝色)
怎么改成其他颜色
[ 此帖被zlz1215312在2009-12-23 16:09重新编辑 ]
离线zlz1215312
只看该作者 1楼 发表于: 2009-12-24
请各位老大 指教指教~~~~~~~~
离线benbenmajia

只看该作者 2楼 发表于: 2009-12-24
先看一下QListView类的借口
安然.....
离线benbenmajia

只看该作者 3楼 发表于: 2009-12-24
我也没找到...
安然.....
离线yb824
只看该作者 4楼 发表于: 2009-12-24
不知道管不管用~~
To provide a special background when you hover over items, we can use the ::item subcontrol. For example,

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);
}
离线zlz1215312
只看该作者 5楼 发表于: 2009-12-24
我的是C++  用的QT3.3.8
离线yb824
只看该作者 6楼 发表于: 2009-12-24
我用的也是C++ QT4.6
ui->listView->setStyleSheet("QListView::item:selected {background: #ff0000;}");
离线zlz1215312
只看该作者 7楼 发表于: 2009-12-24
QT  3.3.8  
没有这个函数的调用吧
快速回复
限100 字节
 
上一个 下一个