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

Inactive components not correcly rendered in dark-mode environments in PySide 6.5.0

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Out of scope
    • Icon: Not Evaluated Not Evaluated
    • None
    • 6.5.0
    • PySide
    • None
    • All

      After upgrading to PySide 6.5.0, the rendering of inactive components (e.g. an inactive button, as in the example below) does not work properly when the operating system is in dark-mode.

      Specifically, it appears that inactive components are always rendered in "light mode", even if the environment is in "dark mode". If the component is made active, then it gets proper rendering (coloring), the problem only occurs when the component is inactive.

      Below is a minimal example that illustrates the issue. To see the problem, the application below must be run in an OS environment in "dark mode". This is a simple application with 2 buttons: the top button is active and is rendered properly (in dark color), but the bottom button is inactive and is rendered in "light grey" instead of "dark grey" as it should (see also the attached screenshot).

      This applications behaves as expected when run with PySide 6.4.x, but updating to PySide 6.5.x breaks it.

      In addition, tooltips are also not properly displayed under PySide 6.5.x anymore (but then work as expected under PySide 6.4.x)

       

      ```py

      #!/usr/bin/env python3

      from PySide6 import QtWidgets

      class MainWindow(QtWidgets.QDialog):

          def _init_(self, parent=None) -> None:
              super()._init_(parent)
              self.setWindowTitle("Minimal example App")

              self.button1 = QtWidgets.QPushButton("Active Button")
              self.button1.setToolTip("This is button 1")

              self.button2 = QtWidgets.QPushButton("Inactive Button")
              self.button2.setToolTip("This is button 2")
              self.button2.setEnabled(False)

              # Create layout and add widgets
              layout = QtWidgets.QVBoxLayout(self)
              layout.addWidget(self.button1)
              layout.addWidget(self.button2)

      def run_app() -> int:
          app = QtWidgets.QApplication([])
          main_window = MainWindow()
          main_window.show()
          return app.exec()

      if _name_ == "_main_":
          run_app()

      ```

        1. pyside_bug.png
          11 kB
          Robin Engler
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            crmaurei Cristian Maureira-Fredes
            robin.engler Robin Engler
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes