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

Fixes Shortcuts prevent inputs with AltGr #29021 #51420

Merged
merged 2 commits into from
Jan 17, 2023

Conversation

YoannQDQ
Copy link
Contributor

@YoannQDQ YoannQDQ commented Jan 10, 2023

Fixes #29021

Description

A long standing bug in QGIS is the inability to enter some characters (}, |, ...) on windows, with keyboard layouts that use the AltGr key (Spanish, French...). This is particularly annoying within the python console.

The reason is that Qt considers by default the AltGr key to be a shortcut for Ctrl+Alt, which causes some QGIS global shortcuts to be fired instead of entering the character.

There has been some discussion about this on PR #38608.
This is not specific to QGIS, as it happens in other Qt applications (see https://bugreports.qt.io/browse/QTBUG-73247)

Setting the environment variable QT_QPA_PLATFORM=windows:altgr before creating the QgsApplication on windows builds could neatly solve the issue. (cf. https://doc.qt.io/qt-6/qguiapplication.html#platform-specific-arguments)

@github-actions github-actions bot added this to the 3.30.0 milestone Jan 10, 2023
@YoannQDQ YoannQDQ mentioned this pull request Jan 10, 2023
@YoannQDQ
Copy link
Contributor Author

I'm not sure this is the right way to do it, but it seems to work (at least for the portable version on Windows)

@DelazJ
Copy link
Contributor

DelazJ commented Jan 10, 2023

@YoannQDQ Can you add a more verbose and explicit title to the pull request, please? Thanks

@YoannQDQ YoannQDQ changed the title Fixes #29021 Fixes Shortcuts prevent inputs with AltGr #29021 Jan 10, 2023
@nyalldawson
Copy link
Collaborator

Looks good to me, I'd love a second opinion though!

@YoannQDQ
Copy link
Contributor Author

Huh. Pipeline failed, but if I understand the logs correctly, it's not on me. Could someone trigger another run?

@nicogodet nicogodet closed this Jan 11, 2023
@nicogodet nicogodet reopened this Jan 11, 2023
@roya0045
Copy link
Contributor

Strange, I never had any issues with key modifiers.

@YoannQDQ
Copy link
Contributor Author

Strange, I never had any issues with key modifiers.

Which OS/keyboard layout do you use?
On Windows 10, AZERTY french layout, I just can't enter } or | unless I disable some shortcuts.

@roya0045
Copy link
Contributor

Strange, I never had any issues with key modifiers.

Which OS/keyboard layout do you use? On Windows 10, AZERTY french layout, I just can't enter } or | unless I disable some shortcuts.

Qwerty with can-fr or can-multilingual layout. Win10

@agiudiceandrea
Copy link
Contributor

agiudiceandrea commented Jan 11, 2023

@roya0045, the issue also occurs using the Italian and Spanish keyboard layouts (as reported in the issue report).
On Windows, with every keyboard that maps to a char any AltGr key combination also mapped by default in QGIS as an Ctrl+Alt key combination, it is impossible to type such char in the Python console.
For the Italian and Spanish keyboard layouts the issue is with the ] char (AltGr++ / Ctrl+Alt++ Zoom In).

@nyalldawson nyalldawson merged commit 8973eb0 into qgis:master Jan 17, 2023
@@ -891,6 +891,16 @@ int main( int argc, char *argv[] )
// Initialize the application and the translation stuff
/////////////////////////////////////////////////////////////////////


#if defined(Q_OS_WIN)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, is Q_OS_WIN referring to the host at compile time or the build target?

@YoannQDQ YoannQDQ deleted the fixes-#29021 branch February 22, 2023 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

']' keyboard (alt-gr + '+' ) not working on QGis 3.4.4 with Spanish or Italian keyboard - Windows
7 participants