add forceLayout

This was an attempt at forcing the layout of the ListView so that it
will adjust to model changes properly. It only sort of works. There
are still occasional overlapping items.
This commit is contained in:
Chris Cochrun 2023-03-12 06:31:06 -05:00
parent e2e44f1c3c
commit 58a85bcc01

View file

@ -534,11 +534,13 @@ Item {
function removeItem(index) { function removeItem(index) {
ServiceItemModel.removeItem(index); ServiceItemModel.removeItem(index);
serviceItemList.forceLayout()
/* totalServiceItems--; */ /* totalServiceItems--; */
} }
function removeItems() { function removeItems() {
ServiceItemModel.removeItems(); ServiceItemModel.removeItems();
serviceItemList.forceLayout()
} }
function addItem(index, type, itemID) { function addItem(index, type, itemID) {
@ -550,6 +552,7 @@ Item {
type, image.filePath, type, image.filePath,
"image", "", "", "image", "", "",
"", 0, 0, false); "", 0, 0, false);
serviceItemList.forceLayout()
return; return;
} }
case 'video': { case 'video': {
@ -559,6 +562,7 @@ Item {
type, video.filePath, type, video.filePath,
"video", "", "", "video", "", "",
"", 0, 0, video.loop); "", 0, 0, video.loop);
serviceItemList.forceLayout()
return; return;
} }
case 'song': { case 'song': {
@ -573,6 +577,7 @@ Item {
song.backgroundType, lyrics, song.backgroundType, lyrics,
song.audio, song.font, song.fontSize, song.audio, song.font, song.fontSize,
lyrics.length, true); lyrics.length, true);
serviceItemList.forceLayout()
return; return;
} }
case 'presentation': { case 'presentation': {
@ -584,10 +589,12 @@ Item {
type, pres.filePath, type, pres.filePath,
"image", "", "image", "",
"", "", 0, pres.pageCount, false); "", "", 0, pres.pageCount, false);
serviceItemList.forceLayout()
return; return;
} }
default: return; default: return;
} }
serviceItemList.forceLayout()
/* totalServiceItems++; */ /* totalServiceItems++; */
} }
@ -600,6 +607,7 @@ Item {
type, image.filePath, type, image.filePath,
"image", "", "", "image", "", "",
"", 0, 0, false); "", 0, 0, false);
serviceItemList.forceLayout()
return; return;
} }
case 'video': { case 'video': {
@ -609,6 +617,7 @@ Item {
type, video.filePath, type, video.filePath,
"video", "", "", "video", "", "",
"", 0, 0, video.loop); "", 0, 0, video.loop);
serviceItemList.forceLayout()
return; return;
} }
case 'song': { case 'song': {
@ -622,6 +631,7 @@ Item {
song.backgroundType, lyrics, song.backgroundType, lyrics,
song.audio, song.font, song.fontSize, song.audio, song.font, song.fontSize,
lyrics.length, true); lyrics.length, true);
serviceItemList.forceLayout()
return; return;
} }
case 'presentation': { case 'presentation': {
@ -634,10 +644,12 @@ Item {
"image", "", "image", "",
"", "", 0, pres.pageCount, "", "", 0, pres.pageCount,
false); false);
serviceItemList.forceLayout()
return; return;
} }
default: return; default: return;
} }
serviceItemList.forceLayout()
} }
function selectItems(index) { function selectItems(index) {