...
You can also use QCoreApplication::arguments()
I'm afraid that I can't because QCoreApplication is meant to be used by non-GUI applications.
(don't worry I have successfully implemented the other way you showed in the example, though a little bit different )