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

QFont.StyleStrategy values convert to int when bitwise or'd

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2: Important P2: Important
    • 6.5.0, 6.4.2
    • 1.2.2, 1.2.x
    • PySide
    • e5976250c (dev), 7e5c6241a (6.4)

      The following code will fail because QFont.setStyleStrategy cannot take an int.

       

       

      from PySide2 import QtGui, QtWidgets
      
      app = QtWidget.QApplication([])
      
      fdb = QtGui.QFontDatabase()
      font = fdb.font("Arial", "Regular", app.font().pointSize() + 1)
      
      
      # Works
      font.setStyleStrategy(QtGui.QFont.PreferAntialias)
      # Works
      font.setStyleStrategy(QtGui.QFont.PreferQuality)
      
      # Breaks
      font.setStyleStrategy(QtGui.QFont.PreferAntialias | QtGui.QFont.PreferQuality)

      The bitwise OR of PreferAntialias and PreferQuality returns the int 192.

       

      To get it to work I think I can just instantiate a QFont.StyleStrategy with the result of the OR but it would be nice if this op could be implemented.

       

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

            ctismer Christian Tismer
            ahuge Alex Hughes
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes