KStandardAction::showMenubar and native menubars

Aleix Pol aleixpol at kde.org
Wed Oct 12 23:27:16 UTC 2016


On Wed, Oct 12, 2016 at 12:05 AM, Albert Astals Cid <aacid at kde.org> wrote:
> On platforms with native menubars (Mac, Unity) the showMenuBar action makes
> no sense since the menubar is integrated in the desktop shell instead of the
> application so the application gains no space by hiding/showing the menubar
> (sometimes it isn't possible to hide it at all)
>
>
>
> So on thos platforms havign a menu item that does virtually nothing is bad
> and can be a little disconcerting.
>
>
>
> I was thinking if we could somehow fix it centrally in frameworks instead of
> patching every app that has a KStandardAction::showMenubar
>
>
>
> My current (yet to implement/test) idea is have KStandardAction::showMenubar
> check all the menubars of the top level windows of the app and if they are
> all marked as native, then return a dummy QAction that is not inserted in
> the menubar/actionCollection and that already returns "true" for checked.
>
>
>
> This way the app thinks it got a real action to control the menubar status,
> but it is never shown to the user.
>
>
>
> What do you think, do you think it could work or it is trying to be too
> smart and it'll break somehow?

I think it would be great if it did integrate without having to touch
the code and the approach you suggest sounds like it would make sense.
TBH, I didn't expect so many applications hardcoding the action in
their code, I expected it to be a kxmlgui magic thing.

Anyway, your approach would work, I'd give it a try, I don't see a
more elegant approach, even though it sounds a bit hackish. ;)

Aleix


More information about the Kde-frameworks-devel mailing list