[Kde-perl] Re: perlQt question
Richard Dale
Richard_Dale at tipitina.demon.co.uk
Thu Aug 28 08:48:01 CEST 2003
On Wednesday 27 August 2003 23:37, Germain Garand wrote:
> Le Mercredi 27 Août 2003 22:28, Ashley Winters a écrit :
> > --- Kapkaev at inbox.ru wrote:
> > > Hi
> > > I am not found how can I call Qt global function
> > > 'bitBlt' from perlQt.
> > > Can you help me?
> > > Thanks!
> > > (I like perlQt much more than perlTk or perlGTK...)
> >
> > bitBlt is being added to PerlQt now. You may need to follow special
> > instructions to get the latest development version out of CVS, since
> > there isn't a release version which includes it.
>
> Yes, I'll commit it around midnight GMT... I have to finish the redirection
> of the new static operators and merge other changes.
>
> All global Qt functions are collected in a pseudo-class named
> Qt::GlobalSpace.
>
> You can use them as fully qualified calls:
> Qt::GlobalSpace::bitBlt( args...)
> or you can export all of them (except operators, which work magically) to
> the current namespace:
> use Qt::GlobalSpace;
> bitBlt(args...);
>
> or only a few :
> use Qt::GlobalSpace qw( bitBlt qCompress qSysInfo );
>
> (that's the classical Exporter interface)
The power of the new PerlQt synchronicity based bug prediction system! We can
already be working on the problem 48 hours before a PerlQt user finds it.
I'm having problems getting operator overloading working in QtRuby, I don't
know how you've solved it for PerlQt. Is there a way to distinguish between
static methods and instance methods in the SMOKE runtime? To add two QPoints
together, you use the static method in the QGlobalSpace pseudo class:
In QGlobalSpace:
// +(const QCString&, const QCString&)
const QCString xret = (*(const QCString *)x[1].s_voidp + *(const
QCString
*)x[2].s_voidp);
x[0].s_voidp = (void*)new QCString(xret);
}
But to add two regions together, you use an instance method:
In QRegion:
x_14.cpp: // operator+(const QRegion&)
x_14.cpp: const QRegion xret = this->QRegion::operator+(*(const QRegion
*)
And then there are unary static operators in QGlobalSpace:
// -(const QPoint&)
const QPoint xret = (-*(const QPoint *)x[1].s_class);
So if there is some code:
(a - b)
Where a and b are QPoints, the QtRuby runtime first looks for a method of the
form -a(b), which should be missing in this case, and then it should look for
-(a, b) as a static method in QGlobalSpace.
However, it finds the unary static operator in QGlobalSpace looking for -a(b)
and assumes it's an instance method, and calls that, so it wrongly evaluates
the expression as a, (-b)
p1 = Qt::Point.new(5,5) => (5, 5)
p2 = Qt::Point.new(20,20) => (20, 20)
p1 - p2 => (-20, -20)
findMethod() in Qt.xs doesn't distinguish between static and instance methods
- does it need to - is that the way to solve this problem?
-- Richard
More information about the Kde-perl
mailing list