fix(StatusQ/Utils): Fix ModelChangeTracker and ModelUtils to handle properly

This commit is contained in:
Michał Cieślak 2023-02-21 20:52:42 +01:00 committed by r4bbit
parent 51928f5c20
commit c85a8d3647
2 changed files with 7 additions and 5 deletions

View File

@ -1,7 +1,7 @@
import QtQml 2.14
QtObject {
property alias model: d.target
property var model
readonly property alias revision: d.revision
@ -12,6 +12,8 @@ QtObject {
readonly property Connections _d: Connections {
id: d
target: model ?? null
property int revision: 0
function onRowsInserted() {

View File

@ -54,8 +54,8 @@ QtObject {
if (modelA === modelB)
return true
const countA = modelA === null ? 0 : modelA.rowCount()
const countB = modelB === null ? 0 : modelB.rowCount()
const countA = !!modelA ? modelA.rowCount() : 0
const countB = !!modelB ? modelB.rowCount() : 0
if (countA !== countB)
return false
@ -78,8 +78,8 @@ QtObject {
if (modelA === modelB)
return true
const countA = modelA === null ? 0 : modelA.rowCount()
const countB = modelB === null ? 0 : modelB.rowCount()
const countA = !!modelA ? modelA.rowCount() : 0
const countB = !!modelB ? modelB.rowCount() : 0
if (countA !== countB)
return false