Hello,
i have problem with handling keyboard event, the problem is related to QTextEdit Widget the point is:
i have QTextEdit object for example called writeTextEdit and i installed on it event filter
this->writeTextEdit->installEventFilter(this);
this->writeTextEdit->installEventFilter(this);
To copy to clipboard, switch view to plain text mode
next i implement eventFilter method
if(_e
->type
() == QEvent::KeyPress){ QKeyEvent* eventKey
= static_cast<QKeyEvent
*>
(_e
);
if(eventKey->key() == Qt::Key_Return){
//do something
}
return true;
}else{
return QObject::eventFilter(_o, _e
);
}
}
bool FooClass::eventFilter(QObject* _o, QEvent* _e){
if(_e->type() == QEvent::KeyPress){
QKeyEvent* eventKey = static_cast<QKeyEvent*>(_e);
if(eventKey->key() == Qt::Key_Return){
//do something
}
return true;
}else{
return QObject::eventFilter(_o, _e);
}
}
To copy to clipboard, switch view to plain text mode
and when i run my app and want to write something in QTextEdit no letters are show inside, what is the problem?
Best Regards
kaszewczyk
Bookmarks