Question

I'm using a stylesheet in my Qt desktop application (a .qss file), but I can't find out how to make the .pro file copy the .qss file to the output directory (where the .exe file is being created), which means the application runs totally without any styling.

I used to run the project from Visual Studio, and VS would take care of all this for me. But now I've exported the .pro file from VS to use it in Qt Creator instead, and I reckon I have to add some more commands to the .pro file manually to get this file copied.

I am not very familiar with QMake, but I've tried fiddling around with both "OTHER_FILES +=" and "INSTALLS +=" commands, but I can't get either to copy the stylesheet over to the destination directory.

If I copy the file to the dest dir manually, everything works like a charm, but that requires me to manually copy it everytime it changes..

Any help on this matter would be greatly appreciated. Thanks in advance!

Was it helpful?

Solution

Here is an example with a logo that I've used successfully:

DESTDIR = $${INSTALLDIR}

images.path = $${INSTALLDIR}/images #<-- sets the directory to install into
images.files += images/logo.png #<-- sets the image to install.
images.files += images/small_logo.png #<-- Another one to install.

INSTALLS += images #<-- Add the images to the install command.

I imagine the same sort of thing could be used with your stylesheet. Do note that this copied the images every time the install target was run, instead of checking the relative dates and only copying if the source was newer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top