Discussion:
Whence the accelerators?
Matthew Woehlke
2017-05-04 19:40:00 UTC
Permalink
In KDevelop 4.x, I got used to being able to right-click a project and
hit 'b' to quickly build that project.

In KDevelop 5.1.0, this doesn't work; in fact, the project context menu
doesn't appear to have *any* accelerators. Did something happen to them,
or have I turned them off somehow?
--
Matthew
Aleix Pol
2017-05-04 23:31:13 UTC
Permalink
On Thu, May 4, 2017 at 9:40 PM, Matthew Woehlke
Post by Matthew Woehlke
In KDevelop 4.x, I got used to being able to right-click a project and
hit 'b' to quickly build that project.
In KDevelop 5.1.0, this doesn't work; in fact, the project context menu
doesn't appear to have *any* accelerators. Did something happen to them,
or have I turned them off somehow?
I confirm they don't work here (never used it in kdev4 though).

I'm pretty sure this is an issue in Qt5 though, and will need investigation.

It's not a feature we ever added or removed explicitly, AFAIK.

Aleix
René J.V. Bertin
2017-05-05 08:17:05 UTC
Permalink
Post by Aleix Pol
I'm pretty sure this is an issue in Qt5 though, and will need investigation.
It's not a feature we ever added or removed explicitly, AFAIK.
Isn't it supposed to be that you have to add accelerators explicitly by putting an ampersand at the desired location in the action title string?
IOW, maybe Qt5 just dropped an undocumented feature from Qt4.

I agree though that some investigation on (keyboard) control of the build options would be nice. It's a bit hit-and-miss at the moment depending on where the focus is, as if the IDE tries to guess what the target for the build command should be (while most of the time it's simply the project and rarely if ever just that file you modified). That has already bitten me in the sense that I specifically wanted NOT to rebuild an entire project but only a small part.

This goes beyond accelerators, but to get consistent behaviour one might consider to
- provide a build target selector (drop-down menu, preferably with a text-input field); this target would be used unless a different one was specified explicitly
- provide a different action with shortcut for "compile this file only" ... which would of course have to do better figuring out how to accomplish that
- maintain the possibility to build a specific target via the context menu.

---
[It seems the older I get the more I want to do everything exclusively either with a pointing device or the keyboard. Regardless of whether I have a trackpad sitting under a laptop keyboard or an external mouse/trackpad.]
---

R.
Kevin Funk
2017-05-05 08:17:48 UTC
Permalink
Post by Matthew Woehlke
In KDevelop 4.x, I got used to being able to right-click a project and
hit 'b' to quickly build that project.
In KDevelop 5.1.0, this doesn't work; in fact, the project context menu
doesn't appear to have *any* accelerators. Did something happen to them,
or have I turned them off somehow?
This was a KMenu (from kdelibs) feature [1] -- which is deprecated nowadays.
During the kdelibs (Qt4) -> KF5 (Qt5) transition we ported all uses of KMenu
to QMenu, which doesn't have this feature.

[1] See:
https://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/html/
classKMenu.html#a1c4c4b910df899d814e511e357283bcd

You'd need to port KMenu's accelerator feature to QMenu to fix.

Cheers,
Kevin
--
Kevin Funk | ***@kde.org | http://kfunk.org
Alexander Zhigalin
2017-05-05 08:55:27 UTC
Permalink
René J.V. Bertin
2017-05-05 09:16:54 UTC
Permalink
https://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/html/classKMenu.html#a1c4c4b910df899d814e511e357283bcd
You'd need to port KMenu's accelerator feature to QMenu to fix.
Porting shouldn't be hard, getting it accepted into Qt is a different task altogether 8-)
But we can use the Alt key, right?
Now in the project context menu (see screenshot) there are alt-bindings only for "copy" and "paste" entries...
Ctrl (or Command, on Mac). Yes, those are most likely added automatically by Qt. There are ways to assign short-cuts to the other actions too, but AFAIK that has already been done because they do appear in the shortcuts editor. Maybe the same thing happens here that I also ran in to when I tried to make the shortcuts for Rename, Delete etc. configurable (IIRC they too never appeared in the context menu and were generally unreliable).

Could this have something to do with the fact that those contextmenu actions are created and added on the fly, just before the contextmenu appears?

R.
Alexander Zhigalin
2017-05-05 09:23:56 UTC
Permalink
Kevin Funk
2017-05-05 09:31:44 UTC
Permalink
Post by Matthew Woehlke
Hello
In KDevelop 4.x, I got used to being able to right-click a project and
hit 'b' to quickly build that project.
In KDevelop 5.1.0, this doesn't work; in fact, the project context menu
doesn't appear to have *any* accelerators. Did something happen to them,
or have I turned them off somehow?
This was a KMenu (from kdelibs) feature [1] -- which is deprecated nowadays.
During the kdelibs (Qt4) -> KF5 (Qt5) transition we ported all uses of
KMenu to QMenu, which doesn't have this feature.
https://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/html/classKMenu.html#a1c
4c4b910df899d814e511e357283bcd
You'd need to port KMenu's accelerator feature to QMenu to fix.
But we can use the Alt key, right?
Now in the project context menu (see screenshot) there are alt-bindings only
for "copy" and "paste" entries...
Hmm, true.

And actually just opening that menu and pressing 'c' or 'p' has the desired
effect. So it's indeed just related to those other specific actions in that
menu. The feature in general works.

Seems like those actions just don't have proper accelerators in their titles.
I'd say: patches welcome!

See:
ProjectManagerViewPlugin::contextMenuExtension( KDevelop::Context* context )
in kdevplatform.git

I think the key difference is that under kdelibs, KMenu generated accelerators
on the fly for all actions in the menu; while QMenu does not do that => thus
we have to add accelerators ourselves.

Again, patches or more debugging welcome, for those who'd like to have this
feature fixed.

Greets,
Kevin
Post by Matthew Woehlke
Cheers,
Kevin
--
--
Alexander Zhigalin - DevOps
--
Kevin Funk | ***@kde.org | http://kfunk.org
Alexander Zhigalin
2017-05-05 11:01:13 UTC
Permalink
Matthew Woehlke
2017-05-05 13:49:05 UTC
Permalink
Done.
https://cgit.kde.org/kdevplatform.git/commit/?id=a8f3ba3d6c629489e28eee3603de3034943afeeb
https://cgit.kde.org/kdevplatform.git/commit/?id=4a96a875c97f0479d66dec7a951d298f6223c8b7
@Matthew just update, right-click a project and hold 'Alt' to see the accelerators
Heh, ignore my other mail; SHFRTT :-). Thank you! (Now I just have to
wonder how long until Fedora packages that... ;-))
--
Matthew
Matthew Woehlke
2017-05-05 13:43:27 UTC
Permalink
Post by Kevin Funk
Post by Matthew Woehlke
In KDevelop 4.x, I got used to being able to right-click a project and
hit 'b' to quickly build that project.
In KDevelop 5.1.0, this doesn't work; in fact, the project context menu
doesn't appear to have *any* accelerators. Did something happen to them,
or have I turned them off somehow?
This was a KMenu (from kdelibs) feature [1] -- which is deprecated nowadays.
During the kdelibs (Qt4) -> KF5 (Qt5) transition we ported all uses of KMenu
to QMenu, which doesn't have this feature.
https://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/html/
classKMenu.html#a1c4c4b910df899d814e511e357283bcd
You'd need to port KMenu's accelerator feature to QMenu to fix.
Um... is there a reason that accelerators can't be "hard-coded"? (I
assume this is how most of the menus still have them?)
--
Matthew
René J.V. Bertin
2017-05-05 14:44:13 UTC
Permalink
Post by Matthew Woehlke
Um... is there a reason that accelerators can't be "hard-coded"? (I
assume this is how most of the menus still have them?)
I was going to reply something along the line "bad practice?" but that was before I looked at the commits O:-)

R.

Matthew Woehlke
2017-05-04 20:48:06 UTC
Permalink
Post by Matthew Woehlke
In KDevelop 4.x, I got used to being able to right-click a project and
hit 'b' to quickly build that project.
In KDevelop 5.1.0, this doesn't work; in fact, the project context menu
doesn't appear to have *any* accelerators. Did something happen to them,
or have I turned them off somehow?
I think they are still there but some themes don't display them by
default ... maybe press Alt?
No effect. Anyway, it's not just that they aren't *visible*; pressing
'b' has no effect either. (Also, accelerators for other menus, including
other popup menus, are visible. The problem seems to be with that one
specific menu.)
--
Matthew
Loading...