OS X titlebar move buttons (like iTunes or SourceTree)
-
Hey guys,
I am trying to make a translucent title bar on OS X. Therefore I am using native NSWindow API to hide the title and rearrange the buttons (close, ...) accordingly. I am doing it like here: https://github.com/stonesam92/ChitChat/blob/master/WhatsMac/AppDelegate.m#L54-L62
I also hook into the resize delegate method of NSWindowDelegate to adjust the buttons when resizing.
When my application starts, the buttons are placed correctly, but if I am interacting with the window (Enter text, ...) then the buttons are misplaced (like they would be placed when having a normal title bar). I do not really know why this is happening, maybe because Qt repaints (or triggers a repaint) of the titlebar and my placement code is not called?
I attached pictures to demonstrate the misbehaviour.
I also tried to use Qt::FramelessWindowHint, but then the buttons are completely gone, and they do not appear even when I am settings the correct NSWindow styleFlags on the native NSWindow (from mainWindow->winId().window).
So is there a proper way to do this? Can I say Qt somehow that I want to take care of the title bar on OS X? Or can I interrupt or listen to an event when repainting titlebar? Why are the buttons gone, even if I am settings the correct flags on the NSWindow instance?
Do you have any hints?
Thanks in advance