[Interest] Role of `qmlscene` and `qml` command line tools

Shawn Rutledge Shawn.Rutledge at qt.io
Fri May 6 13:34:50 CEST 2016


> On 6 May 2016, at 13:07, Elvis Stansvik <elvstone at gmail.com> wrote:
> 
> [estan at pyret ~]$ qml test.qml -- --foo bar
> qml: /usr/lib/qt/bin/qml,test.qml,--,--foo,bar
> [estan at pyret ~]$
> 
> Do you know if there's any QML API to get just the arguments following
> "--"? Or I'll have to parse that out myself?
> 
> In general, is there any convenient QML API for command line parsing?
> (e.g. like QCommandLineParser on the C++ side)

Not really, AFAIK.  QCommandLineParser is kindof new itself (umm since 5.2… tempus fugit).  It would be interesting to come up with a nice declarative API for that.  It would probably need a QObject or Q_GADGET wrapper since QCommandLineParser isn’t either one, and has an imperative API.  But I wonder how many people would use it.

Running any kind of script directly without looking at it first requires some trust, so maybe that’s why it hasn’t been in high demand to use QML that way, so far.  Or else it’s just lack of habit, and lack of advertising that you could do that.



More information about the Interest mailing list