From 37ba7aa2ca5c9c869c5338862927dc337a1fa0bd Mon Sep 17 00:00:00 2001 From: WarmUpTill Date: Sun, 8 Oct 2023 14:32:17 +0200 Subject: [PATCH] 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. --- src/macro-core/macro-action-variable.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/macro-core/macro-action-variable.cpp b/src/macro-core/macro-action-variable.cpp index 17f6daae..1615b3e5 100644 --- a/src/macro-core/macro-action-variable.cpp +++ b/src/macro-core/macro-action-variable.cpp @@ -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();