As Penguin said, the easiest way is to build the RPM outside of QtCreator. What I did personally was I first launched the SDK through QtCreator (open a Sailfish project and then click "Start Sdk" near the bottom in the sidebar; there's probably a way to launch the SDK without using QtCreator, but I don't know how personally), then I SSH'd in to the SDK (see https://sailfishos.org/develop-faq.html, "How do I login into the emulator or build engine?" > "Build Engine", "as user mersdk"). There I just ran rpmbuild -bb manually against my spec file. You need to make sure that you have the sources packaged correctly in ~/rpmbuild/SOURCES, though.