if (target == lineEdit) { if (event->type() == QEvent::KeyPress) { QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event); if (keyEvent->key() == Qt::Key_Enter) { transmitData(); //event->accept(); return true; } } else { return false; } } return QWidget::eventFilter(target, event);
} else { return false; }
if (keyEvent->key() == Qt::Key_Enter) { transmitData();
connect(lineEdit, SIGNAL(returnPressed()), SLOT(eventFilter()));void Terminal::eventFilter(){ transmitData();}