goqt icon indicating copy to clipboard operation
goqt copied to clipboard

QListWidgetItem is garbage collected

Open pekim opened this issue 9 years ago • 0 comments

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?

pekim avatar May 01 '16 20:05 pekim