Commit 3a24859b authored by Christoffer Ackelman's avatar Christoffer Ackelman Committed by Esteban Blanc

QT: Fix CoWowEntry not clearing focus on ESC/RET.

parent aac4be4e
...@@ -1353,27 +1353,23 @@ void WttQtWidget::activate_help_proview() ...@@ -1353,27 +1353,23 @@ void WttQtWidget::activate_help_proview()
void WttQtWidget::valchanged_cmd_entry() void WttQtWidget::valchanged_cmd_entry()
{ {
int sts; if (!wtt->focused_wnav && (wtt->input_open || wtt->command_open)) {
wtt->set_focus_default();
}
if (wtt->input_open) { if (wtt->input_open) {
switch (wtt->input_mode) { int sts = 1;
case wtt_eInputMode_Attribute: if (wtt->input_mode == wtt_eInputMode_Attribute) {
sts = wtt->input_wnav->set_attr_value(wtt->input_node, wtt->input_objid, sts = wtt->input_wnav->set_attr_value(wtt->input_node, wtt->input_objid,
qPrintableLatin1(wtt->cmd_entry->text())); qPrintableLatin1(wtt->cmd_entry->text()));
if (EVEN(sts)) { } else if (wtt->input_mode == wtt_eInputMode_ObjectName) {
wtt->message('E', wnav_get_message(sts));
}
break;
case wtt_eInputMode_ObjectName:
sts = wtt->input_wnav->set_object_name(wtt->input_node, wtt->input_objid, sts = wtt->input_wnav->set_object_name(wtt->input_node, wtt->input_objid,
qPrintableLatin1(wtt->cmd_entry->text())); qPrintableLatin1(wtt->cmd_entry->text()));
}
if (EVEN(sts)) { if (EVEN(sts)) {
wtt->message('E', wnav_get_message(sts)); wtt->message('E', wnav_get_message(sts));
} }
break; wtt->focused_wnav->set_inputfocus(1);
default:;
}
wtt->cmd_entry->setVisible(false);
} else if (wtt->command_open) { } else if (wtt->command_open) {
if (!wtt->focused_wnav) { if (!wtt->focused_wnav) {
wtt->set_focus_default(); wtt->set_focus_default();
...@@ -1381,8 +1377,6 @@ void WttQtWidget::valchanged_cmd_entry() ...@@ -1381,8 +1377,6 @@ void WttQtWidget::valchanged_cmd_entry()
wtt->set_clock_cursor(); wtt->set_clock_cursor();
wtt->focused_wnav->command(qPrintableLatin1(wtt->cmd_entry->text())); wtt->focused_wnav->command(qPrintableLatin1(wtt->cmd_entry->text()));
wtt->reset_cursor(); wtt->reset_cursor();
wtt->cmd_entry->setVisible(false);
wtt->set_prompt("");
wtt->command_open = 0; wtt->command_open = 0;
wtt->focused_wnav->set_inputfocus(1); wtt->focused_wnav->set_inputfocus(1);
} }
...@@ -1402,9 +1396,9 @@ void WttQtWidget::focusInEvent(QFocusEvent* event) ...@@ -1402,9 +1396,9 @@ void WttQtWidget::focusInEvent(QFocusEvent* event)
void WttQtWidget::hide_cmd_entry() void WttQtWidget::hide_cmd_entry()
{ {
wtt->set_prompt("");
if (wtt->input_open) { if (wtt->input_open) {
wtt->input_wnav->select_object(wtt->input_node); wtt->input_wnav->select_object(wtt->input_node);
wtt->set_prompt("");
wtt->input_open = 0; wtt->input_open = 0;
} }
} }
......
...@@ -655,6 +655,7 @@ void CoWowEntryQt::keyPressEvent(QKeyEvent* event) ...@@ -655,6 +655,7 @@ void CoWowEntryQt::keyPressEvent(QKeyEvent* event)
} }
case Qt::Key_Escape: case Qt::Key_Escape:
if (m_hide_on_esc) { if (m_hide_on_esc) {
clearFocus();
hide(); hide();
} }
m_re->resetTmp(); m_re->resetTmp();
...@@ -663,6 +664,10 @@ void CoWowEntryQt::keyPressEvent(QKeyEvent* event) ...@@ -663,6 +664,10 @@ void CoWowEntryQt::keyPressEvent(QKeyEvent* event)
break; break;
} }
QLineEdit::keyPressEvent(event); QLineEdit::keyPressEvent(event);
if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) {
clearFocus();
hide();
}
} }
// //
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment