modified to get it working with qtcreator terminal plugin