forked from qt-creator/qt-creator
Utils: Only set SelectionAspect value automatically if requested
This is in line with what the other aspects do. Without this, non-auto-apply aspects behave as auto-apply, even if marked with setAutoApply(false). Change-Id: I39192f63bb3b6e47ee181527938c19ee5044a5ec Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -1391,18 +1391,22 @@ void SelectionAspect::addToLayout(LayoutBuilder &builder)
|
|||||||
builder.addItems({{}, button});
|
builder.addItems({{}, button});
|
||||||
d->m_buttons.append(button);
|
d->m_buttons.append(button);
|
||||||
d->m_buttonGroup->addButton(button, i);
|
d->m_buttonGroup->addButton(button, i);
|
||||||
|
if (isAutoApply()) {
|
||||||
connect(button, &QAbstractButton::clicked, this, [this, i] {
|
connect(button, &QAbstractButton::clicked, this, [this, i] {
|
||||||
setValue(i);
|
setValue(i);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case DisplayStyle::ComboBox:
|
case DisplayStyle::ComboBox:
|
||||||
setLabelText(displayName());
|
setLabelText(displayName());
|
||||||
d->m_comboBox = createSubWidget<QComboBox>();
|
d->m_comboBox = createSubWidget<QComboBox>();
|
||||||
for (int i = 0, n = d->m_options.size(); i < n; ++i)
|
for (int i = 0, n = d->m_options.size(); i < n; ++i)
|
||||||
d->m_comboBox->addItem(d->m_options.at(i).displayName);
|
d->m_comboBox->addItem(d->m_options.at(i).displayName);
|
||||||
|
if (isAutoApply()) {
|
||||||
connect(d->m_comboBox.data(), QOverload<int>::of(&QComboBox::activated),
|
connect(d->m_comboBox.data(), QOverload<int>::of(&QComboBox::activated),
|
||||||
this, &SelectionAspect::setValue);
|
this, &SelectionAspect::setValue);
|
||||||
|
}
|
||||||
d->m_comboBox->setCurrentIndex(value());
|
d->m_comboBox->setCurrentIndex(value());
|
||||||
addLabeledItem(builder, d->m_comboBox);
|
addLabeledItem(builder, d->m_comboBox);
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user