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

[Type Hints] Mypy error when comparing Qt.GlobalColor with QColor

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • P4: Low
    • None
    • 6.5.3
    • Type hints
    • None
    • All

    Description

      The following code example shows, that comparing a Qt.GlobalColor with a QColor works as expected:

      from PySide6.QtCore import Qt
      from PySide6.QtGui import QColor
      
      global_color = Qt.GlobalColor.red
      color = QColor(Qt.GlobalColor.red)
      
      print(
       f"QColor {color} and Qt.GlobalColor {global_color} are equal: {global_color == color}"
      )

      Nevertheless, mypy prints the following error:

      error: Non-overlapping equality check (left operand type: "GlobalColor", right operand type: "QColor") [comparison-overlap]

      Attachments

        1. pyside_2529.py
          0.2 kB
        2. pyside2529.py
          0.5 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            ctismer Christian Tismer
            tilmankrummeck Tilman Krummeck
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes