QML main: simplify code and make it work

Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>

Signed-off-by: Christophe Chapuis <chris.chapuis@gmail.com>