7 #include <QPlainTextEdit>
15 if (event->type() == QEvent::KeyPress)
17 if (QKeyEvent *e =
dynamic_cast<QKeyEvent *
>(event))
23 QPlainTextEdit *pte = qobject_cast<QPlainTextEdit *>(
object);
24 if (!pte) {
return false; }
25 if (pte->isReadOnly()) {
return false; }
27 if (e->text().length() == 1)
29 const QChar c = e->text().front();
32 const ushort unicode = c.unicode();
33 if (unicode > 127) {
return true; }
35 pte->insertPlainText(e->text().toUpper());
bool eventFilter(QObject *object, QEvent *event)
Filter.