JSON wizards: Fix "span" with combo boxes

Combo boxes have "suppressName" set, but if they have span set too, we
still need to use addRow instead of addWidget.

Reorder the if conditions. The previous code didn't make much sense,
because it first checked for suppressName, and then for hasSpan, but
inside hasSpan it checked for (!suppressName) again, which could never
be false.

You can see this in action in the File > Qt > JS File wizard.

Change-Id: I976227f80277642823620e41aba605c8570aed44
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Eike Ziller
2023-01-02 16:14:09 +01:00
parent e79a0ab49b
commit cead76f378

View File

@@ -210,15 +210,15 @@ void JsonFieldPage::Field::createWidget(JsonFieldPage *page)
w->setObjectName(name()); w->setObjectName(name());
QFormLayout *layout = page->layout(); QFormLayout *layout = page->layout();
if (suppressName()) { if (hasSpan()) {
layout->addWidget(w);
} else if (hasSpan()) {
if (!suppressName()) { if (!suppressName()) {
d->m_label = new QLabel(displayName()); d->m_label = new QLabel(displayName());
layout->addRow(d->m_label); layout->addRow(d->m_label);
} }
layout->addRow(w); layout->addRow(w);
} else if (suppressName()) {
layout->addWidget(w);
} else { } else {
d->m_label = new QLabel(displayName()); d->m_label = new QLabel(displayName());
layout->addRow(d->m_label, w); layout->addRow(d->m_label, w);