[Interest] Using NSTitlebarAccessoryViewController in a Qt window

Adam Light aclight at gmail.com
Tue Sep 4 20:33:08 CEST 2018


Hi

I'm trying to add a NSTitlebarAccessoryViewController to the title bar of a
Qt window, similar to the example at
https://github.com/msorvig/qt-macos-nswindow-config (look for "Add
addTitlebarAccessoryViewController").

I've tried the example application given at the link above with Qt 5.9.6 on
macOS 10.13. When I check the Accessory views checkbox in the configurator
panel, the position of the title of the example window shifts to the right,
but I don't see either the green or red checkerboard patterns in the title
bar.

I can get closer if I edit the main() function and call show() on
leftAccessoryWindow and rightAccessoryWindow just before the call to
macWindow->show(). However in this case, I get small separate windows for
the two accessory windows. If I manually resize one of those windows by
dragging the corner, then the corresponding MacWindow titlebar accessory
view is updated. But that's clearly not the intended behavior.

Our application uses 5.9 because it's a LTS, and we'd prefer to stick with
that version. I haven't tried using a newer Qt version so I don't know if
this problem is due to an older Qt version, the macOS version, or something
else.

Does anyone have any experience getting such a thing to work in a Qt
application?

Thanks
Adam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180904/05bfe883/attachment.html>


More information about the Interest mailing list