Uga*_*uga 4 qt qtableview qt5 qtstylesheets
当QTableView编辑控件对于当前项目可见时,将进行编辑的shylesheet.当没有活动的编辑控件时,QTableView使用QTableView { selection-background-color: }如何仅为当前项设置不同的样式来设置当前项的样式?

Fab*_*bio 14
Qt样式表支持子控件和伪状态,您可以使用它来改进自定义.(见http://qt-project.org/doc/qt-5/stylesheet-reference.html#list-of-pseudo-states)
在这种情况下,您可以使用::item子控件和:focus伪状态("当前"伪状态不存在,但:focus执行相同).
这是一个可以使用的示例:
QTableView::item:focus
{
selection-background-color: yellow;
}
Run Code Online (Sandbox Code Playgroud)

另见http://qt-project.org/doc/qt-5/stylesheet-examples.html#customizing-qtreeview
| 归档时间: |
|
| 查看次数: |
16643 次 |
| 最近记录: |