Commit 03389a5d authored by Christoffer Ackelman's avatar Christoffer Ackelman

QT: Fix CoWowEntry not clearing focus on Escape/Enter.

parent 2f99dd88
...@@ -1351,36 +1351,28 @@ void WttQtWidget::activate_help_proview() ...@@ -1351,36 +1351,28 @@ 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;
default:; wtt->focused_wnav->set_inputfocus(1);
}
wtt->cmd_entry->setVisible(false);
} else if (wtt->command_open) { } else if (wtt->command_open) {
if (!wtt->focused_wnav) {
wtt->set_focus_default();
}
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);
} }
...@@ -1400,9 +1392,9 @@ void WttQtWidget::focusInEvent(QFocusEvent* event) ...@@ -1400,9 +1392,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;
} }
} }
......
...@@ -650,6 +650,7 @@ void CoWowEntryQt::keyPressEvent(QKeyEvent* event) ...@@ -650,6 +650,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();
...@@ -658,6 +659,10 @@ void CoWowEntryQt::keyPressEvent(QKeyEvent* event) ...@@ -658,6 +659,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