mirror of
https://gitlab.com/eql/EQL5.git
synced 2025-12-15 06:41:01 -08:00
add tutorial in 'Qt_EQL/' for accessing C++ apps from Lisp
This commit is contained in:
parent
490c878dee
commit
28d5d133fb
6 changed files with 174 additions and 0 deletions
27
Qt_EQL/tutorial/main.cpp
Normal file
27
Qt_EQL/tutorial/main.cpp
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#include "test.h"
|
||||
#include <eql5/eql.h>
|
||||
#include <QApplication>
|
||||
#include <QLabel>
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
QApplication app(argc, argv);
|
||||
|
||||
QLabel* main = new QLabel("<h2>Main Window</h2>");
|
||||
main->setAlignment(Qt::AlignCenter);
|
||||
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;
|
||||
EQL::eval("(in-package :eql-user)");
|
||||
EQL::eval("(load \"test.lisp\")"); // will start a REPL
|
||||
app.processEvents(); // needed for 'qlater' in 'test.lisp'
|
||||
|
||||
return 0; // no 'app.exec()' because of REPL
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue