Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Enabling macOS Wallpaper Tinting
Qt 6.11 is out! See what's new in the release blog

Enabling macOS Wallpaper Tinting

Scheduled Pinned Locked Moved Unsolved Qt for Python
pysidepython
1 Posts 1 Posters 757 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mjiggidyj
    wrote on last edited by mjiggidyj
    #1

    For a while now, macOS has had an "Allow wallpaper tinting in windows" option which sort of tints the window color based on the wallpaper. It's a subtle effect, but noticeable when you compare a stark white QtWidgets window against a native mac application that can use the tinting.

    I've asked around about a way to enable it in QtWidgets before, and for a while people were saying it wasn't possible unless you fake it one way or another. But recently ChatGPT gave me some code that seems to kind of work, but I don't blindly trust ChatGPT and I can't really find any documentation about this method that specifically says anything about window tinting. The code (Pyside6):

    from PySide6.QtWidgets import QApplication, QMainWindow
    from PySide6.QtCore import Qt
    from PySide6.QtGui import QSurfaceFormat
    
    # Set up the surface format for translucency
    surface_format = QSurfaceFormat()
    surface_format.setAlphaBufferSize(8)
    QSurfaceFormat.setDefaultFormat(surface_format)
    
    app = QApplication([])
    
    # Create the main window
    window = QMainWindow()
    
    # Enable translucency
    window.setAttribute(Qt.WA_TranslucentBackground)
    
    # Show the window
    window.show()
    
    app.exec()
    

    Can anyone point me to any documentation at all, that has ever existed, specific to macOS Window Tinting with Qt? Or perhaps explain why adding an alpha channel to the QSurfaceFormat and setting a Translucent flag on the window seems to trigger support for Window Tinting?

    I'm happy that it seems to work, but I don't understand how anyone would have been expected to figure this out, and I'd love to know if there are other parameters I can play with to affect how Qt responds to macOS's window tinting feature.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved