Thread: Possible bug?
View Single Post
Old 09-08-2021, 05:10 PM   #27
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 692
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Misc
@KevinH:
Perhaps the solution for Windows would be to use the system MAPVK_VK_TO_CHAR check?

I quote from the documentation:
Quote:
The uCode parameter is a virtual-key code and is translated into an unshifted character value in the low order word of the return value. Dead keys (diacritics) are indicated by setting the top bit of the return value. If there is no translation, the function returns 0.
Then we will know what key was really pressed with Shift.

I did a try and I think it should work, but you would need to add a condition (Windows only) that would specify modifiers + unshifted key (if one of the modifiers is Shift) and then display that value in the Preferences window and save it to sigil.ini.

Code:
#include <Windows.h>
Add to void KeyboardShortcutsWidget::handleKeyEvent(QKeyEvent *event)

Code:
const auto unshifted_key = MapVirtualKeyA(vk, MAPVK_VK_TO_CHAR);
qDebug() << "Unshifted key:" << (char)unshifted_key;
Debug:
Code:
Debug: Original key: !
Debug: Unshifted key: 1
Debug: Full key sequence: "Shift+!"

Debug: Original key: @
Debug: Unshifted key: 2
Debug: Key sequence: "Shift+@"

Debug: Original key: #
Debug: Unshifted key: 3
Debug: Key sequence: "Shift+#"
BeckyEbook is offline   Reply With Quote