How to Split a QString by White Spaces

You need to use a QRegExp to achieve this. “\s” means any white space character and “+” means any number of that pattern. So you can use the following line to find any number of consecutive white spaces and split you string:

line.split(QRegExp("\s+"))