[Qt-interest] Qt vs Adobe Flash etc
Jason H
scorp1us at yahoo.com
Tue Oct 13 21:51:50 CEST 2009
I tried that a few months ago, and no, it did not work. Hence my epic disappointment, and my switch to PyQt.
I would love to see it work, and that is why I am carring on this thread - because I want it to work!!
I want to be told I was wrong!
----- Original Message ----
From: Andreas Pakulat <apaku at gmx.de>
To: qt-interest at trolltech.com
Sent: Tue, October 13, 2009 3:36:41 PM
Subject: Re: [Qt-interest] Qt vs Adobe Flash etc
On 13.10.09 11:31:41, Jason H wrote:
> Oh, that still is not what I am talking about.
>
> You still need C++ code to make those classes available in Script land.
>
> In PyQt, I can:
> class AffineText(QGraphicsItem):
> def __init__(self, text, font):
> self.path=QPainterPath()
> fm=QFontMetrics(font)
> self.path.addText(text, 0, fm.ascent(), font)
>
> def boundingRect():
> return self.path.boundingRect()
>
> def paint(painter, option, widget):
> painter.paint(self.path)
>
>
> then the C++ QPainter will still be able to draw the Python-defined object
>
> Let's see QtScript define a new class like that, without any C++ coding! My point was, and still seems to be, you can't. I tried the same approach in QtScript, but QtScript was never able to use the derived object for anything. It is just not acceptable to have to recompile code every time. Even if you seperate it out in a plugin, you then introduce platform dependencies. If you are going o replace flash, the "compile anywhere" idiom doesn't work. However doing it in Python allows the same byte code to be used on every platform, meaning your QtFlash app won't care about your platform. beyond the compilation of the browser plugin.
>
> Unless I am still missing something...?
Hmm, so this doesn't work?
function AffineText(text,font) {
this.path = QPainterPath();
this.path.addText( text, 0, QFontMetrics(font).ascent(), font);
function boundingRect() {
return this.path.boundingRect();
}
function paint(painter,option,widget) {
painter.paint(this.path);
}
}
AffineText.prototype = new QGraphicsItem();
mytext = new AffineText("foobar",QFont("somefont"));
Just from the top of my head, how it should work with JS code. I mean
without this a general purpose script binding is rather useless...
Andreas
--
Fine day to work off excess energy. Steal something heavy.
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the Qt-interest-old
mailing list