Only change text of segment value preview if value changed

This is done to prevent the selection being lost whenever the text filed
was updated.
This commit is contained in:
WarmUpTill 2023-10-08 14:32:17 +02:00 committed by WarmUpTill
parent a83d2d9910
commit 37ba7aa2ca

View File

@ -750,8 +750,14 @@ void MacroActionVariableEdit::UpdateSegmentVariableValue()
_segmentValueStatus->setText(obs_module_text(
"AdvSceneSwitcher.action.variable.currentSegmentValue"));
_segmentValue->show();
_segmentValue->setPlainText(
QString::fromStdString(segment->GetVariableValue()));
// Only update the text if the value changed to prevent possible text
// selections being lost
auto previousText = _segmentValue->toPlainText();
auto newText = QString::fromStdString(segment->GetVariableValue());
if (newText != previousText) {
_segmentValue->setPlainText(newText);
}
adjustSize();
updateGeometry();