Open probonopd opened 2 years ago
Need to find a way to get QKeySequence::StandardKey
to behave like on the Mac.
https://doc.qt.io/qt-5/qkeysequence.html#StandardKey-enum
Note that the key bindings are platform dependent. The currently bound shortcuts can be queried using keyBindings().
How can we change it so that it behaves like on the Mac?
If we can't find another way to implement this, then maybe go the LD_PRELOAD
route like in https://github.com/helloSystem/QKeySequenceOverride/ for QList<QKeySequence> QKeySequence::keyBindings(QKeySequence::StandardKey key)
too.
The keyboard scheme is set by the platform theme. Which is defined is sort of documented.
You can force a theme by setting the QT_QPA_PLATFORMTHEME
environment variable or explicitly setting it for each Qt application invocation, but it looks like you would need a platformtheme plugin that would return the correct ThemeHint.
The only themes that return MacKeyboardScheme
are the Cocoa and iOS themes, but I doubt those are built on X11. I suspect that otherwise it uses the qgenericunixthemes.cpp unless a platformtheme plugin intercepts it.
You could consider creating a helloSystem platformtheme plugin that simply reimplements themeHint() to do the right thing. There is something like this done for GTK3 or QXdgDesktopPortal, so it might be a starting point there.
This is at least a basic map of what you would need to do, hope this helps.
Thanks @NorwegianRockCat.
We are exporting QT_QPA_PLATFORMTHEME=panda
and are loading our own platformtheme plugin but the following does not seem to have an effect:
In any case, will follow your hint to check out what GTK3 and QXdgDesktopPortal are doing.
Currently we have the clearly Windows-inspired "F3" for Find Again, whereas we want Command-G.
Supposedly we can get this for all Qt applications by setting
QPlatformTheme::MacKeyboardScheme
. How?Command-G is mentioned in the early Macintosh Human Interface Guidelines:
Source: Apple Computer, Inc. 1992. Macintosh human interface guidelines. Addison-Wesley Publishing Company, USA. https://dl.acm.org/doi/book/10.5555/573097