You can also use QWidget::focusNextPrevChild like
{
switch (e->key ()) {
case Qt::Key_Return:
case Qt::Key_Enter:
focusNextPrevChild (true);
break;
default:
}
}
void MyDialog::keyPressEvent(QKeyEvent *e)
{
switch (e->key ()) {
case Qt::Key_Return:
case Qt::Key_Enter:
focusNextPrevChild (true);
break;
default:
QDialog::keyPressEvent (e);
}
}
To copy to clipboard, switch view to plain text mode
or
{
switch (e->key ()) {
case Qt::Key_Return:
case Qt::Key_Enter:
{
qApp->postEvent (this, newEvent, 0);
}
break;
default:
}
}
void MyDialog::keyPressEvent(QKeyEvent *e)
{
switch (e->key ()) {
case Qt::Key_Return:
case Qt::Key_Enter:
{
QKeyEvent* newEvent = new QKeyEvent (QEvent::KeyPress, Qt::Key_Tab, e->modifiers ());
qApp->postEvent (this, newEvent, 0);
}
break;
default:
QDialog::keyPressEvent (e);
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks