forked from qt-creator/qt-creator
Utils: Rework aspect implementation
This avoids some repetition and could be a step towards having type storage in (or rather accessible from) the base, so we can have aspects for more complex data (treemodels...) that are not easily converted to QVariant. Change-Id: I9797b3d5646195705212db1830d2b415291ac651 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -470,29 +470,22 @@ void SourcePathMapAspect::addToLayout(Layouting::LayoutItem &parent)
|
||||
parent.addItem(d->m_widget.data());
|
||||
}
|
||||
|
||||
QVariant SourcePathMapAspect::volatileValue() const
|
||||
void SourcePathMapAspect::guiToInternal()
|
||||
{
|
||||
QTC_CHECK(!isAutoApply());
|
||||
QTC_ASSERT(d->m_widget, return {});
|
||||
return QVariant::fromValue(d->m_widget->sourcePathMap());
|
||||
if (d->m_widget)
|
||||
m_internal = d->m_widget->sourcePathMap();
|
||||
}
|
||||
|
||||
void SourcePathMapAspect::setVolatileValue(const QVariant &val)
|
||||
void SourcePathMapAspect::internalToGui()
|
||||
{
|
||||
QTC_CHECK(!isAutoApply());
|
||||
if (d->m_widget)
|
||||
d->m_widget->setSourcePathMap(val.value<SourcePathMap>());
|
||||
d->m_widget->setSourcePathMap(m_internal);
|
||||
}
|
||||
|
||||
const char sourcePathMappingArrayNameC[] = "SourcePathMappings";
|
||||
const char sourcePathMappingSourceKeyC[] = "Source";
|
||||
const char sourcePathMappingTargetKeyC[] = "Target";
|
||||
|
||||
SourcePathMap SourcePathMapAspect::value() const
|
||||
{
|
||||
return BaseAspect::value().value<SourcePathMap>();
|
||||
}
|
||||
|
||||
void SourcePathMapAspect::writeSettings(QSettings *s) const
|
||||
{
|
||||
const SourcePathMap sourcePathMap = value();
|
||||
@@ -528,7 +521,7 @@ void SourcePathMapAspect::readSettings(const QSettings *settings)
|
||||
}
|
||||
}
|
||||
s->endArray();
|
||||
setValue(QVariant::fromValue(sourcePathMap));
|
||||
setValue(sourcePathMap);
|
||||
}
|
||||
|
||||
} // Debugger::Internal
|
||||
|
||||
Reference in New Issue
Block a user