mirror of
https://gitlab.com/eql/EQL5.git
synced 2025-12-13 05:40:25 -08:00
review "qml-lisp"
This commit is contained in:
parent
03c7a5ded5
commit
140e793040
6 changed files with 77 additions and 29 deletions
|
|
@ -0,0 +1,48 @@
|
|||
#include "qml_lisp.h"
|
||||
#include <eql_fun.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static Lisp* lisp = 0;
|
||||
|
||||
static QObject* lisp_provider(QQmlEngine*, QJSEngine*) { return lisp; }
|
||||
|
||||
QObject* ini() {
|
||||
if(!lisp) {
|
||||
lisp = new Lisp;
|
||||
qmlRegisterSingletonType<Lisp>("EQL5", 1, 0, "Lisp", lisp_provider); }
|
||||
return lisp; }
|
||||
|
||||
QString Lisp::fun(const QString& function,
|
||||
const QVariant& argument1, const QVariant& argument2, const QVariant& argument3,
|
||||
const QVariant& argument4, const QVariant& argument5, const QVariant& argument6,
|
||||
const QVariant& argument7, const QVariant& argument8, const QVariant& argument9) {
|
||||
QVariantList arguments;
|
||||
if(!argument1.isNull()) {
|
||||
arguments << argument1;
|
||||
if(!argument2.isNull()) {
|
||||
arguments << argument2;
|
||||
if(!argument3.isNull()) {
|
||||
arguments << argument3;
|
||||
if(!argument4.isNull()) {
|
||||
arguments << argument4;
|
||||
if(!argument5.isNull()) {
|
||||
arguments << argument5;
|
||||
if(!argument6.isNull()) {
|
||||
arguments << argument6;
|
||||
if(!argument7.isNull()) {
|
||||
arguments << argument7;
|
||||
if(!argument8.isNull()) {
|
||||
arguments << argument8;
|
||||
if(!argument9.isNull()) {
|
||||
arguments << argument9; }}}}}}}}}
|
||||
return apply(function, arguments); }
|
||||
|
||||
QString Lisp::apply(const QString& function, const QVariantList& arguments) {
|
||||
QVariant ret =
|
||||
eql_fun("eql::qml-apply", QVariant::String,
|
||||
Q_ARG(QString, function),
|
||||
Q_ARG(QVariantList, arguments));
|
||||
return ret.toString(); }
|
||||
|
||||
QT_END_NAMESPACE
|
||||
Loading…
Add table
Add a link
Reference in a new issue