I have created an application with Qt creator in which I use a font that is not standard for window. After deploying it and running it on another PC, the font of all the text changes and this damages the application a lot in terms of visual
What do I have to do so that it windeployqt.exe
detects the font that I am using in the application and includes it in the deploy, so that it can be seen on other PCs?
You have two possibilities:
You attach the font as a resource (add it to the .qrc file). If you do this you will have to indicate that the font is as an embedded resource, which slightly changes the way you locate it:
You install the source on the computers where you are going to run the application. You can do this by hand, with a script within your app, or by creating an app installer. In this case the loading of the source does not change with respect to your original code.
Edit:
Steps to load the font:
add source to qt
The first thing is to make sure that qt loads the source. To do this, just add this line:
Where
fonts/mi_fuente.ttf
is the path of the resource.This line can be put, for example, in the main window's constructor or at some point in initialization.
use font
To use the font from the style sheet we can use the following: