thighlight current item only when we have the focus - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit b0a1f489006a633175daf1b5e367f5308e836da7 DIR parent a4da0866f39b082758940edeb125d22f20c6e1a9 HTML Author: ThomasV <thomasv@gitorious> Date: Sun, 10 Jun 2012 17:47:27 +0200 highlight current item only when we have the focus Diffstat: M lib/gui_qt.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) --- DIR diff --git a/lib/gui_qt.py b/lib/gui_qt.py t@@ -97,13 +97,24 @@ class MyTreeWidget(QTreeWidget): break else: return - for j in range(0,30): if self.itemAt(QPoint(0,i*5 + j)) != item: break - self.emit(SIGNAL('customContextMenuRequested(const QPoint&)'), QPoint(50, i*5 + j - 1)) + self.connect(self, SIGNAL('itemActivated(QTreeWidgetItem*, int)'), ddfr) + self.my_item = None + + def focusInEvent(self, e): + # we use column 1 because column 0 may be hidden + self.setCurrentItem(self.my_item,1) + + def focusOutEvent(self, e): + self.my_item = self.currentItem() + self.setCurrentItem(None) + + + class StatusBarButton(QPushButton): def __init__(self, icon, tooltip, func):