goqt
goqt copied to clipboard
QListWidgetItem is garbage collected
If I add a QListWidgetItem to a QListWidget, it's initially visible in the list, but soon disappears.
listWidget := ui.NewListWidget()
item := ui.NewListWidgetItem()
item.SetText("some text")
listWidget.AddItem(item)
It seems that it's garbage collected, and that results in it disappearing from the list.
If I deliberately make sure that a reference to the item is kept, it doesn't disappear.
time.AfterFunc(time.Hour*10000, func() {
fmt.Println(item)
})
Is this expected behaviour? If it is, what's the recommended way of dealing with it?