Question about QApplication.fontMetrics() in PyQt6

RedHuli redhuli.comments at gmail.com
Tue Jan 12 15:13:36 GMT 2021


This is a simple question I have about using QApplication.fontMetrics() in
PyQt6. When I used it before in PyQt5, I never received an error message.
However, when I want to get the font metrics I now get the error :

font_size = QApplication.fontMetrics() # Calculate the size of the text


AttributeError: type object 'QApplication' has no attribute 'fontMetrics'

I am reimplementing the sizeHint() method when subclassing
QStyledItemDelegate.

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210112/3a80d734/attachment.htm>


More information about the PyQt mailing list