Basic QPushButton keyboard shortcut test fails under KDE session

Elvis Stansvik elvstone at gmail.com
Sun May 8 16:46:14 UTC 2016


2016-05-08 16:10 GMT+02:00 Bhushan Shah <bhush94 at gmail.com>:
> On Sunday, May 8, 2016 7:26:32 PM IST, Elvis Stansvik wrote:
>>
>> Hitting Ctrl+O would not print "clicked" as expected.
>>
>>
>> But then I tested logging out and into an Openbox session, and it
>> worked from there. The strange thing is that it works with Qt 4.8.7
>> under the very same KDE session where it fails with Qt 5.6.0.
>>
>> Even stranger is that neither:
>>
>>     killall kwin_x11
>>     openbox &
>>     ./test
>>
>> which I would have thought would give the same result as a logout +
>> login to Openbox, nor
>>
>>     kquitapp5 plasmashell
>>     ./test
>>
>> works, if I do that in the running KDE session. So there must be some
>> other KDE process I'm unaware of which intercepts the shortcut.
>>
>> I'm now unsure whether the problem is with Qt 5.6.0, with some
>> KDE/Plasma component, or somehow with both.
>>
>> Would appreciate a lot if someone could check and see if they can
>> reproduce.
>>
>
> Given I debugged this earlier and can't think of any nicer solution, would
> be useful for you..
>
> This comes from
> kde:plasma-integration/src/platformtheme/kdeplatformtheme.cpp
>
> QList<QKeySequence> KdePlatformTheme::keyBindings(QKeySequence::StandardKey
> key) const
>
> I think this binds the KStandardActions to those keybindings.. So instead of

Alright, thanks for investigating.

But what do you mean with "those keybindings"? The ones configured in
System Settings -> Shortcuts -> Standard Shortcuts?

I've also tried with e.g. F2, which is not bound to anything in the
System Settings. (Ctrl+O was just an example in the test case above,
in the real app I was interested in binding F1, F2, ..., etc. to a set
of buttons).

And in any case, the system shouldn't hijack keys, should it? An
application should be free to add shortcuts as it sees fit I think
(thought it's of course good to keep to standard conventions).

> listening to clicked best would be to use
> http://api.kde.org/frameworks-api/frameworks5-apidocs/kconfigwidgets/html/namespaceKStandardAction.html
>
> Maybe others might have good solution.

But this is for a Qt-only application, so using KStandardAction is not
an option. And shouldn't a Qt app be able to do the above
(setShortcut(...) on a QPushButton) and expect it to work?

Elvis

>
> Thanks
> _______________________________________________
> Plasma-devel mailing list
> Plasma-devel at kde.org
> https://mail.kde.org/mailman/listinfo/plasma-devel


More information about the Plasma-devel mailing list