[Qtscript-bindings] signals/slots overriding
Ian Monroe
ian at monroe.nu
Fri Aug 22 21:30:53 CEST 2008
Hey Kent and everyone,
On Wed, Aug 13, 2008 at 4:02 AM, Peter Zhou <peterzhoulei at gmail.com> wrote:
> how can I override a signal or a slot in a script?
I understand you talked to Peter Zhou and figured out that he stumbled
upon a bug that won't be fixed until Qt 4.5. I don't quite get what
that bug is or what he was trying to do though. :)
Really the general question is: if I want to define a class in C++
(and to use the old OOP example that maybe doesn't fit exactly) called
Shape, how do I let the QtScript subclass Shape with Square and
override its area() function? And have the overriden area() function
be called by C++? The AnalogClock example seems to do this fine with
its paintEvent.
So in JavaScript you'd have something like:
function Square( side )
{
Shape.call( this );
this.side = side;
}
Square.prototype = new Shape();
Square.area = new function()
{
return this.side * this.side;
}
new Square( 3.0 );
What's the best way to go about it?
More information about the Qtscript-bindings
mailing list