Skip to content

qml: add new page; history for address#10749

Open
accumulator wants to merge 1 commit into
spesmilo:masterfrom
accumulator:qml_address_history
Open

qml: add new page; history for address#10749
accumulator wants to merge 1 commit into
spesmilo:masterfrom
accumulator:qml_address_history

Conversation

@accumulator

Copy link
Copy Markdown
Member

No description provided.


@pyqtSlot(str, result=QETransactionListModel)
def historyModelForAddress(self, address):
self._hmfa = QETransactionListModel(self.wallet, onchain_domain=[address], include_lightning=False)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be some lifetime issue. When stacking multiple AddressHistory, by clicking on the addresses and then show repeatedly, the previous AddressHistory lose their content when going back again:

Image

Couldn't you pass the model built by AddressDetails to AddressHistory which lives on top, so the AddressDetails own the model? This seems to fix the issue for me.

Like this: (click to expand)
diff --git a/electrum/gui/qml/components/AddressDetails.qml b/electrum/gui/qml/components/AddressDetails.qml
index 8f26a9dca..a376d63ef 100644
--- a/electrum/gui/qml/components/AddressDetails.qml
+++ b/electrum/gui/qml/components/AddressDetails.qml
@@ -108,7 +108,10 @@ Pane {
                         visible: addressdetails.numTx
                         text: '(<a href="#">' + qsTr("show...") + '</a>)'
                         textFormat: Text.StyledText
-                        onLinkActivated: app.stack.push(Qt.resolvedUrl('AddressHistory.qml'), { address: root.address })
+                        onLinkActivated: app.stack.push(Qt.resolvedUrl('AddressHistory.qml'), {
+                            address: root.address,
+                            backingModel: addressdetails.historyModel
+                        })
                     }
                 }
 
diff --git a/electrum/gui/qml/components/AddressHistory.qml b/electrum/gui/qml/components/AddressHistory.qml
index 7f166722e..cd13b6191 100644
--- a/electrum/gui/qml/components/AddressHistory.qml
+++ b/electrum/gui/qml/components/AddressHistory.qml
@@ -14,6 +14,7 @@ Pane {
     padding: 0
 
     required property string address
+    required property QtObject backingModel
 
     ColumnLayout {
         anchors.fill: parent
@@ -51,6 +52,7 @@ Pane {
             History {
                 anchors.fill: parent
                 forAddress: root.address
+                backingModel: root.backingModel
             }
         }
     }
diff --git a/electrum/gui/qml/components/History.qml b/electrum/gui/qml/components/History.qml
index c0e16514f..2336ace1b 100644
--- a/electrum/gui/qml/components/History.qml
+++ b/electrum/gui/qml/components/History.qml
@@ -19,9 +19,7 @@ Pane {
     }
 
     property string forAddress
-    property QtObject backingModel: forAddress
-        ? Daemon.currentWallet.historyModelForAddress(forAddress)
-        : Daemon.currentWallet.historyModel
+    property QtObject backingModel: Daemon.currentWallet.historyModel
 
     ElListView {
         id: listview
diff --git a/electrum/gui/qml/qewallet.py b/electrum/gui/qml/qewallet.py
index 97682d792..eeabf5261 100644
--- a/electrum/gui/qml/qewallet.py
+++ b/electrum/gui/qml/qewallet.py
@@ -304,11 +304,6 @@ class QEWallet(AuthMixin, QObject, QtEventListener):
             self._historyModel = QETransactionListModel(self.wallet)
         return self._historyModel
 
-    @pyqtSlot(str, result=QETransactionListModel)
-    def historyModelForAddress(self, address):
-        self._hmfa = QETransactionListModel(self.wallet, onchain_domain=[address], include_lightning=False)
-        return self._hmfa
-
     addressCoinModelChanged = pyqtSignal()
     @pyqtProperty(QEAddressCoinListModel, notify=addressCoinModelChanged)
     def addressCoinModel(self):

Comment on lines 152 to 154
function onHeightChanged(height) {
Daemon.currentWallet.historyModel.updateBlockchainHeight(height)
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The clock icon/height is not updated in the address history:

diff --git a/electrum/gui/qml/components/History.qml b/electrum/gui/qml/components/History.qml
index c0e16514f..2be803a31 100644
--- a/electrum/gui/qml/components/History.qml
+++ b/electrum/gui/qml/components/History.qml
@@ -150,7 +150,8 @@ Pane {
     Connections {
         target: Network
         function onHeightChanged(height) {
-            Daemon.currentWallet.historyModel.updateBlockchainHeight(height)
+            if (backingModel)
+                backingModel.updateBlockchainHeight(height)
         }
     }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants