Reputation: 676
font_db = QFontDatabase()
font_id = font_db.addApplicationFont("test.ttf")
This is deprecated in PyQt6 and gives the warning
DeprecationWarning: QFontDatabase.QFontDatabase() is deprecated
font_db = QFontDatabase()
what to use instead of QFontDatabase to load a font from a .ttf file.
Upvotes: 1
Views: 1239
Reputation: 676
As commented by musicamante calling the class methods as static functions works.
So instead of this :
font_db = QFontDatabase()
font_id = font_db.addApplicationFont('test.ttf')
It should be done like this :
QFontDatabase.addApplicationFont('test.ttf')
Upvotes: 1