How to use Non-Standard Custom Font with Stylesheets?
Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn
--
Track title: CC D Schuberts Piano Sonata D 850 in D
--
Chapters
00:00 Question
01:24 Accepted answer (Score 15)
01:46 Thank you
--
Full question
https://stackoverflow.com/questions/2795...
Accepted answer links:
[loading the font]: https://qt-project.org/doc/qt-4.8/qfontd...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #fonts #pyqt #pyqt4 #qtstylesheets
#avk47
--
Track title: CC D Schuberts Piano Sonata D 850 in D
--
Chapters
00:00 Question
01:24 Accepted answer (Score 15)
01:46 Thank you
--
Full question
https://stackoverflow.com/questions/2795...
Accepted answer links:
[loading the font]: https://qt-project.org/doc/qt-4.8/qfontd...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #fonts #pyqt #pyqt4 #qtstylesheets
#avk47
ACCEPTED ANSWER
Score 16
This is just a guess, because I cannot test it myself, but you could try loading the font before setting the stylesheet:
app = QtGui.QApplication(sys.argv)
QtGui.QFontDatabase.addApplicationFont('path/to/font')
# or load the font data directly
# QtGui.QFontDatabase.addApplicationFontFromData(fontdata)
stylesheet = open('mystylesheet.qss').read()
app.setStyleSheet(stylesheet)