From cf5fdeb99816e89901ca74417930f21fa783cf4a Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Sat, 27 Feb 2010 04:17:55 -0800 Subject: [PATCH] views.status: Use QTreeWidget.indentation() instead of magic numbers Qt knows the size of the tree widget's indentation so use a derived value instead of hard-coding the x-offset to the icon. Signed-off-by: David Aguilar --- cola/views/status.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cola/views/status.py b/cola/views/status.py index b0639a0d..29d30a26 100644 --- a/cola/views/status.py +++ b/cola/views/status.py @@ -443,9 +443,11 @@ class StatusWidget(QtGui.QWidget): return result # Handle when the icons are clicked - # TODO query Qt for the event position relative to the icon. + indent = self.tree.indentation() xpos = event.pos().x() - if xpos > 45 and xpos < 59: + indent = indent * 2 + iconwidth = 22 + if indent < xpos < indent + iconwidth: if staged: cola.notifier().broadcast(signals.unstage, self.staged()) else: -- 2.11.4.GIT