To sum up I'm working on a chat application...
In my chat window I installed a filter to my QTextEdit box where a user type's their input. below is the code.
The below code is detecting the event correctly but it is doing qDebug()<<"Here!" 3 times when I only pressed the enter button once. What could be the problem? If so can you provide a potential fix.
Thanks
bool chatWindow::eventFilter(QObject *ob, QEvent *e)
{
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(e);
if(ob == ui->inputWindow)
{
if(keyEvent->key() == Qt::Key_Enter )
{
qDebug()<< "Here!";
return true;
}
return false;
}
return false;
}
Bookmarks