mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-28 04:54:13 +02:00
Conductor dock: sync to external property changes (#500)
The dock editor snapshotted the conductor once and never refreshed, so a change made via the modal Edit-conductor dialog left the dock holding stale values; on deselection apply() wrote that stale snapshot back, overwriting the dialog's change. Subscribe to Conductor::propertiesChange and refresh via updateUi() so the dock mirrors external edits and apply() becomes a no-op when nothing changed in the dock.
This commit is contained in:
@@ -100,7 +100,15 @@ ConductorPropertiesEditorWidget::~ConductorPropertiesEditorWidget()
|
||||
void ConductorPropertiesEditorWidget::setConductor(Conductor *conductor)
|
||||
{
|
||||
if (!conductor) return;
|
||||
if (m_conductor && m_conductor != conductor)
|
||||
disconnect(m_conductor, &Conductor::propertiesChange,
|
||||
this, &ConductorPropertiesEditorWidget::updateUi);
|
||||
m_conductor = conductor;
|
||||
//Keep the dock in sync when the conductor is edited elsewhere (e.g. the
|
||||
//modal "Edit conductor" dialog); otherwise a stale snapshot would be
|
||||
//written back on the next apply() and overwrite that change (issue #500).
|
||||
connect(m_conductor, &Conductor::propertiesChange,
|
||||
this, &ConductorPropertiesEditorWidget::updateUi, Qt::UniqueConnection);
|
||||
setEnabled(true);
|
||||
updateUi();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user