[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-perl
Subject:    Re: [Kde-perl] Release schedule (was: NEW)
From:       Ashley Winters <qaqortog () nwlink ! com>
Date:       2002-06-25 15:42:43
[Download RAW message or body]

On Tuesday 25 June 2002 02:01 am, Germain Garand wrote:
> Le Lundi 24 Juin 2002 21:26, Ashley Winters a écrit :
> > 1. Each class gets an ON_NEW (or something) method which is called after
> > NEW(). This ON_NEW method would be where a reference to the Qt::app could
> > be added. Something like:
> >
> > sub Qt::Object::ON_NEW {
> >     addref(Qt::app);
> > }
> >
> > 2. Same thing, but ON_DESTROY
> >
> > sub Qt::Object::ON_DESTROY {
> >     parent->addref(this) if parent();
> > }
>
> Looks good, but I wonder if this couldn't be extended further to avoid the
> need for point 3).
> I've noticed there is a consistent naming scheme across all QxxxItems for a
> method returning a pointer to the parent, which is
> s/Qt::(.*)Item$/lcfirst($1)/e
> Maybe those could be used ?

You're right, most of the Q*Item classes do have a parent pointer of some 
type. I was focused on QLayoutItem which doesn't (since you brought it up 
first). I'll definitely use ON_DESTROY for the ones which do have parent 
pointers.

However, there's still a need for callee-owned objects - see QTab, QEvent, ...

> Having to look for callee owned for every single method looks a bit
> overkill to me ?

Well, it would be checking for callee owned on every single class Foo argument 
to every method, actually. It would be the type marshaller which does it. 
Whenever a tf_class argument is converted FromSV, it checks o.isAllocated() 
&& o.c().isCalleeOwned() or something and calls get_this().addRef(o).

Err, I don't think my code examples are going to make much sense anymore until 
my new version of PerlQt is usable. Don't worry about it, then. I do have 
good news, though. My new version has kickass error messages.

perl -Mblib -MQt -we '$x = Qt::LCDNumber; $x->display($y)'
Using /usr/src/cvs/PerlQt-3/blib
Registered Qt => 0x80bda88
Name "main::y" used only once: possible typo at -e line 1.
Ambiguous method call at (eval 2) line 1:
        Qt::LCDNumber->display(undef)
Possible candidates are:
        void QLCDNumber::display(const QString&)
        void QLCDNumber::display(int)
        void QLCDNumber::display(double)

Is that helpful or what?

Ashley Winters
_______________________________________________
Kde-perl mailing list
Kde-perl@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-perl
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic