[solved] ignore key press into editText?
-
how can I ignore key in key event in QTextEdit? if user pushs Enter key I want handle enter press event but I want to ignore new line into editText. how to do this?
bool MyTextEdit::eventFilter(QObject *target, QEvent *event) { if(event->type() == QKeyEvent::KeyPress){ QKeyEvent *key = static_cast<QKeyEvent*>(event); if(key->key() == Qt::Key_Enter){ qDebug() << "ok I can handle event here "; event->ignore(); return true; } } return QObject::eventFilter(target, event); }