View Issue Details

IDProjectCategoryView StatusLast Update
0027411LazarusIDEpublic2015-02-13 10:30
ReporterMichael Ring Assigned ToZeljan Rikalo  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformMac OS XOSMac OS X 
Product Version1.2.7 (SVN) 
Summary0027411: ALT Modifier Key does not work in IDE Editor when LAzarus is build with QT
DescriptionWhen I build Lazarus IDE with QT Widgetset the ALT-Key does not work in the IDE Editor. For my Mac with german keyboard that means that the []{} keys are not available.
Steps To ReproduceBuild lazarus with QT Widgetset on a Mac, (any version of Lazarus from the last year should show the problem) and try to enter a character that requires the ALT-Key to be pressed.
Additional Informationreeman on lazarus List has the same problem, here his report:

Yes Michael, you right.
Problem in source editor side, "alt" key not work, I mean not just that symbols, all "alt" key combinations not work. In object inspector, I wrote [a,b,c]{} and copy to clipboard and paste in source editor.
TagsNo tags attached.
Fixed in Revision47734
LazTarget-
WidgetsetQT
Attached Files

Activities

Zeljan Rikalo

2015-02-07 12:18

developer  

qt_macosx_alt_key.diff (1,287 bytes)   
Index: lcl/interfaces/qt/qtwidgets.pas
===================================================================
--- lcl/interfaces/qt/qtwidgets.pas	(revision 47600)
+++ lcl/interfaces/qt/qtwidgets.pas	(working copy)
@@ -3049,8 +3049,15 @@
   if (QKeyEvent_key(QKeyEventH(Event)) = QtKey_Enter) and (length(Text) = 1) then
     Text := #13;
 
+  ScanCode := QKeyEvent_nativeVirtualKey(QKeyEventH(Event));
+  {$IFDEF VerboseQtKeys}
+  // ScanCode := QKeyEvent_key(QKeyEventH(Event));
+  writeln('!!!**** NATIVEVIRTUALKEY=',ScanCode,' lenText=',length(Text),' Modifiers ',Modifiers,' AKEYCODE=',AKeyCode);
+  {$ENDIF}
+
   // set groupswitch for Shift+Option.
-  if (length(Text) = 1) and (Modifiers = QtAltModifier or QtShiftModifier) then
+  if (length(Text) = 1) and
+    ((Modifiers = QtAltModifier or QtShiftModifier) or ((Modifiers = QtAltModifier) and (ScanCode > 0))) then
   begin
     ScanCode := QKeyEvent_key(QKeyEventH(Event));
     // Arrow keys are reserved by macOSX keyboard commands
@@ -3068,7 +3075,7 @@
   {$ENDIF}
 
   {$IFDEF VerboseQtKeys}
-  writeln('> TQtWidget.SlotKey dump begin event=',EventTypeToStr(Event));
+  writeln('> TQtWidget.SlotKey dump begin event=',EventTypeToStr(Event),' IsSysKey ',IsSysKey);
 
   S := '';
   if Modifiers and QtShiftModifier <> 0 then
qt_macosx_alt_key.diff (1,287 bytes)   

Zeljan Rikalo

2015-02-07 12:19

developer   ~0080835

Please test with attached patch against trunk lazarus and give feedback (it can be applied to 1.2.7 too I guess).

freeman35

2015-02-08 12:10

reporter   ~0080857

Last edited: 2015-02-08 12:21

View 2 revisions

This patch work on my yosmite, but :) not all of them.
 
Just info: I have to change key map scheme, because F12 & F11 is system keys (show desktop and show dashboard on osx, this is osx system defaults)
ctrl + alt + up and down key as well

I mean yes {[]} keys now working, but some alt combination not working for me,
Procedure list alt + G this is default, but never work on mine osx. I try to "cntrl + <" key I'll try set from grab key, its shows "ctrl + ," I save this. Then try find key and press this key combination its not found, but its saved.

can be helpful systems keys
http://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts

Zeljan Rikalo

2015-02-08 16:16

developer   ~0080863

Alt + g cannot work since it produces anoter sign as I can see.

freeman35

2015-02-12 18:32

reporter   ~0081002

can you apply this pach to trunk version? I'm testing some codes, and some time I remove lazarus and reinstall, some times forget to add this pach and I loose time.
Thank you

Zeljan Rikalo

2015-02-12 20:06

developer   ~0081004

Not yet.

Zeljan Rikalo

2015-02-13 10:30

developer   ~0081019

Please test and close if ok.

Issue History

Date Modified Username Field Change
2015-02-06 16:55 Michael Ring New Issue
2015-02-06 20:46 Zeljan Rikalo Assigned To => Zeljan Rikalo
2015-02-06 20:46 Zeljan Rikalo Status new => assigned
2015-02-07 12:18 Zeljan Rikalo File Added: qt_macosx_alt_key.diff
2015-02-07 12:19 Zeljan Rikalo LazTarget => -
2015-02-07 12:19 Zeljan Rikalo Note Added: 0080835
2015-02-07 12:19 Zeljan Rikalo Status assigned => feedback
2015-02-08 12:10 freeman35 Note Added: 0080857
2015-02-08 12:21 freeman35 Note Edited: 0080857 View Revisions
2015-02-08 16:16 Zeljan Rikalo Note Added: 0080863
2015-02-12 18:32 freeman35 Note Added: 0081002
2015-02-12 20:06 Zeljan Rikalo Note Added: 0081004
2015-02-13 10:30 Zeljan Rikalo Fixed in Revision => 47734
2015-02-13 10:30 Zeljan Rikalo Note Added: 0081019
2015-02-13 10:30 Zeljan Rikalo Status feedback => resolved
2015-02-13 10:30 Zeljan Rikalo Resolution open => fixed