Browse Source

qt history: data() should return QVariant

the docs says so,
and also HistoryList.create_menu() was crashing sometimes re "Copy {}"
3.3.3.1
SomberNight 6 years ago
parent
commit
0ec7005f90
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 6
      electrum/gui/qt/history_list.py

6
electrum/gui/qt/history_list.py

@ -105,7 +105,7 @@ class HistoryModel(QAbstractItemModel, PrintError):
def index(self, row: int, column: int, parent: QModelIndex):
return self.createIndex(row, column)
def data(self, index: QModelIndex, role: Qt.ItemDataRole):
def data(self, index: QModelIndex, role: Qt.ItemDataRole) -> QVariant:
# note: this method is performance-critical.
# it is called a lot, and so must run extremely fast.
assert index.isValid()
@ -161,7 +161,7 @@ class HistoryModel(QAbstractItemModel, PrintError):
and not tx_item.get('fiat_default') and tx_item.get('fiat_value') is not None:
blue_brush = QBrush(QColor("#1E1EFF"))
return QVariant(blue_brush)
return None
return QVariant()
if col == HistoryColumns.STATUS_TEXT:
return QVariant(status_str)
elif col == HistoryColumns.DESCRIPTION:
@ -187,7 +187,7 @@ class HistoryModel(QAbstractItemModel, PrintError):
return QVariant(self.parent.fx.format_fiat(cg))
elif col == HistoryColumns.TXID:
return QVariant(tx_hash)
return None
return QVariant()
def parent(self, index: QModelIndex):
return QModelIndex()

Loading…
Cancel
Save