Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to set the NSColorSpace for a QMainWindow

How to set the NSColorSpace for a QMainWindow

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 419 Views 1 Watching
  • 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.
  • C Offline
    C Offline
    CrazyChicken
    wrote on last edited by
    #1

    On MacOS, we used to be able to set the display colorspace on the QMainWindow for our application to allow it to display HDR images on Qt 5.12.8. Since updating to Qt 5.15.2 the following code on a QMainWindow after creation doesn't seem to set the colorspace correctly any more, it seems to revert to NSColorSpace.sRGBColorSpace.

      NSView* view = reinterpret_cast<NSView *>(winId());
      view.window.colorSpace = NSColorSpace.displayP3ColorSpace;
    

    Does anyone knows how we're supposed to be setting the display colorspace these days? Thanks.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      When are you doing that ?
      Did you check if the value is nil before setting it ? If that's the case, I would guess that you are changing the property too early.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      C 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        When are you doing that ?
        Did you check if the value is nil before setting it ? If that's the case, I would guess that you are changing the property too early.

        C Offline
        C Offline
        CrazyChicken
        wrote on last edited by
        #3

        @SGaist said in How to set the NSColorSpace for a QMainWindow:

        Hi,

        When are you doing that ?
        Did you check if the value is nil before setting it ? If that's the case, I would guess that you are changing the property too early.

        Setting that on creation of the window object derived from QMainWindow.
        view.window.colorSpace isn't nil at that point, it's set to "Pro Display XDR colorspace" for my dev setup, it's probably different for the display that the app started on.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Can you provide a minimal compilable example to test that ?
          By the way, which version of macOS are you on ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • C Offline
            C Offline
            CrazyChicken
            wrote on last edited by
            #5

            I'm on Monterey, we had bug reports and QA testing on Catalina and Big Sur. Not sure if I can provide an example. I'll need to work on one.
            Technically though it's a hack dated back to the days of 15.12.1. We picked up the fix by merging changes from these files+version,

            https://code.qt.io/cgit/qt/qtbase.git/tree/src/plugins/platforms/cocoa/qcocoabackingstore.mm?h=5.12.8
            https://code.qt.io/cgit/qt/qtbase.git/tree/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm?h=5.12.8

            If there is a more modern, OS portable way to set the display colorspace for an app, I'd rather use that.

            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