Programación de teclas QT
línea _ editar _ 1-& gt; installEventFilter(esto);
línea _ editar _ 2-& gt; iniciar sesión en el diálogo::filtro de evento(q objeto * obj, QEvent *evento)
{
if(obj == línea _ editar _ 1 | | obj == línea _ editar _ 2)
{
if(evento-> tipo() == QEvent::KeyPress)
{
bool es _ foco _ 1 = línea _ editar _ 1->tiene foco();
bool es _focus_2 = línea_edit_2->tiene foco();
//Convertir eventos en eventos de teclado
qkey event * key _ event = static _ cast & lt; QKeyEvent * & gt(event);if (key_event->key() == Qt); ::Key_Right)
{
if(is_focus_1)
{
focusNextChild();
line_edit_2 ->setFocus();
}
}
}
}
Porque algunos de Qt Los controles propios incluyen botones arriba, abajo, izquierda y derecha, incluidos algunos eventos clave como Tab, ¡debes bloquearlos e implementarlos tú mismo!