Memory fault when inserting QTableItem into QTable

Oliver Kreuer <[email protected]>
Newsgroups gmane.comp.kde.devel.perl
Message-ID <[email protected]>
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
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.