Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.2.5, 6.3.1, 6.4.0 Beta1, 6.4
-
6.2.2
-
None
-
-
69d525a6fa (qt/qtbase/dev) 69d525a6fa (qt/tqtc-qtbase/dev) fcd5a02886 (qt/qtbase/6.3) fcd5a02886 (qt/tqtc-qtbase/6.3) fcd5a02886 (qt/tqtc-qtbase/6.3.0) 64dd5a8183 (qt/tqtc-qtbase/dev) 36427480dd (qt/qtbase/6.3) 34d9da8371 (qt/qtbase/6.2)
Description
When Japanese fonts are used in a QMessageBox, the error `qt.qpa.fonts: Populating font family aliases took 713 ms. Replace uses of missing font family ".AppleSystemFallback" with one that exists to avoid this cost` appears. This error does not appear when Japanese fonts are used in a standard QLabel.
The error also appears when Japanese fonts are used in other places, such as when QTranslator is used, so the bug is not specific to QMessageBox; it just doesn't appear everywhere.
I'm running Python 3.9.7 and PySide6 6.2.2 on macOS Big Sur 11.6.1.
MWE:
import sys import random from PySide6 import QtCore, QtWidgets, QtGui class MyWidget(QtWidgets.QWidget): def __init__(self): super().__init__() self.hello = ["Hallo Welt", "Hei maailma", "Hola Mundo", "Привет мир", "こんにちは世界"] self.button = QtWidgets.QPushButton("Click me!") self.text = QtWidgets.QLabel("Hello World", alignment=QtCore.Qt.AlignCenter) self.layout = QtWidgets.QVBoxLayout(self) self.layout.addWidget(self.text) self.layout.addWidget(self.button) self.button.clicked.connect(self.magic) @QtCore.Slot() def magic(self): self.text.setText(random.choice(self.hello)) # Commenting out the next 4 lines makes error disappear msgBox = QtWidgets.QMessageBox() msgBox.setIcon(QtWidgets.QMessageBox.Information) msgBox.setText("こんにちは世界") # NB: Replacing the Japanese characters in the message box with Привет мир also makes the error disappear, so the issue is specific to only certain character sets. msgBox.exec() if __name__ == "__main__": app = QtWidgets.QApplication([]) widget = MyWidget() widget.resize(800, 600) widget.show() sys.exit(app.exec())
See https://forum.qt.io/topic/132657/qmessagebox-with-japanese-characters-gives-missing-font-family-warning-on-macos for more discussion.
Attachments
For Gerrit Dashboard: QTBUG-99216 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
400472,5 | Avoid populating font family aliases if family matched | dev | qt/qtbase | Status: MERGED | +2 | 0 |
401148,2 | Avoid populating font family aliases if family matched | 6.3 | qt/qtbase | Status: MERGED | +2 | 0 |
401149,1 | Avoid populating font family aliases if family matched | 6.2 | qt/qtbase | Status: ABANDONED | +2 | 0 |
401150,1 | Avoid populating font family aliases if family matched | tqtc/lts-5.15 | qt/tqtc-qtbase | Status: ABANDONED | 0 | 0 |
403315,2 | CoreText: Avoid populating font family aliases if family was populated | dev | qt/qtbase | Status: MERGED | +2 | 0 |
403733,2 | CoreText: Avoid populating font family aliases if family was populated | 6.2 | qt/qtbase | Status: MERGED | +2 | 0 |
403734,2 | CoreText: Avoid populating font family aliases if family was populated | 6.3 | qt/qtbase | Status: MERGED | +2 | 0 |
403736,3 | CoreText: Avoid populating font family aliases if family was populated | tqtc/lts-5.15 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |