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
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.x
insideQML
to{"y":0, "z":1}
. The objectst
is pre-defined in the header of theQML
file; its propertyx
should be declared in theQML
file (or you get error). Then settingst.x
can 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)