admkrk
12th March 2016, 03:47
I am working on a simple text editor and am trying to catch a few keys, like "[" so I can add in "]" automatically. The handler only fire on special keys like shift, ctrl, f*. I slimmed my code down to this to test when it was not working:
void Editor::keyPressEvent(QKeyEvent *evt)
{
qDebug() << "Key pressed";
}
The characters are printed in the plainTextEdit correctly, but I only get qDebug output for special keys, like I mentioned. I have never had this problem before, in Qt or regular console programs, and my searches turn up the opposite problem. Any ideas on where to look would be a great help.
<edit>
I am using QSyntaxHighlighter in a separate class, could that be what is interfering?
</edit>
void Editor::keyPressEvent(QKeyEvent *evt)
{
qDebug() << "Key pressed";
}
The characters are printed in the plainTextEdit correctly, but I only get qDebug output for special keys, like I mentioned. I have never had this problem before, in Qt or regular console programs, and my searches turn up the opposite problem. Any ideas on where to look would be a great help.
<edit>
I am using QSyntaxHighlighter in a separate class, could that be what is interfering?
</edit>