QFont font
= widget
->font
();
// modify font
widget->setFont(font);
QFont font = widget->font();
// modify font
widget->setFont(font);
To copy to clipboard, switch view to plain text mode
Thanks for the answer, it's a big ass leap in the right direction, but to verify if I'm majorly fucking up or not, this piece of code should then, in theory, only really change the font family, correct?
//add font to database
if(id != -1)
{
//get the font family name from said font
//change currentfont's family to ^^^
currentfont.setFamily(family.at(0));
ui_vp_message->setFont(currentfont);
}
//add font to database
int id = QFontDatabase::addApplicationFont(font_path);
if(id != -1)
{
//get the font family name from said font
QStringList family = QFontDatabase::applicationFontFamilies(id);
//change currentfont's family to ^^^
currentfont.setFamily(family.at(0));
ui_vp_message->setFont(currentfont);
}
To copy to clipboard, switch view to plain text mode
Maybe I'm not modifying it the right way but for some reason it keeps changing pointSize to the default value, instead of keeping the previous one.
As a sidenote, I do have QFont currentfont defined a bit above the code I showed.
Bookmarks