forked from qt-creator/qt-creator
Lua: Add AspectContainer::onApplied
Change-Id: I2f53479b2b81b86fb90778dd495d8733bde2118e Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -67,10 +67,20 @@ std::unique_ptr<LuaAspectContainer> aspectContainerCreate(const sol::table &opti
|
||||
QTC_ASSERT_EXPECTED(res, return {});
|
||||
return *res;
|
||||
});
|
||||
} else if (key == "onApplied") {
|
||||
QObject::connect(
|
||||
container.get(),
|
||||
&AspectContainer::applied,
|
||||
container.get(),
|
||||
[func = v.as<sol::function>()]() { Lua::LuaEngine::void_safe_call(func); });
|
||||
} else if (key == "settingsGroup") {
|
||||
container->setSettingsGroup(v.as<QString>());
|
||||
} else {
|
||||
container->m_entries[key] = v;
|
||||
if (v.is<BaseAspect>()) {
|
||||
container->registerAspect(v.as<BaseAspect *>());
|
||||
} else {
|
||||
qWarning() << "Unknown key:" << key.c_str();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -41,9 +41,11 @@ settings.AspectContainer = {}
|
||||
---Options for creating an AspectContainer.
|
||||
---@class AspectContainerCreate
|
||||
---@field autoApply? boolean Whether the aspects should be applied automatically or not.
|
||||
---@field onApplied? function Called when the aspects are applied.
|
||||
---@field layouter? function The layouter of the aspect container.
|
||||
---@field settingsGroup? string The settings group of the aspect container.
|
||||
AspectContainerCreate = {}
|
||||
|
||||
|
||||
---Create a new AspectContainer.
|
||||
---@param options AspectContainerCreate
|
||||
---@return AspectContainer
|
||||
|
Reference in New Issue
Block a user