[Qt-qml] QML and Unix #!/path/to/interpreter

Alan Alpert alan.alpert at nokia.com
Mon Apr 19 15:18:55 CEST 2010


 Mandag 19. april 2010 22:47:22 skrev Kellomaki Pertti (Nokia-D/Tampere) :
> Hi,
> 
> Is it possible to use the Unix #! convention to make QML scripts
> executable? I tried the following, but the qml viewer just complains.
> 
> helloworld.qml:
> 
> #!/usr/local/Trolltech/Qt-Creator-2.0-tech-preview/bin/qml
> import Qt 4.7
> 
> Item {
>    Text {
>      id: helloText
>      text: "Hello, world!"
>      font.pointSize: 30
>    }
> }

It is not possible because the first line is not valid QML (starting with #!). 
Note that # will not start a comment in QML.

You'll have to continue using the QML executable, or you can make your own 
little application with a QDeclarativeView to view them in.

-- 
Alan Alpert
Software Engineer
Nokia, Qt Development Frameworks



More information about the Qt-qml mailing list