Skip to content

Commit

Permalink
[outputs] refs#295 update how dataChange work in addresses model
Browse files Browse the repository at this point in the history
  • Loading branch information
stdevMac committed Feb 10, 2020
1 parent 16e478e commit 2ab3077
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/models/modelAddresses.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (m *ModelAddresses) insertRows(row int, count int) bool {
}

func (m *ModelAddresses) addOutputs(mo []*ModelOutputs) {
for _, mOut := range mo {
for row, mOut := range mo {
find := false
for _, mOutSet := range m.outputs {
if mOut.Address() == mOutSet.Address() {
Expand All @@ -87,9 +87,11 @@ func (m *ModelAddresses) addOutputs(mo []*ModelOutputs) {
}
}
if !find {
m.BeginInsertRows(core.NewQModelIndex(), row, row)
m.outputs = append(m.outputs, mOut)
m.EndInsertRows()
} else {
m.DataChanged(m.Index(len(m.outputs)-1, row, core.NewQModelIndex()), m.Index(len(m.outputs)-1, row+1, core.NewQModelIndex()), []int{int(core.Qt__DisplayRole)})
}
}
m.outputs = append(m.outputs, mo...)
m.insertRows(len(m.outputs), len(mo))
}

0 comments on commit 2ab3077

Please sign in to comment.