标签:div rdm bsp style edit sse ignore == blog
QTextEdit 文本框中 回车键提交文本,Ctrl+回车键实现换行的代码:
void QTextEdit::keyPressEvent(QKeyEvent * e) { e->ignore(); auto k = e->key(); if (k == Qt::Key_Return) { auto modify = e->modifiers(); if (modify == Qt::KeyboardModifier::ControlModifier) { e->setModifiers(modify^Qt::KeyboardModifier::ControlModifier); e->accept(); } else { emit msgsending(); e->accept(); return; } } QTextEdit::keyPressEvent(e); }
标签:div rdm bsp style edit sse ignore == blog
原文地址:http://www.cnblogs.com/lucienbao/p/QTextEdit_keyPressEvent.html