mirror of
https://gitlab.com/eql/lqml.git
synced 2025-12-15 14:51:14 -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
39
cpp-lib/readme.md
Normal file
39
cpp-lib/readme.md
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
|
||||
Build
|
||||
-----
|
||||
|
||||
Switch to `cpp/` and do:
|
||||
```
|
||||
qmake lib.pro
|
||||
make
|
||||
```
|
||||
|
||||
|
||||
Run
|
||||
---
|
||||
|
||||
```
|
||||
$ lqml ~/slime/qml-start-swank.lisp
|
||||
$ emacs
|
||||
```
|
||||
|
||||
In Slime do:
|
||||
```
|
||||
(defvar *cpp* (qload-c++ "cpp"))
|
||||
|
||||
(define-qt-wrappers *cpp*)
|
||||
|
||||
(hello *cpp* '(1 "two" (1.25 #(50 -50 75))))
|
||||
```
|
||||
Now look at the console output where you launched the `lqml` executable.
|
||||
|
||||
As you can see, although the argument and return type are simply defined as
|
||||
`QVariant`, you may also pass lists, because a `QVariant` can also be of type
|
||||
`QVariantList`, so this is a perfect fit for (nested) Lisp lists.
|
||||
|
||||
So, we pass a nested Lisp list, and it gets printed on Qt side with the
|
||||
respective types. Then the `QVariantList` is returend to Lisp, where it is
|
||||
automatically converted back to a nested Lisp list.
|
||||
|
||||
Realy convenient!
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue