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:
hjk
2023-06-26 11:02:42 +02:00
parent 900ea82fd1
commit 379e7f906e
30 changed files with 463 additions and 643 deletions

View File

@@ -28,30 +28,6 @@ using namespace Utils;
namespace FakeVim::Internal {
#ifdef FAKEVIM_STANDALONE
FvBaseAspect::FvBaseAspect()
{
}
void FvBaseAspect::setValue(const QVariant &value)
{
m_value = value;
}
QVariant FvBaseAspect::value() const
{
return m_value;
}
void FvBaseAspect::setDefaultValue(const QVariant &value)
{
m_defaultValue = value;
m_value = value;
}
QVariant FvBaseAspect::defaultValue() const
{
return m_defaultValue;
}
void FvBaseAspect::setSettingsKey(const QString &group, const QString &key)
{
@@ -294,7 +270,7 @@ QString FakeVimSettings::trySetValue(const QString &name, const QString &value)
return Tr::tr("Argument must be positive: %1=%2")
.arg(name).arg(value);
}
aspect->setValue(value);
aspect->setVariantValue(value);
return QString();
}
@@ -305,7 +281,7 @@ void FakeVimSettings::setup(FvBaseAspect *aspect,
const QString &labelText)
{
aspect->setSettingsKey("FakeVim", settingsKey);
aspect->setDefaultValue(value);
aspect->setDefaultVariantValue(value);
#ifndef FAKEVIM_STANDALONE
aspect->setLabelText(labelText);
aspect->setAutoApply(false);