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

[MacOS] Changing a label's text is not working properly on transparent widgets

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P3: Somewhat important
    • None
    • 6.1.0
    • Other
    • None
    • macOS

    Description

      Updating a label's text on a transparent widget in MacOS behaves strangely, previous text remains partially visible (see screenshot)

      System Specs: MacOS Monterey 12.0.1 and Python 3.10

       

      Source Code: 

      import sys
      from PyQt6 import QtWidgets, QtCore
      from PyQt6.QtCore import QTimer
      from PyQt6.QtGui import QFont
      from PyQt6.QtWidgets import QLabel, QFrame
      
      
      def update_label():
          l1.setText("Bye!")
          l1.update()
          window.repaint()
      
      
      app = QtWidgets.QApplication(sys.argv)
      window = QtWidgets.QWidget()
      window.setAttribute(QtCore.Qt.WidgetAttribute.WA_TranslucentBackground)
      window.setWindowFlag(QtCore.Qt.WindowType.FramelessWindowHint)
      window.setFixedSize(800, 600)
      font = QFont()
      font.setPointSize(72)
      l1 = QLabel(window)
      l1.setText("Hello World")
      l1.setFont(font)
      l1.setStyleSheet("color:red")
      window.show()
      timer = QTimer()
      timer.setInterval(1000)
      timer.timeout.connect(update_label)
      timer.start()
      app.exec()
      
      

      Attachments

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

        Activity

          People

            crmaurei Cristian Maureira-Fredes
            mbs Manu BS
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes