kxmlgui shortcuts regression

Michael Jansen kde at michael-jansen.biz
Fri Sep 19 21:55:52 BST 2008

On Friday 19 September 2008 13:56:24 Nick Shaforostoff wrote:
> Hi.
> Shortcuts specified using QAction::setShortcut() (before calling
> createGUI()/setupGUI()) stopped being respected:
> actions show w/o any shortcut in application now. I saw this in
> Lokalize and Gwenview.
> Currently, only kstandardactions have shortcuts be default.

I didn't understand what you meant with the above paragraph. annma kindly 
showed me the problem. May i suggest next time to show exactly how to 
reproduce the problem step by step?

The problem is no regression in kde code. It's a problematic use of it. Even 
if KAction inherits QAction it is not possible to override QActions 
setShortcut method. It is not virtual. As lokalize sets the shortcuts using a 
QAction* kdes code never had the chance to do things properly.

NEVER DO THAT. Never call setShortcut over an QAction* if the action is a 

The problem was found by annma. I forgot to properly give credit in my commit 
so i do it now :-) .

See commit r862782.

> Also, while I'm on this topic, I'd like to complain:
> -If I change shortcut for some action from default to any other
> (currently this is possibly only for kstandardaction -- see above),
> then change it back to default not by selecting 'Default', but by
> typing it, then
> the 'Custom' field gets autocleared, although it stays selected
> (while obvious behaviour would be to autoselect 'Default')

You mean selected as in has the focus? That i can reproduce.
Selected as in "the radio button is down" is defaults. Sorry i have no idea to 
express this better.

> -I use KXmlGuiWindow::guiFactory()->addClient() and removeClient() to
> embed other KXmlGuiWindows,
> and when I change shortcuts for actions from subKXmlGuiWindows:
> --currently: shortcuts stop being effective
> --previous behaviour: changes get applied only after restart.

Could you please give a use case? I have no idea what you are talking about. 
But perhaps david can help you as in "know that beast kxmlguiclient".

Michael Jansen


More information about the kde-core-devel mailing list