qt history tab: fix double-clicking inside collapsible items
Swaps (both reverse and forward) are displayed in the list as a tree, which can be expanded/collapsed. When expanded, double-clicking on any of the children (regardless of child being LN or onchain), was interacting with the incorrect item (the first few items in the top-level list). Consider `self.tx_item_from_proxy_row(idx.row())`. `idx.row()` is probably a small int, e.g. `0`, and `tx_item_from_proxy_row` is just getting that item from the top-level list. Note that the right-click>"View ..." context menu behaves correctly, so prior to this commit it was inconsistent with double-clicking.
This commit is contained in:
@@ -421,8 +421,8 @@ class HistoryModel(CustomModel, Logger):
|
||||
HistoryColumns.TXID: 'TXID',
|
||||
}[section]
|
||||
|
||||
def flags(self, idx):
|
||||
extra_flags = Qt.NoItemFlags # type: Qt.ItemFlag
|
||||
def flags(self, idx: QModelIndex) -> int:
|
||||
extra_flags = Qt.NoItemFlags # type: Qt.ItemFlag
|
||||
if idx.column() in self.view.editable_columns:
|
||||
extra_flags |= Qt.ItemIsEditable
|
||||
return super().flags(idx) | int(extra_flags)
|
||||
@@ -658,11 +658,13 @@ class HistoryList(MyTreeView, AcceptFileDragDrop):
|
||||
assert False
|
||||
|
||||
def mouseDoubleClickEvent(self, event: QMouseEvent):
|
||||
idx = self.indexAt(event.pos())
|
||||
org_idx: QModelIndex = self.indexAt(event.pos())
|
||||
idx = self.proxy.mapToSource(org_idx)
|
||||
if not idx.isValid():
|
||||
# can happen e.g. before list is populated for the first time
|
||||
return
|
||||
tx_item = self.tx_item_from_proxy_row(idx.row())
|
||||
if self.hm.flags(self.model().mapToSource(idx)) & Qt.ItemIsEditable:
|
||||
tx_item = idx.internalPointer().get_data()
|
||||
if self.hm.flags(idx) & Qt.ItemIsEditable:
|
||||
super().mouseDoubleClickEvent(event)
|
||||
else:
|
||||
if tx_item.get('lightning'):
|
||||
|
||||
Reference in New Issue
Block a user