QByteArray oldContents = gen.readAll();
if(oldContents != contents) { // only touch the file if something changed
gen.seek(0);
QByteArray oldContents = gen.readAll();
if(oldContents != contents) { // only touch the file if something changed
gen.seek(0);