[Kde-perl] Perl-Qt4?

Agbaria, Rasheed rasheed.agbaria at intel.com
Wed May 31 16:00:58 CEST 2006


There is already reported WA,

Define your own table :

package MyTable;
use strict;
use Qt;
use Qt::isa qw(Qt::Table);

sub NEW {
    shift->SUPER::NEW(@_);
}

sub Qt::Table::takeItem {
}

1;


===============================
Inside your code use MyTable instead of table:
package main;
use MyTable;
use strict;
use Qt;

my $a = Qt::Application(\@ARGV);

my $table = MyTable();
$table->setNumRows( int(1) );
$table->setNumCols( int(1) );
$table->setText(0,0,'Hello');

$a->setMainWidget($table);
$table->show;
# Uncomment out either of the next to lines to reproduce the problem
$table->setNumRows(0);
#$table->removeRow(0);

exit $a->exec;


this code worked fine.


-----Original Message-----
From: Joe Claborn [mailto:joe at claborn.net] 
Sent: Wednesday, May 31, 2006 4:24 PM
To: kde-perl at kde.org
Subject: Re: [Kde-perl] Perl-Qt4?

Ole,
Thanks for the reply. I think the problem is more fundamental than your 
solution suggests. Here is the code that crashes.

use strict;
use Qt;

my $a = Qt::Application(\@ARGV);

my $table = Qt::Table();
$table->setNumRows( int(1) );
$table->setNumCols( int(1) );
$table->setText(0,0,'Hello');

$a->setMainWidget($table);
$table->show;
# Uncomment out either of the next to lines to reproduce the problem
$table->setNumRows(0);
#$table->removeRow(0);

exit $a->exec;

gives
*** glibc detected *** double free or corruption (fasttop): 0x085b1c10
***
Aborted

So if I can not add text to a table and then reduce the size of the
table, I'm 
not show that it is usable.

Thanks again,

Joe



On Wednesday 31 May 2006 12:27 am, Ole Christensen wrote:
> Joe,
>
> sorry for responding late.
>
> Your problem can probably be solved by holding references to all table
> items in a "shadow table". I once used that approach for some other
issue
> with table items. Works without any problem for me. Sorry, I am in a
hurry.
> So, very brief:
>
> Put a copy (the reference) of each item you create in the Qt table
into a
> raw Perl table (array of refs to arrays). When you have deleted the
item,
> you can finally remove the item's copy.
>
> Let me know, if this is too short to understand.
>
> Cheers,
> Ole.
>
> Joe Claborn wrote:
> > On Tuesday 30 May 2006 4:30 pm,
> >
> >> You;re not getting the point, I've over 20,000 lines of code
written in
> >> Perl-Qt for PhoeNUX's GUI tools and DO NOT want to port to yet
another
> >> language. Please Ashley, say that there is a port planned :)
> >
> > We too have a substantial number of lines written in Perl-Qt.  And
as we
> > have not been able to solve the setNumRows(0) crashes, I'm looking
at
> > Ruby or C++. I like what I've read about Ruby, but I worried about
> > getting into another situation where I'm not writting in the 'base'
> > language of the tool. If we port to Ruby, and then in a couple of
years
> > Ruby-Qt fades away as it appears that Perl-Qt is, then I'm going to
wish
> > I'd ported to C++.
> >
> > Any ideas?  Is there a way to keep Perl-Qt alive?

-- 
Joe Claborn
joe at claborn.net
254-829-2448
_______________________________________________
Kde-perl mailing list
Kde-perl at kde.org
https://mail.kde.org/mailman/listinfo/kde-perl


More information about the Kde-perl mailing list