use fprintf instead of printf and flush for qDebug