[Kde-perl] Memory fault when inserting QTableItem into QTable
Oliver Kreuer
okreuer at PSI.de
Mon Jul 5 15:42:01 CEST 2004
Hello,
I've written the following small Perl/Qt program:
...
table = Qt::Table(frame6, "table");
table->setNumRows( int(0) );
table->setNumCols( int(0) );
table->setReadOnly( 1 );
table->setSelectionMode( &Qt::Table::NoSelection() );
table->setLeftMargin(0);
...
open (FILE,"table_example.one") or die;
while (defined (my $line = <FILE>))
{
chomp($line);
push (@lines,$line);
clearTable();
table->setNumCols(1);
table->horizontalHeader()->setStretchEnabled(1);
table->horizontalHeader()->setLabel(0,"Eine Spalte",-1);
table->setNumRows(scalar(@lines));
my $row = 0;
foreach my $element (@lines)
{
table->setItem($row,0,Qt::TableItem(table,&Qt::TableItem::Never,"
$element"));
$row++;
}
}
The file "table_example.one" contains one string per line. Every string
shall be shown in one row of the table.
But every time my program terminates with a "memory fault" while
executing "setItem". Why?
I'm using Perl 5.8.3, Qt 3.2.3 and libqt-perl 3.008-1 with Debian GNU/Linux.
Thanks for your help,
Oliver
More information about the Kde-perl
mailing list