[Qt-interest] [OS X] Auto-hide toolbar when going "native fullscreen" on "Lion"?

Till Oliver Knoll till.oliver.knoll at gmail.com
Fri Aug 5 11:21:02 CEST 2011


[now correctly to the list]

2011/8/4 John Weeks <john at wavemetrics.com>:
>
> On Aug 4, 2011, at 1:51 AM, Till Oliver Knoll wrote:
>
> > This off course replaces the existing window delegate...
>
> Can't you get the delegate that's already installed and call it as part of
> your replacement delegate?

Ah, only now do I actually fully understand what you meant with "and
call it as part of your replacement" ;) Instead of setting my own
window delegate which is implemented "from scratch" I would set my own
window delegate but which is somehow "based upon" the existing
QCocoaWindowDelegate.

Well, the above attempt was really just a learning effort to see
whether my own delegate (the desired method
"window:willUseFullScreenPresentationOptions:") would actually be
called and whether the toolbar would then indeed disappear. That part
worked, but with the described and somewhat expected sideeffects such
as the distorted layout.

As I described before my "real" approach was then to extend the
existing QCocoaWindowDelegate with the "Categories" approach, but that
one failed with the metioned linker error so far.


But I guess I'll try a completely different approach now: whenever the
window resizes (http://doc.qt.nokia.com/4.7/qwidget.html#resizeEvent)
I will check whether it has gone fullscreen (or vice-versa: whether it
was fullscreen before and now has gone "normal size") and if so toggle
the toolbar (and some other sidebar widget) visibility with Qt means
myself (QWidget::setVisible).

A bit hackish since it requires me to remember the "fullscreen" state,
but also should solve the problem when the user clicks on the new
"Lion fullscreen button" on the top-right of the title bar (since in
this case none of my slots are called anyway and I could not turn of
visibility of that other widget, the sidebar widget).


Thanks,
  Oliver



More information about the Qt-interest-old mailing list