mirror of
https://gitlab.com/eql/lqml.git
synced 2026-01-25 05:50:47 -08:00
add cpp-lib example; some fixes
This commit is contained in:
parent
7a4bff3c20
commit
eb54b6fd41
12 changed files with 144 additions and 11 deletions
|
|
@ -250,7 +250,8 @@ cl_object qload_cpp(cl_object l_lib_name, cl_object l_unload) { /// qload-c++
|
|||
if (ini) {
|
||||
QObject* main = ini();
|
||||
if (main) {
|
||||
ecl_return1(ecl_process_env(), ECL_T);
|
||||
cl_object l_ret = from_qobject_pointer(main);
|
||||
ecl_return1(ecl_process_env(), l_ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -391,8 +392,9 @@ cl_object qlog2(cl_object l_msg) {
|
|||
cl_object qinvoke_method2(cl_object l_obj, cl_object l_name, cl_object l_args) {
|
||||
// for internal use: this is used to call user defined JS functions, and to
|
||||
// call user defined Qt/C++ plugin functions.
|
||||
// Max. 10 arguments of type T, NIL, INTEGER, FLOAT, STRING, (nested) LIST of
|
||||
// mentioned arguments. On Qt side, only QVariant arguments are allowed.
|
||||
// Max. 10 arguments of type T, NIL, INTEGER, FLOAT, STRING, VECTOR of
|
||||
// octets, (nested) LIST of mentioned arguments. On Qt side, only QVariant
|
||||
// arguments are allowed.
|
||||
// N.B. does not support default arguments, if used to call JS functions
|
||||
ecl_process_env()->nvalues = 1;
|
||||
const int MAX = 10;
|
||||
|
|
|
|||
|
|
@ -132,9 +132,10 @@ TO_QT_FLOAT_4 (QRectF)
|
|||
QVariant toQVariant(cl_object l_arg, int type) {
|
||||
QVariant var;
|
||||
switch (type) {
|
||||
case QMetaType::QPointF: var = toQPointF(l_arg); break;
|
||||
case QMetaType::QRectF: var = toQRectF(l_arg); break;
|
||||
case QMetaType::QSizeF: var = toQSizeF(l_arg); break;
|
||||
case QMetaType::QByteArray: var = toQByteArray(l_arg); break;
|
||||
case QMetaType::QPointF: var = toQPointF(l_arg); break;
|
||||
case QMetaType::QRectF: var = toQRectF(l_arg); break;
|
||||
case QMetaType::QSizeF: var = toQSizeF(l_arg); break;
|
||||
default:
|
||||
if (cl_integerp(l_arg) == ECL_T) { // int
|
||||
var = QVariant(toInt(l_arg));
|
||||
|
|
@ -154,6 +155,9 @@ QVariant toQVariant(cl_object l_arg, int type) {
|
|||
else if (cl_listp(l_arg) == ECL_T) { // list
|
||||
var = QVariant::fromValue(toQVariantList(l_arg));
|
||||
}
|
||||
else if (cl_vectorp(l_arg) == ECL_T) { // vector (of octets)
|
||||
var = QVariant(toQByteArray(l_arg));
|
||||
}
|
||||
else { // default: undefined
|
||||
var = QVariant();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue