KMenu aboutToShowContextMenu KF5 porting options: None. Do we care?
Albert Astals Cid
aacid at kde.org
Mon Feb 1 19:07:20 UTC 2016
El Monday 01 February 2016, a les 08:39:22, David Faure va escriure:
> On Monday 01 February 2016 00:43:27 Albert Astals Cid wrote:
> > In the kdelibs4 world one could connect to KMenu aboutToShowContextMenu
> > signal to add more entries to the submenu that appears when right
> > clicking on a menu entry.
> >
> > Nowadays KMenu is gone in apps that do not use kdelibs4support so we can't
> > use that.
> >
> > We still have a default menu that appears when right clicking on a menu
> > entry that shows configure shortcuts and add to menu bar options, but
> > that is hidden deep in kmenumenuhandler_p.cpp in kxmlgui and exporting
> > that to users is probably not going to be trivial (or I couldn't find one
> > in 30 min).
> >
> > In Okular we used this signal to add the "Rename bookmark" to existing
> > bookamrks of the given file, see http://i.imgur.com/UkUVWZx.png
> >
> > Looking at lxr, Okular seems to be the only one using this feature.
> >
> > Talking with Aleix yesterday he was arguing that is kind of a hidden
> > feature (though there's bug reports to make it do more things) and that
> > it would be probably be easier to just drop it in the KF5 port than
> > trying to expose this feature again.
> >
> > I'm asking for more opinions on whether it makes sense for us to think of
> > an API to make the context menu on menu entries extensible or we think
> > it's better to not have it and I just drop the feature.
>
> Konqueror (both 4 and 5) has this feature too (with 6 items in the
> contextmenu), it is actually implemented in the kbookmarks framework (so
> not using kdelibs4support), see the class KonqBookmarkContextMenu.
>
> Looks like all you need is
> m_parentMenu->setContextMenuPolicy(Qt::CustomContextMenu);
> connect(m_parentMenu, &QWidget::customContextMenuRequested, this,
> &KBookmarkMenu::slotCustomContextMenu);
But by doing that i "loose" the default kxmlgui actions, no?
Cheers,
Albert
More information about the Kde-frameworks-devel
mailing list