Element info query : fix wrong behavior

This commit is contained in:
Claveau Joshua
2020-04-18 18:11:56 +02:00
parent f3c4d94822
commit 8cd9b3ba6e

View File

@@ -156,11 +156,33 @@ QString ElementQueryWidget::queryStr() const
if (ui->m_all_cb->checkState() == Qt::PartiallyChecked) if (ui->m_all_cb->checkState() == Qt::PartiallyChecked)
{ {
if (ui->m_terminal_cb->isChecked()) {where += " AND e.type = 'Terminale'";} bool b = false;
if (ui->m_simple_cb->isChecked()) {where += " AND e.type = 'Simple'";} where += " AND (";
if (ui->m_button_cb->isChecked()) {where += " AND e.sub_type = 'commutator'";} if (ui->m_terminal_cb->isChecked()) {
if (ui->m_coil_cb->isChecked()) {where += " AND e.sub_type = 'coil'";} if (b) where +=" OR";
if (ui->m_protection_cb->isChecked()) {where += " AND e.sub_type = 'protection'";} where += " e.type = 'Terminale'";
b = true;
}
if (ui->m_simple_cb->isChecked()) {
if (b) where +=" OR";
where += " e.type = 'Simple'";
b = true;
}
if (ui->m_button_cb->isChecked()) {
if (b) where +=" OR";
where += " e.sub_type = 'commutator'";
b = true;
}
if (ui->m_coil_cb->isChecked()) {
if (b) where +=" OR";
where += " e.sub_type = 'coil'";
b = true;
}
if (ui->m_protection_cb->isChecked()) {
if (b) where +=" OR";
where += " e.sub_type = 'protection'";
}
where += ")";
} }