add convenience function EQL::addObject() for adding Qt class instances as Lisp variables

This commit is contained in:
polos 2021-05-09 17:31:43 +02:00
parent 53c6a9e246
commit 2156ea501f
5 changed files with 23 additions and 16 deletions

View file

@ -11,13 +11,13 @@ int main(int argc, char* argv[]) {
main->resize(600, 400);
main->show();
// we need an instance for 'define-qt-wrappers' and 'new-instance' to work;
// we pass the main widget as parent and a unique 'objectName', so we can
// find it from Lisp
Test test(main, "test");
EQL eql;
// add desired Qt class instances as Lisp variables (uses 'defvar'):
EQL::addObject(main, "eql-user:*main-widget*");
EQL::addObject(new Test(main), "eql-user:*test*");
EQL::eval("(in-package :eql-user)");
EQL::eval("(load \"test.lisp\")"); // will start a REPL
app.processEvents(); // needed for 'qlater' in 'test.lisp'