Dodgy code to use QGIS to preview layers