1 #include "ScriptSettings.hh" 3 #include <QScriptContext> 4 #include <QScriptEngine> 7 #include "Widgets/BooleanWidget.hh" 8 #include "Widgets/VectorWidget.hh" 9 #include "Widgets/DoubleWidget.hh" 11 #include "ScriptSettingsBoolean.hh" 12 #include "ScriptSettingsDouble.hh" 13 #include "ScriptSettingsVector.hh" 16 ScriptSettings::ScriptSettings(QWidget *widget)
19 connect(widget, &QWidget::destroyed,
20 this, &QObject::deleteLater);
24 QScriptValue createSettingsScriptObject(QScriptContext *ctx, QWidget *widget)
26 QScriptEngine *engine = ctx->engine();
28 if (
auto w = dynamic_cast<BooleanWidget*>(widget)) {
31 else if (
auto w = dynamic_cast<DoubleWidget*>(widget)) {
34 else if (
auto w = dynamic_cast<VectorWidget*>(widget)) {
39 return QScriptValue::SpecialValue::NullValue;
41 return engine->newQObject(obj,
42 QScriptEngine::QtOwnership,
43 QScriptEngine::ExcludeSuperClassMethods
44 | QScriptEngine::ExcludeSuperClassProperties
45 | QScriptEngine::ExcludeChildObjects