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

Elvis Stansvik elvstone at gmail.com
Fri May 6 11:36:07 CEST 2016


Hi all,

Since some time, the `qmlscene` command has been available for
debugging QML applications:


[estan at pyret ~]$ qmlscene --help
Usage: qmlscene [options] <filename>

 Options:
  --maximized ...................... Run maximized
  --fullscreen ..................... Run fullscreen
  --transparent .................... Make the window transparent
  --multisample .................... Enable multisampling (OpenGL anti-aliasing)
  --no-version-detection ........... Do not try to detect the version
of the .qml file
  --slow-animations ................ Run all animations in slow motion
  --resize-to-root ................. Resize the window to the size of
the root item
  --quit ........................... Quit immediately after starting
  --disable-context-sharing ........ Disable the use of a shared GL
context for QtQuick Windows
                            .........(remove AA_ShareOpenGLContexts)
  --desktop..........................Force use of desktop GL
(AA_UseDesktopOpenGL)
  --gles.............................Force use of GLES (AA_UseOpenGLES)
  --software.........................Force use of software rendering
(AA_UseOpenGLES)
  --scaling..........................Enable High DPI scaling
(AA_EnableHighDpiScaling)
  --no-scaling.......................Disable High DPI scaling
(AA_DisableHighDpiScaling)
  --verbose..........................Print version and graphical
diagnostics for the run-time
  -I <path> ........................ Add <path> to the list of import paths
  -P <path> ........................ Add <path> to the list of plugin paths
  -translation <translationfile> ... Set the language to run in

[estan at pyret ~]$


Recently, the `qml` command is also available:


[estan at pyret ~]$ qml -h
Usage: qml [options] [files] [-- args]

Any unknown argument before '--' will be treated as a QML file to be loaded.
Any number of QML files can be loaded. They will share the same engine.
'gui' application type is only available if the QtGui module is available.
'widget' application type is only available if the QtWidgets module is
available.

General Options:
        -h, -help..................... Print this usage information and exit.
        -v, -version.................. Print the version information and exit.
        -apptype [core|gui|widget] ... Select which application class
to use. Default is gui.
        -quiet ....................... Suppress all output.
        -I [path] .................... Prepend the given path to the
import paths.
        -f [file] .................... Load the given file as a QML file.
        -config [file] ............... Load the given file as the
configuration file.
        -- ........................... Arguments after this one are
ignored by the launcher, but may be used within the QML application.
        GL options:
        -desktop.......................Force use of desktop GL
(AA_UseDesktopOpenGL)
        -gles..........................Force use of GLES (AA_UseOpenGLES)
        -software......................Force use of software rendering
(AA_UseOpenGLES)
        -scaling.......................Enable High DPI scaling
(AA_EnableHighDpiScaling)
        -no-scaling....................Disable High DPI scaling
(AA_DisableHighDpiScaling)
        Debugging options:
        -verbose ..................... Print information about what
qml is doing, like specific file urls being loaded.
        -translation [file] .......... Load the given file as the
translations file.
        -dummy-data [directory] ...... Load QML files from the given
directory as context properties.
        -slow-animations ............. Run all animations in slow motion.
        -fixed-animations ............ Run animations off animation
tick rather than wall time.
[estan at pyret ~]$


The tools seem quite similar. What was the rationale for introducing
`qml`? The old `qmlscene` is described in the docs [1] as:

"The qmlscene utility is meant to be used for testing your QML
applications, and not as a launcher in a production environment. To
launch a QML application in a production environment, develop a custom
C++ application or bundle the QML file in a module. See Deploying QML
applications for more information."

Is there a similar page describing the `qml` tool somewhere (I can't
see it mentioned anywhere)? Is the `qml` tool also meant only for
testing/debugging, and not for production use?

The reason I'm asking is I'm building a QML application for embedded
use. The app is QML only, apart from some calls from QML into Python
using pyotherside [2] when interfacing with the hardware. So in theory
I could launch my app using `qmlscene` or `qml`, which would free me
from having to build and distribute a little C++ launcher application
to launch the app.

Thanks in advance for any clarifications.

Elvis

[1] http://doc.qt.io/qt-5/qtquick-qmlscene.html
[2] https://github.com/thp/pyotherside



More information about the Interest mailing list