Utils: Introduce a staging area for gui values

Accessing gui elements is very aspect-specific, whereas the
rules when and how values are synchronized are rather general.

Splitting the two concepts and having a permanent 'buffer' area
that is synchronized with the gui elements if and only if they
have been created helps to keep the boilerplate needed per-aspect
at a minimum.

This value could also serve as "model" in case we wanted to allow
multiple "views" in different places of the gui onto that aspect.

Change-Id: I34832512b99c53cb0e4df437ee9b4c5d17a2ad8f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2023-07-12 15:41:06 +02:00
parent 433f8a3241
commit 4ab1d75ee6
6 changed files with 211 additions and 213 deletions

View File

@@ -470,16 +470,16 @@ void SourcePathMapAspect::addToLayout(Layouting::LayoutItem &parent)
parent.addItem(d->m_widget.data());
}
void SourcePathMapAspect::guiToInternal()
void SourcePathMapAspect::guiToBuffer()
{
if (d->m_widget)
m_internal = d->m_widget->sourcePathMap();
m_buffer = d->m_widget->sourcePathMap();
}
void SourcePathMapAspect::internalToGui()
void SourcePathMapAspect::bufferToGui()
{
if (d->m_widget)
d->m_widget->setSourcePathMap(m_internal);
d->m_widget->setSourcePathMap(m_buffer);
}
const char sourcePathMappingArrayNameC[] = "SourcePathMappings";