Re: [Qt-qml] Static analysis for QML

2010-11-25 Thread Christian Kamm
On Wednesday 24 November 2010 14:01:55 ext Gregory Schlomoff wrote:
> For the record, I'm creating a custom QML type (ie: a QDeclarativeItem
> subclass), exposed through:
> 
>  qmlRegisterType("MyCustomClasses", 1, 0, "MyClass");
> 
> So this seems an intermediary case between QML plugins and random
> qobjects exposed through context properties.
> 
> But Qt Creator really isn't happy with that, to the point that it will
> underline in red the:
> 
> import MyCustomClasses 1.0
> 
> statement at the top of my qml files. And of course I won't get any
> form of completion or code assistance for those custom types. I hope
> that this issue is also being considered by the Qt Creator team,
> because it doesn't seem very far from qml plugins.

Yes, I agree that it is important. Unfortunately it's only the same as plugins 
conceptually - the implementation will have to tie into Creator's C++ code 
model and hence be entirely different.

You can add comments and votes here:
http://bugreports.qt.nokia.com/browse/QTCREATORBUG-3199

Cheers,
Christian
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Static analysis for QML

2010-11-24 Thread Charley Bay
Gregory spaketh:

> > ,
> > So I was wondering, would it be possible, from a technical point of
> > view (not a product manager / roadmap POV), to have some kind of
> > static analysis tool that could tell at compile time that some signal
> > / slots names have changed ?
>
> Christian respondeth:

> Yes, it's possible - and something we want to have in Qt Creator.
>
> In fact, for types defined in a QML plugin, Creator will often already be
> able
> to offer code completion and error reporting. What the static analysis
> can't do
> yet is get the types right when you embed QML in a C++ application and
> expose
> some random objects (say using setContextProperty).
>
> It's under investigation though.
>

+1 to this idea.

This is something I've been thinking about a lot.

We all see the trend for more static analysis and "helps" like code
completion and syntax highlighting, this will get increasingly rich for
"studio" and "designer-level" tools to "connect" the QML and C++ side, and I
really like where QtCreator is going.  Of course, this implies the "context"
of types and methods at the point of code editing, but this similarly
relates to generating code and system metrics, identifying/adapting to
interface/code/type changes, integration with the "test" system (including
updates to the tests, ideally generated "for free"), issues tracking, etc.

It's really a very interesting problem.

But, to the original point, static analysis would be *great*.  Yesterday I
lost time because I left the parens off my "slot" (a silly error, can't
believe I did that):

//WHAT I DID:
connect(&other, SIGNAL(mySignal()), this, SLOT(mySlot));
//WHAT I SHOULD HAVE DONE:
connect(&other, SIGNAL(mySignal()), this, SLOT(mySlot()));

Of course, the slot never fired, and in this case it took me a while to
track that down, but that would have been an *ideal* catch for static
analysis.  (Bonus points for catching signal/slot type changes and
disallowed coercion.)

(An aside, I'm investigating a QML interface wrapper to a build system, with
states implemented/reflected in QML to reflect current build engine activity
in C++.  A by-product of this build system happens to be metrics from static
analysis, so I've been thinking about doing similar work.)

--charley
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Static analysis for QML

2010-11-24 Thread Gregory Schlomoff
> In fact, for types defined in a QML plugin, Creator will often already be able
> to offer code completion and error reporting. What the static analysis can't 
> do
> yet is get the types right when you embed QML in a C++ application and expose
> some random objects (say using setContextProperty).
>
> It's under investigation though.
>

That's good news! Hope to see that soon in Qt Creator.

For the record, I'm creating a custom QML type (ie: a QDeclarativeItem
subclass), exposed through:

 qmlRegisterType("MyCustomClasses", 1, 0, "MyClass");

So this seems an intermediary case between QML plugins and random
qobjects exposed through context properties.

But Qt Creator really isn't happy with that, to the point that it will
underline in red the:

import MyCustomClasses 1.0

statement at the top of my qml files. And of course I won't get any
form of completion or code assistance for those custom types. I hope
that this issue is also being considered by the Qt Creator team,
because it doesn't seem very far from qml plugins.

Thanks

greg
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml


Re: [Qt-qml] Static analysis for QML

2010-11-24 Thread Christian Kamm
On Wednesday 24 November 2010 12:04:56 ext Gregory Schlomoff wrote:
> Hello,
> 
> One of the main problems that I have with QML, and that actually is
> directly linked to what makes it awesome, is the fact that you won't
> have any compile-time error when you change property names / slots /
> etc... in C++.
> 
> So I was wondering, would it be possible, from a technical point of
> view (not a product manager / roadmap POV), to have some kind of
> static analysis tool that could tell at compile time that some signal
> / slots names have changed ?

Yes, it's possible - and something we want to have in Qt Creator. 

In fact, for types defined in a QML plugin, Creator will often already be able 
to offer code completion and error reporting. What the static analysis can't do 
yet is get the types right when you embed QML in a C++ application and expose 
some random objects (say using setContextProperty).

It's under investigation though.

Cheers,
Christian
___
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml