Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable MacKeyboardScheme, make QKeySequence::StandardKey behave like on the Mac #12

Open
probonopd opened this issue Oct 2, 2021 · 4 comments
Labels
help wanted Extra attention is needed

Comments

@probonopd
Copy link
Member

probonopd commented Oct 2, 2021

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:

image

Source: Apple Computer, Inc. 1992. Macintosh human interface guidelines. Addison-Wesley Publishing Company, USA. https://dl.acm.org/doi/book/10.5555/573097

@probonopd probonopd changed the title Enable KMacKeyboardScheme Enable MacKeyboardScheme Oct 2, 2021
@probonopd probonopd added the help wanted Extra attention is needed label Oct 2, 2021
@probonopd
Copy link
Member Author

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?

@probonopd probonopd changed the title Enable MacKeyboardScheme Enable MacKeyboardScheme, make QKeySequence::StandardKey behave like on the Mac Oct 11, 2021
@probonopd
Copy link
Member Author

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.

@NorwegianRockCat
Copy link

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.

@probonopd
Copy link
Member Author

probonopd commented Nov 21, 2021

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:

m_hints[QPlatformTheme::KeyboardScheme] = QPlatformTheme::MacKeyboardScheme;

In any case, will follow your hint to check out what GTK3 and QXdgDesktopPortal are doing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants