[Interest] keyPressEvent on subclass of QPlainTextEdit

nus1998 nus1998 at yeah.net
Fri May 4 02:55:09 CEST 2018


Hi All,

I have some questions on keyPressEvent on sub-class of QPlainTextEdit, for the code attached below.
If I press '(', '{', or '[', these keys will be displayed in the edit. qDebug outputs 16777248  (value of Shift) for '(' and '{',  and outputs nothing for '['.
if I press any other key, they will be printed correctly and not displayed in the edit.

What's the problem for that?

my env: Qt 5.6.2 minGW version on win10 x64.

Best regards
Nus



#ifndefTESTEDIT_H
#defineTESTEDIT_H
#include<QPlainTextEdit>
#include<QKeyEvent>
#include<QDebug>


classTestEdit:publicQPlainTextEdit
{
Q_OBJECT
public:
TestEdit(){}
protected:
virtualvoidkeyPressEvent(QKeyEvent*e){qDebug()<<e->key();}
};


#endif//TESTEDIT_H

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180504/090e77ee/attachment.html>


More information about the Interest mailing list