From 206fe43ed1e25db8fbf2ae8d51a2b64e32cceee1 Mon Sep 17 00:00:00 2001 From: Martin Baeuml Date: Mon, 16 May 2011 18:16:18 +0200 Subject: [PATCH] color rows in treeview alternating --- annotations/model.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/annotations/model.py b/annotations/model.py index 7c608ca..a8f2c29 100644 --- a/annotations/model.py +++ b/annotations/model.py @@ -463,9 +463,16 @@ class AnnotationTreeView(QTreeView): super(AnnotationTreeView, self).__init__(parent) self.setUniformRowHeights(True) + self.setSelectionMode(QTreeView.SingleSelection) self.setSelectionBehavior(QTreeView.SelectItems) + self.setAllColumnsShowFocus(True) + self.setAlternatingRowColors(True) self.setEditTriggers(QAbstractItemView.SelectedClicked) self.setSortingEnabled(True) + self.setStyleSheet(""" + QTreeView { selection-color: blue; show-decoration-selected: 1; } + QTreeView::item:alternate { background-color: #EEEEEE; } + """) self.connect(self, SIGNAL("expanded(QModelIndex)"), self.expanded) @@ -497,8 +504,6 @@ class AnnotationTreeView(QTreeView): self.resizeColumns() # self.setCurrentIndex(index.child(end, 0)) - def selectionModel(self): - return QAbstractItemView.selectionModel(self) def someAnnotations(): annotations = []