mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 18:42:58 +02:00
PSFListModel isa ListModel instead of hasa
This commit is contained in:
parent
d2cf042a88
commit
421edbfa1e
6 changed files with 10 additions and 26 deletions
|
@ -98,7 +98,7 @@ Column {
|
||||||
}
|
}
|
||||||
ListView {
|
ListView {
|
||||||
id: scroll;
|
id: scroll;
|
||||||
model: suggestions.model;
|
model: suggestions;
|
||||||
orientation: ListView.Horizontal;
|
orientation: ListView.Horizontal;
|
||||||
highlightFollowsCurrentItem: false
|
highlightFollowsCurrentItem: false
|
||||||
highlightMoveDuration: -1;
|
highlightMoveDuration: -1;
|
||||||
|
|
|
@ -785,7 +785,7 @@ Rectangle {
|
||||||
resizable: false;
|
resizable: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
model: connectionsUserModel.model;
|
model: connectionsUserModel;
|
||||||
Connections {
|
Connections {
|
||||||
target: connectionsTable.flickableItem;
|
target: connectionsTable.flickableItem;
|
||||||
onAtYEndChanged: {
|
onAtYEndChanged: {
|
||||||
|
|
|
@ -519,7 +519,7 @@ Item {
|
||||||
}
|
}
|
||||||
visible: !connectionsLoading.visible;
|
visible: !connectionsLoading.visible;
|
||||||
clip: true;
|
clip: true;
|
||||||
model: connectionsModel.model;
|
model: connectionsModel;
|
||||||
onAtYEndChanged: if (connectionsList.atYEnd && !connectionsList.atYBeginning) { connectionsModel.getNextPage(); }
|
onAtYEndChanged: if (connectionsList.atYEnd && !connectionsList.atYBeginning) { connectionsModel.getNextPage(); }
|
||||||
snapMode: ListView.SnapToItem;
|
snapMode: ListView.SnapToItem;
|
||||||
// Anchors
|
// Anchors
|
||||||
|
|
|
@ -583,7 +583,7 @@ Rectangle {
|
||||||
id: purchasesContentsList;
|
id: purchasesContentsList;
|
||||||
visible: purchasesModel.count !== 0;
|
visible: purchasesModel.count !== 0;
|
||||||
clip: true;
|
clip: true;
|
||||||
model: purchasesModel.model;
|
model: purchasesModel;
|
||||||
snapMode: ListView.SnapToItem;
|
snapMode: ListView.SnapToItem;
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: separator.bottom;
|
anchors.top: separator.bottom;
|
||||||
|
|
|
@ -323,7 +323,7 @@ Item {
|
||||||
height: parent.height;
|
height: parent.height;
|
||||||
visible: transactionHistoryModel.count !== 0;
|
visible: transactionHistoryModel.count !== 0;
|
||||||
clip: true;
|
clip: true;
|
||||||
model: transactionHistoryModel.model;
|
model: transactionHistoryModel;
|
||||||
delegate: Item {
|
delegate: Item {
|
||||||
width: parent.width;
|
width: parent.width;
|
||||||
height: (model.transaction_type === "pendingCount" && model.count !== 0) ? 40 : ((model.status === "confirmed" || model.status === "invalidated") ? transactionText.height + 30 : 0);
|
height: (model.transaction_type === "pendingCount" && model.count !== 0) ? 40 : ((model.status === "confirmed" || model.status === "invalidated") ? transactionText.height + 30 : 0);
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
import QtQuick 2.7
|
import QtQuick 2.7
|
||||||
|
|
||||||
Item {
|
ListModel {
|
||||||
id: root;
|
id: root;
|
||||||
// Used when printing debug statements
|
// Used when printing debug statements
|
||||||
property string listModelName: endpoint;
|
property string listModelName: endpoint;
|
||||||
|
@ -50,7 +50,7 @@ Item {
|
||||||
// Not normally set directly, but rather by giving a truthy argument to getFirstPage(true);
|
// Not normally set directly, but rather by giving a truthy argument to getFirstPage(true);
|
||||||
property bool delayedClear: false;
|
property bool delayedClear: false;
|
||||||
function resetModel() {
|
function resetModel() {
|
||||||
if (!delayedClear) { finalModel.clear(); }
|
if (!delayedClear) { root.clear(); }
|
||||||
currentPageToRetrieve = 1;
|
currentPageToRetrieve = 1;
|
||||||
retrievedAtLeastOnePage = false;
|
retrievedAtLeastOnePage = false;
|
||||||
}
|
}
|
||||||
|
@ -87,12 +87,12 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (delayedClear) {
|
if (delayedClear) {
|
||||||
finalModel.clear();
|
root.clear();
|
||||||
delayedClear = false;
|
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;
|
retrievedAtLeastOnePage = true;
|
||||||
debugView('after handlePage');
|
console.debug(listModelName, 'after handlePage count', root.count);
|
||||||
}
|
}
|
||||||
function debugView(label) {
|
function debugView(label) {
|
||||||
if (!listView) { return; }
|
if (!listView) { return; }
|
||||||
|
@ -152,20 +152,4 @@ Item {
|
||||||
requestPending = true;
|
requestPending = true;
|
||||||
getPage();
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue