Warning when calling obsolete Qt methods?

Phil Thompson phil at riverbankcomputing.com
Fri Aug 27 12:22:58 BST 2021

On 27/08/2021 12:16, Florian Bruhin wrote:
> Hi,
> I recently used PySide2 and noticed it shows a warning when calling
> obsolete methods:
>     >>> from PySide2.QtGui import QFont, QFontMetrics, QGuiApplication
>     >>> a = QGuiApplication()
>     >>> fm = QFontMetrics(QFont())
>     >>> fm.width('a')
>     <stdin>:1: DeprecationWarning: QFontMetrics.width(const QString &
> arg__1, int len) const is deprecated
>     8
> PyQt5 does no such thing, and I suppose it's the same for PyQt6 so far.
> While starting to port things to Qt 6, I noticed I was accidentally
> using some methods which have long been deprecated already.
> Would it be possible for PyQt6 to start doing the same thing when 
> things
> are getting deprecated in Qt 6?

I'm against it because of the maintenance overhead and the possible 
appearance of annoying warnings to the user of an application.

It would be different if the deprecated methods where to be removed but 
they never are.


More information about the PyQt mailing list