From 421edbfa1e57140fba71b2409a746646e2beb2d0 Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Sat, 9 Jun 2018 16:03:45 -0700 Subject: [PATCH] PSFListModel isa ListModel instead of hasa --- interface/resources/qml/hifi/Feed.qml | 2 +- interface/resources/qml/hifi/Pal.qml | 2 +- .../commerce/common/sendAsset/SendAsset.qml | 2 +- .../qml/hifi/commerce/purchases/Purchases.qml | 2 +- .../qml/hifi/commerce/wallet/WalletHome.qml | 2 +- .../qml/hifi/models/PSFListModel.qml | 26 ++++--------------- 6 files changed, 10 insertions(+), 26 deletions(-) diff --git a/interface/resources/qml/hifi/Feed.qml b/interface/resources/qml/hifi/Feed.qml index d7d469364c..d9e93c2fa7 100644 --- a/interface/resources/qml/hifi/Feed.qml +++ b/interface/resources/qml/hifi/Feed.qml @@ -98,7 +98,7 @@ Column { } ListView { id: scroll; - model: suggestions.model; + model: suggestions; orientation: ListView.Horizontal; highlightFollowsCurrentItem: false highlightMoveDuration: -1; diff --git a/interface/resources/qml/hifi/Pal.qml b/interface/resources/qml/hifi/Pal.qml index d9625a68c2..8dcb76442b 100644 --- a/interface/resources/qml/hifi/Pal.qml +++ b/interface/resources/qml/hifi/Pal.qml @@ -785,7 +785,7 @@ Rectangle { resizable: false; } - model: connectionsUserModel.model; + model: connectionsUserModel; Connections { target: connectionsTable.flickableItem; onAtYEndChanged: { diff --git a/interface/resources/qml/hifi/commerce/common/sendAsset/SendAsset.qml b/interface/resources/qml/hifi/commerce/common/sendAsset/SendAsset.qml index 1353ceab72..3e4bae4780 100644 --- a/interface/resources/qml/hifi/commerce/common/sendAsset/SendAsset.qml +++ b/interface/resources/qml/hifi/commerce/common/sendAsset/SendAsset.qml @@ -519,7 +519,7 @@ Item { } visible: !connectionsLoading.visible; clip: true; - model: connectionsModel.model; + model: connectionsModel; onAtYEndChanged: if (connectionsList.atYEnd && !connectionsList.atYBeginning) { connectionsModel.getNextPage(); } snapMode: ListView.SnapToItem; // Anchors diff --git a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml index ec2798680e..c792b88c1e 100644 --- a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml +++ b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml @@ -583,7 +583,7 @@ Rectangle { id: purchasesContentsList; visible: purchasesModel.count !== 0; clip: true; - model: purchasesModel.model; + model: purchasesModel; snapMode: ListView.SnapToItem; // Anchors anchors.top: separator.bottom; diff --git a/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml b/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml index ed032dd055..4cf6db7889 100644 --- a/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml +++ b/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml @@ -323,7 +323,7 @@ Item { height: parent.height; visible: transactionHistoryModel.count !== 0; clip: true; - model: transactionHistoryModel.model; + model: transactionHistoryModel; delegate: Item { width: parent.width; height: (model.transaction_type === "pendingCount" && model.count !== 0) ? 40 : ((model.status === "confirmed" || model.status === "invalidated") ? transactionText.height + 30 : 0); diff --git a/interface/resources/qml/hifi/models/PSFListModel.qml b/interface/resources/qml/hifi/models/PSFListModel.qml index 95e9e1b79e..8d1674e1de 100644 --- a/interface/resources/qml/hifi/models/PSFListModel.qml +++ b/interface/resources/qml/hifi/models/PSFListModel.qml @@ -17,7 +17,7 @@ import QtQuick 2.7 -Item { +ListModel { id: root; // Used when printing debug statements property string listModelName: endpoint; @@ -50,7 +50,7 @@ Item { // Not normally set directly, but rather by giving a truthy argument to getFirstPage(true); property bool delayedClear: false; function resetModel() { - if (!delayedClear) { finalModel.clear(); } + if (!delayedClear) { root.clear(); } currentPageToRetrieve = 1; retrievedAtLeastOnePage = false; } @@ -87,12 +87,12 @@ Item { } if (delayedClear) { - finalModel.clear(); + root.clear(); delayedClear = false; } - finalModel.append(processed); // FIXME keep index steady, and apply any post sort + root.append(processed); // FIXME keep index steady, and apply any post sort retrievedAtLeastOnePage = true; - debugView('after handlePage'); + console.debug(listModelName, 'after handlePage count', root.count); } function debugView(label) { if (!listView) { return; } @@ -152,20 +152,4 @@ Item { requestPending = true; getPage(); } - - // Redefining members and methods so that the parent of this Item - // can use PSFListModel as they would a regular ListModel - property alias model: finalModel; - property alias count: finalModel.count; - function clear() { finalModel.clear(); } - function get(index) { return finalModel.get(index); } - function remove(index) { return finalModel.remove(index); } - function setProperty(index, prop, value) { return finalModel.setProperty(index, prop, value); } - function move(from, to, n) { return finalModel.move(from, to, n); } - function insert(index, newElement) { finalModel.insert(index, newElement); } - function append(newElements) { finalModel.append(newElements); } - - ListModel { - id: finalModel; - } } \ No newline at end of file