[Kde-perl] Memory fault when inserting QTableItem into QTable
Richard Dale
Richard_Dale at tipitina.demon.co.uk
Fri Jul 9 05:57:29 CEST 2004
On Monday 05 July 2004 14:42, Oliver Kreuer wrote:
> 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++;
> }
> }
>
Shouldn't the code above look something like this? I'm not sure if that is the
cause of the problem - would you be able to post a complete program/input
file that reproduces the bug?
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++;
}
More information about the Kde-perl
mailing list