Re: Memory fault when inserting QTableItem into QTable

Richard Dale <[email protected]>
Newsgroups gmane.comp.kde.devel.perl
Organization Lost Highway
Message-ID <[email protected]>
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++;
     }
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.