[Kde-perl] QListBoxPixmap reimplementation problems

DUPUIS Arnaud a.dupuis at infinityperl.org
Wed Sep 20 12:34:49 CEST 2006


Greetings all,

I am working on a program wich use PerlQt 3.008 or 3.009 (without PerlKDE to 
be backward compatible with 3.008 from CPAN). I'm also using pqt-designer as 
RAD.

The application I'm coding have a configuration window (what a surprise...) 
and I'm using a QListBox on the right (vertically) and a QStackWidget on the 
left for main display. This is absolutly like the KDE configurations dialogs, 
at least I want to make it look like it.
In order to do that I have subclassed QListBoxPixmap to give it the 
possibility of being highlited on mouse over. I attach to this mail the code 
of the subclassed item.

In the main code i'm creating an item like that (in the init() method):

img_prices = Qt::Pixmap("$ENV{HOME}/.association_manager/images/prices.png");
my $i = ListBoxPixItem( img_prices,"Tarifs globaux");
listBox->insertItem( $i );


Later in the code I hook with the onItem( QListBoxItem* ) and onViewPort() 
signals like that :

sub listBox_onItem # SLOT: ( QListBoxItem * )
{
      my $i = shift ;
      print "---------- update item (current: ",$i->text(),") ----------\n";
      print "---------- previous: ",$previous_lb_item->text()," ----------\n" 
if(defined($previous_lb_item));
      listBox->updateItem( $i );
      listBox->updateItem( $previous_lb_item ) if(defined($previous_lb_item) 
&& $i != $previous_lb_item);
      $previous_lb_item = $i;
}


sub listBox_onViewport
{
      listBox->updateItem( $previous_lb_item ) if(defined($previous_lb_item));
}

Now the problem: this work fine for the first item (when my mouse is over it, 
a filled rectangle is drawn) but only for this one...
I don't know why, nothing happen for the others items.

I'm sure i made a stupid error but I can't find it, so if you could help i'll 
be glad !!

Good day

Arnaud DUPUIS
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ListBoxPixItem.pm
Type: application/x-perl-module
Size: 728 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-perl/attachments/20060920/771f07ee/attachment.bin 


More information about the Kde-perl mailing list