Managing QFontDatabase on Windows 10 Home
Hi, good morning
I'm working on a Project which runs on Windows 10 Home edition. I've installed Qt 5.7.0 and I'm using the Visual Studio C++ compiler in the project.
Mi problem comes when I try to manage font files into my program with QFontDatabase. I don't understand why, but, when I try to remove the font from my Windows Operating System I can't do that. I always get false when I call QFile::remove(). I'll try to be more specific with an example:
QString fontFile = "C:/some/directory/font.ttf";
int fontId = QFontDatabase::addApplicationFont(fontFile);
QStringList listOfFamilies = QFontDatabase::applicationFontFamilies(fontId);
/* Do somethjing here ... */
qDebug() << "Removing " << fontFile << " returns " << QFile::remove(fontFile);
I don't know why, but I always get false, and it shouldn't because the font is not used anymore.
Do you have any idea about why I'm getting always the same error?
I need to delete the file, because the program runs on git, and it will be necessary to delete fonts from the project as needed. If I cannot delete the file, I will have problems doing merge's between employees working on the same project.
Thanks in advance!
Have a nice day.
@DebugBSD Do you have write access in the directory where the font file is located?
@jsulm Yes, bacuase, I can delete the file if I press Supr key on the file selected in the folder.
@DebugBSD Maybe the font file is still opened by your application?
thanks @jsulm a lot. I'll try to get more info about the error with errorString