From ed9632f220c434e5bdc9d2d7ec2ab4619cb91802 Mon Sep 17 00:00:00 2001 From: in1tiate <32779090+in1tiate@users.noreply.github.com> Date: Sat, 11 Apr 2020 20:04:41 -0500 Subject: [PATCH] fix dropdown bug, add minor feature --- src/courtroom.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index e3e8450..f083c51 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -991,6 +991,12 @@ void Courtroom::enter_courtroom(int p_cid) QString side = ao_app->get_char_side(current_char); + // We block signals from ui_pos_dropdown to stop on_pos_dropdown_changed from firing here. + // Per the Qt docs, QSignalBlocker only affects the rest of this function, + // so it doesn't stop the dropdown from working once we finish here. + const QSignalBlocker blocker(ui_pos_dropdown); + ui_pos_dropdown->setCurrentText(side); + if (side == "jud") { ui_witness_testimony->show(); @@ -3436,7 +3442,7 @@ void Courtroom::on_pos_dropdown_changed(int p_index) { ui_ic_chat_message->setFocus(); - if (p_index < 0 || p_index > 5) + if (p_index < 0 || p_index > 7) return; toggle_judge_buttons(false); @@ -3464,6 +3470,12 @@ void Courtroom::on_pos_dropdown_changed(int p_index) case 5: f_pos = "hlp"; break; + case 6: + f_pos = "jur"; + break; + case 7: + f_pos = "sea"; + break; default: f_pos = ""; }