Removing widgets and undef.

Tom Szybist <[email protected]>
Newsgroups gmane.comp.kde.devel.perl
Message-ID <[email protected]>
Hi,

What is the best way to remove widgets and cleanup?  Specifically, I'm 
interested in listViewItems.

"undef" inside slots doesn't seem to call the destructor.  I'm assuming 
it's because of the reference count:

sub goodBye : SLOT(QListViewItem*) {
    my $list = shift;
    undef $list;
}

(delete in C++ works in a similar situation).

But even outside a slot, undef doesn't seem work:

my $w = Qt::ListView();
$w->addColumn("Hello");
my $jj = Qt::ListViewItem($w, "Hello");
undef $jj;

In this case, the ListViewItem still appears.

However, undef'ing buttons does work.  This doesn't draw the button:

my $w = Qt::VBox();
my $butt = Button("Hello World!", $w);
undef $butt;

I know I can use takeItem for the ListViewItem, but I'm still interested in 
the proper way to delete objects, particularly inside slots.

Should I just the garbage collection do it's job and not worry about it?

Thanks,

Tom
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.