
Код, используемый для оформления QTreeView:
self.tree_view.setStyleSheet("""
QTreeView {
padding: 9px;
background-color: #000000;
outline: 0px;
}
QTreeView::item {
padding: 9px 9px;
color: white; /* Text color */
border-radius: 9px; /* Rounded corners */
background: transparent; /* Default background */
}
QTreeView::item:hover {
background-color: #FF0000; /* Background color on hover */
color: #FFFFFF; /* Text color on hover */
border-radius: 19px; /* Rounded corners */
margin-left: 9px; /* Fixed-width effect by adding margins */
margin-right: 9px;
}
QTreeView::item:selected {
background-color: #FF0000; /* Background color when selected */
color: #FFFFFF; /* Text color when selected */
border-radius: 19px;
padding: 9px 9px;
margin-left: 9px; /* Fixed-width effect by adding margins */
margin-right: 9px;
}""")
Подробнее здесь: https://stackoverflow.com/questions/792 ... -qtreeview