Re: Qt::Slider revisited

Germain Garand <[email protected]>
Newsgroups gmane.comp.kde.devel.perl
Message-ID <[email protected]>
Le Jeudi 25 Mars 2004 20:26, Wolfgang Hommel a écrit :
> Greetings!
>
> Although it's been briefly discussed on the list just two weeks ago, I'd
> really appreciate some details on the "Qt::Slider isn't displayed"
> issue. I'm referring to the code of PerlQT tutorial 6, presently
> available at
>

Ouch, thanks for the reminder, I didn't notice the reference to the tutorial
in your original message... that's an ugly one indeed.

Seems garbage collection check is broken for classes with multiple inheritance
(Qt::Slider is both a Qt::Widget and Qt::RangeControl)
Will fix asap.

[...]
> Now, if the above package is changed to:
...
> my slider;
> sub NEW {
>     shift->SUPER::NEW(@_);
>
>     my $lcd = Qt::LCDNumber(2, this, "lcd");
>     $slider = Qt::Slider(&Horizontal, this, "slider");
...
> (This has been suggested 2 weeks ago)
>
> Then the Slider gets displayed, but (of course?) only the very last
> instance of all "LCDRange"s has got a Slider, the others don't; i.e.,
> the example code creates 16 of them, but only the 16th (bottom right)
> got a Slider attached to it.
>

The Slider shouldn't be garbage collected, that's definetly a bug.

Now for your question, the proper way of keeping data inside a PerlQt class
on a per-instance basis is to use Qt::attributes (try reading the PerlQt 
programming tutorial on that subject, please)

Qt::attributes are shorthands to the corresponding entries in the object's 
hash (as in traditional Perl OO, but with compile time checking)


Germain
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.