Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Font changes not aplying
Hi I'm cross compiling on raspberry pi 2 but I can't seem to change the font, it always stays a regular font which I think it's arial. I've tried selecting different fonts but nothing.
Do you have the fonts you want to work with available on your Pi2 ?
@SGaist Of Course, the font in particular is "Open Sans" so I downloades from the same site the one I installed in the computer and the one I intalled on the pi but nothing.
Did you check that the application can find it ? QFontDatabase comes to mind for that.
So What I did using QFontDatabase:
But nothing happened, so I checked that the font was currently installed using
And indeed, it was installed but I don't know why not recognized by Qt.
Did you check the returned id from addApplicationFont ?
@SGaist More or less, what I did to test that the font is working is this:
int id = QFontDatabase::addApplicationFont( "/usr/share/fonts/truetype/Open_Sans/OpenSans-Regular.ttf"); QString family = QFontDatabase::applicationFontFamilies(id).at(0); QFont monospace(family); qApp->setFont(monospace);
But it doesn't work.... No idea what can be happening
What is the value of id ?
@SGaist I'm trying to show the value of the "id" variable through QDebug and the Application output but it's not showing.
Use the debugger then or a dummy widget.
@SGaist Ok, I wasn't pressing the "Debug" button haha, anyways I've found that the "id" value is 0.
hi, just small question.
Since addApplicationFont dont return -1 for error, i wonder if he need to NEW the font as they talk about here
I think that's the answer to my problem but I'm unable to put it into my program, would you mind making it more explained for me please?
@mrjj Ok, I've got it. Thank you for your help :)
so did it make any difference?
@mrjj Yes, What I did was
and then select "Open Sans" on the QtDesigner