From d902f5d53d62dc848ef36f8e901af8c0195c59e5 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 8 Sep 2024 18:48:12 +0200 Subject: [PATCH] Apply property changes before switching tree node in properties editor --- src/layui/layui/layPropertiesDialog.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/layui/layui/layPropertiesDialog.cc b/src/layui/layui/layPropertiesDialog.cc index 6ecffff16..573d8c23d 100644 --- a/src/layui/layui/layPropertiesDialog.cc +++ b/src/layui/layui/layPropertiesDialog.cc @@ -308,6 +308,25 @@ PropertiesDialog::current_index_changed (const QModelIndex &index, const QModelI } else { + if (m_index >= 0 && m_index < int (mp_properties_pages.size ()) && ! mp_properties_pages [m_index]->readonly ()) { + + try { + + db::Transaction t (mp_manager, tl::to_string (QObject::tr ("Apply changes")), m_transaction_id); + + mp_properties_pages [m_index]->apply (); + + if (! t.is_empty ()) { + m_transaction_id = t.id (); + } + + } catch (...) { + } + + mp_properties_pages [m_index]->update (); + + } + if (mp_tree_model->parent (index).isValid ()) { m_index = mp_tree_model->page_index (index);