Mercurial > octave
changeset 27658:2c3da07a1aaf
simplify Copy shortcut == Ctrl-C detection in QTerminal
* QTerminal.cc (QTerminal::notice_settings): Simplify logic by
converting shortcut setting directly to QKeySequence. Don't assume
that a QKeySequence can be converted to a string and then back to a
QKeySequence. Use default value in call to settings->value.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 08 Nov 2019 10:25:39 -0500 |
parents | 4fb72773ba4a |
children | d4f1abfaf3a5 |
files | libgui/qterminal/libqterminal/QTerminal.cc |
diffstat | 1 files changed, 5 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/qterminal/libqterminal/QTerminal.cc Fri Nov 08 08:59:46 2019 -0500 +++ b/libgui/qterminal/libqterminal/QTerminal.cc Fri Nov 08 10:25:39 2019 -0500 @@ -267,16 +267,14 @@ setScrollBufferSize (settings->value (cs_hist_buffer.key, cs_hist_buffer.def).toInt ()); - // check whether Copy shortcut is Ctrl-C - QKeySequence sc; - sc = QKeySequence (settings->value (sc_main_edit_copy.key).toString ()); + // If the Copy shortcut is Ctrl-C, then set up to allow Ctrl-C to also + // be processed as the interrupt character in the command window. - // if sc is empty, shortcuts are not yet in the settings (take the default) - if (sc.isEmpty ()) // QKeySequence::Copy as second argument in - sc = QKeySequence::Copy; // settings->value () does not work! + QVariant tmp = settings->value (sc_main_edit_copy.key, sc_main_edit_copy.def); + QKeySequence sc = tmp.value<QKeySequence> (); // dis- or enable extra interrupt action - bool extra_ir_action = (sc != QKeySequence (Qt::ControlModifier | Qt::Key_C)); + bool extra_ir_action = (sc == QKeySequence (Qt::ControlModifier | Qt::Key_C)); _interrupt_action->setEnabled (extra_ir_action); has_extra_interrupt (extra_ir_action);