bugGNU TeXmacs - Bugs: bug #57850, The Qt KeyPressEvent is not...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #57850: The Qt KeyPressEvent is not handled correctly in src/Plugins/Qt/QTMWidget.cpp

Submitter:  Su Chenghao <adrin>
Submitted:  Tue 18 Feb 2020 02:16:57 PM UTC
   
 
Category:  Qt port Priority:  5 - Normal
Item Group:  Error Status:  Fixed
Privacy:  Public Assigned to:  vdhoeven
Originator Name:  Open/Closed:  Closed
Release:  None Release: 
Fixed Release:  None Fixed Release: 
Keywords: 

Fri 27 Oct 2023 04:51:08 PM UTC, comment #5: 

No complaints after three years, so I will close this bug.

Joris van der Hoeven <vdhoeven>
Group administrator
Sat 31 Oct 2020 12:11:35 AM UTC, comment #4: 

I applied a similar fix in revision 13038.
Please check whether it works for you.

Joris van der Hoeven <vdhoeven>
Group administrator
Sat 04 Apr 2020 07:29:05 AM UTC, comment #3: 

I submitted a pull request to fix it (but haven't tested it on Windows for now):

https://github.com/texmacs/texmacs/pull/42

Darcy Shen <sadhen>
Group Member
Tue 31 Mar 2020 03:24:17 PM UTC, comment #2: 

comment #1:

> This issue is non-trivial and I'm not sure how to address it correclty. What if the user want the shortcut C-= on a keyboard where = must be typed as S-+ ?? In my opinion shift cannot be used as a key modifier in a reliable way, or double modifiers are to be allowed only on very simple keys like alphabet. Already number pose a problem since in the French keyboard they must be obtained via shift.


Actually, C-= is just a visual example for this implementation bug. A more sad example is C-# can't be used on windows version because of this bug.

Su Chenghao <adrin>
Tue 31 Mar 2020 03:02:25 PM UTC, comment #1: 

This issue is non-trivial and I'm not sure how to address it correclty. What if the user want the shortcut C-= on a keyboard where = must be typed as S-+ ?? In my opinion shift cannot be used as a key modifier in a reliable way, or double modifiers are to be allowed only on very simple keys like alphabet. Already number pose a problem since in the French keyboard they must be obtained via shift.

Massimiliano Gubinelli <mgubi>
Group administrator
Tue 18 Feb 2020 02:16:57 PM UTC, original submission:  

When you press your keyboard, Qt will dispatch a QKeyEvent as a pointer parameter to the keyPressEvent method that you reimplent in subclass. The event has three basic properties: key(),text() and modifier(). And the Qt window plugin of current version doesn't handle this event correctly with modifiers.

For example, when you press "=/+", the event will be {Qt::Key_Equal(0x3d),"=",};
And when you press "S-=/+", the event will be {Qt::Key_Plus(0x2b),"+",ShiftModifier}; just like intuition.
But when you press "C-S-=/+", the event IS NOT {Qt::Key_Plus(0x2b),"+",ShiftModifier|ControlModifier} BUT {Qt::Key_Plus(0x2b),"=",ShiftModifier|ControlModifier}.

That is, to meet expectations, the handle function should take key press instructions from method key() rather than text().
In src/Plugins/Qt/QTMWidget.cpp, the keyPressEvent function construct instructions from key() only for the situation (unic < 32 && key < 128 && key > 0) and from text() for the other.

As a result, TeXmacs on Windows can't react to shortcut like "C-+".

Su Chenghao <adrin>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by vdhoeven (Posted a comment)
  • -email is unavailable- added by sadhen (Posted a comment)
  • -email is unavailable- added by mgubi (Posted a comment)
  • -email is unavailable- added by adrin (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-10-27 vdhoeven StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2020-10-31 vdhoeven StatusNone Ready For Test
        Assigned toNone vdhoeven

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code