Hey Pau,

2011/12/1 Pau Garcia i Quiles <pgqui...@elpauer.org>

> At least this is the vision I would have for an equivalent for Wt -- to
>> create bindings for Wt into JavaScript (using e.g. V8), in such a way that
>> you can do most things declaratively like in QML.
>>
>>
> Maybe I've not fully grasped what you mean but, how would you the add C++
> to the equation?
>
> The ability to use C++ is what drove me to Wt in the first place. My first
> 'serious' application was a virtualization console (something like
> http://virt-manager.org/ ) using libvirt (C library). Being able to use
> libvirt directly from Wt made it almost trivial to implement.
>
> How would this work with the Wt JavaScript bindings? I would need to
> create a C-Javascript layer for libvirt, then use the libvirt-js binding,
> right? That looks like a huge disadvantage, and I'd say that's exactly why
> QML allows combining JavaScript and C++.
>

QML (the language) doesn't allow C++ though?
With only small syntactic changes QML could have been made to be confirming
JavaScript.

What you are referring to is Q_INVOCABLE and Q_PROPERTY ?


> That being said, SMOKE, the bindings-generator Richard Dale and others
> developed for Qt and KDE, already creates JavaScript bindings for Qt and
> KDE, and they are faster than Nokia's.
>

In my opinion, what I would like to have is something like this:

load('wt.js');

var w;
var widget = new Wt.WContainerWidget({
    width: '100px',
    height: '200px',
    children: [
        w = new Wt.WText({
            width: '100px',
            height: '200px'
        })
    ]
});

w.on('click', function(event) {
    ++widget.width;
});

var label, line;
var widget2 = new Wt.WTemplate({
    text: "<div>${label}: ${line}</div>",
    bindings: [
        label = new Wt.WLabel({
            id: 'label',
            text: "Enter your name"
        }),
        line = new Wt.WLineEdit({
            id: 'line',
            text: 'initial'
        })
    ]
});

This is perfectly fine JavaScript (with an appropriate wt.js stub file I
can execute this with V8), but at the same time it is an almost declarative
definition of a layout.

To be able to extend this with custom widgets and make available other
properties and methods (ala Q_PROPERTY and Q_INVOCABLE) is of course a
challenge to do without moc, but is an unrelated problem to the observation
that QML is not proper JavaScript, but it could have been ?

Regards,
koen
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to