...beside escaping your string proper. I bet it must be
Qt Code:
  1. mQuery.exec("LOAD DATA INFILE '"+fileName+"' INTO TABLE table1 FIELDS TERMINATED BY ' ' LINES TERMINATED BY '\\r\\n'")
To copy to clipboard, switch view to plain text mode 
Also have a look at bindValue or QString::arg() which makes your code better readable.