[Kde-perl] Removing widgets and undef.

Tom Szybist tszybist at comcast.net
Thu Oct 21 17:16:11 CEST 2004


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


More information about the Kde-perl mailing list