[Qt-interest] Qt vs Adobe Flash etc

Jason H scorp1us at yahoo.com
Tue Oct 13 20:31:41 CEST 2009


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



----- Original Message ----
From: Jason H <scorp1us at yahoo.com>
To: Benjamin Meyer <ben at meyerhome.net>
Cc: qtInterest List <Qt-interest at trolltech.com>
Sent: Tue, October 13, 2009 10:21:39 AM
Subject: Re: [Qt-interest] Qt vs Adobe Flash etc

Thanks Ben. I'll have a look.

I wanted so much to be able to do it all in QtScript and was majorly bummed when I was told I couldn't. I probably won't move to QtScript for my current project, but it makes my dream of an opensource flash replacement even closer to coming true!




----- Original Message ----
From: Benjamin Meyer <ben at meyerhome.net>
To: Jason H <scorp1us at yahoo.com>
Cc: Andreas Unger <andi.unger05 at gmail.com>; qtInterest List <Qt-interest at trolltech.com>
Sent: Mon, October 12, 2009 11:12:26 PM
Subject: Re: [Qt-interest] Qt vs Adobe Flash etc

In the Qt git code checkout tests/auto/qlocalsocket/lackey/main.cpp and then in the scripts folder it the scripts can create the c++ object QScriptLocalServer and QScriptLocalClient whenever they want.  This was back when it was hard, in 4.5 there was new api added to make it easy, see the qtscript docs.

-Benjamin Meyer

On Oct 12, 2009, at 9:47 PM, Jason H wrote:

> I *tried* to do what you are talking about but was told it was not possible.
> 
> So rather than be short, can we be constructive?
> 
> I was told the only way to accomplish it would be to write the Item in C++ and provide the appropriate bindings, then recompile the bindings. Whomever I talked to was either wrong, or I completely misunderstood.
> 
> So could you provide a simple example?
> 
> Thanks.
> 
> 
> 
> ----- Original Message ----
> From: Benjamin Meyer <ben at meyerhome.net>
> To: Jason H <scorp1us at yahoo.com>
> Cc: Andreas Unger <andi.unger05 at gmail.com>; qtInterest List <Qt-interest at trolltech.com>
> Sent: Mon, October 12, 2009 9:17:25 PM
> Subject: Re: [Qt-interest] Qt vs Adobe Flash etc
> 
> On Oct 12, 2009, at 5:25 PM, Jason H wrote:
> 
>> Yeah, but if you're going to have an Open Source replacement for flash, having scripters modify C++ code is bogus.
> 
> QtScript coders don't modify c++ code.
> 
>> The PyQt library uses SIP to get around this, with the caveat that you can't inherit from two C++ classes. The work-around for that is to make an object that inherits one and proxies the other. A pain, but you shouldn't have to recompile your C++ every time you want to make a new object. And with PyQt you don't.
> 
> You don't have to recompile your app every time a qscript guy wants a new qgraphicsview object.
> 
>> I can't figure out why it is not supported by default
> 
> It is.
> 
>> -  that if you inherit from QObject,
> 
> QGraphicsViewItem doesn't
> 
>> then QtScript should not care whether your object comes from C++ or Qt script.
> 
> It doesn't.
> 
>> It's a major bummer. So much so that I'm willing to buy a PyQt license. I tried. I gave up.
> 
> Thats cool PyQt is a good project worth supporting.
> 
> -Benjamin meyer
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
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