Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1955

mypy error: "QObject" has no attribute "tr"

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.7.0, 6.2.12, 6.5.5, 6.6.3
    • 6.3.0
    • Type hints
    • None
    • Windows
    • 94869cf1c (dev), d8438d0a3 (6.6), e915e3aef (tqtc/lts-6.5), 14048ad66 (tqtc/lts-6.2), c85b0457a (tqtc/6.5.5)

    Description

      According to the doc `QObject` offer the method `tr`.
      This is working as expected

      from PySide6.QtCore import QObject 
      print(QObject().tr('hello'))
      
      >python foo.py
      hello
      

      but `mypy` doesn't recognize the method:

      >mypy foo.py   
      foo.py:2: error: "QObject" has no attribute "tr"
      Found 1 error in 1 file (checked 1 source file)
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              crmaurei Cristian Maureira-Fredes
              zeed Vito De Tullio
              Votes:
              5 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes