ioqml is a Zenity-like universal GUI dialog, but QML-based.
It accepts some commands on stdin and prints results to stdout.
echo '{"prompt":"please enter passphrase and press Enter"}' | ioqml examples/pass-prompt.qml
If Qt fails to start with messages like:
qt.qpa.wayland: EGL not available
QRhiGles2: Failed to create context
Failed to initialize graphics backend for OpenGL.
run ioqml with Qt Quick's software renderer:
ioqml --software-rendering examples/pass-prompt.qml
or, if you cannot change the command line used by a caller:
QT_QUICK_BACKEND=software ioqml examples/pass-prompt.qml
This avoids the default OpenGL path, which needs a working EGL/OpenGL stack on Wayland. If you specifically want hardware rendering and have XWayland available, this may also work:
QT_QPA_PLATFORM=xcb ioqml examples/pass-prompt.qml
The commands incoming on stdin should be newline-separated . The following are understood as commands:
-
Single word
stop: terminates the program -
Single word
hide: hides the window -
Single word
show: shows the window (if it was hidden); more precisely, restores the window to its "default visibility" -
JSON string of the form, for example
{"x": {"y":0, "z":1}}sets the objectst.xinsideQMLto{"y":0, "z":1}. The objectstis pre-defined in the header of theQMLfile; its propertyxshould be declared in theQMLfile (or you get error). Then settingst.xcan be hooked to some useful action by writing an on-property-change handler
Do not push pretty-printed JSON on stdin, because, remember, newline is the command separator;
all incoming JSON should be onelines.
Emitting the QML signal putStr(x) prints x to stdout (see examples).
invoke with flags, e.g. :
ioqml --name MYNAME --class MYCLASS myapp.qml
--- sets res_name to MYNAME and res_class to MYCLASS
(Notice that --name works for all Qt applications, starting from Qt 5.2)