Details
-
Suggestion
-
Resolution: Done
-
P2: Important
-
6.0
-
None
-
-
76068d0114157c6b59523f3fb032cd8de64e9a63 (qt/qtbase/dev)
Description
QFontDatabase API is a mix of static functions and non-static functions which act in a static way (they access a mutex-locked singleton object). This leads to code like:
QFontDatabase::addApplicationFont("MyFont.ttf"); QStringList styles = QFontDatabase().styles("MyFont");
Since the database is a singleton, there does not seem to be any practical reason why some functions are not static. In Qt 6, we should try to make them all static for consistency. This shouldn't affect source compatibility as long as we don't make it impossible to create empty objects of the class.