mirror of
https://gitlab.com/eql/EQL5.git
synced 2025-12-19 00:30:24 -08:00
"quick": add example "painted-item"; small revisions;
This commit is contained in:
parent
fcbf75464c
commit
0ff3dee53c
20 changed files with 350 additions and 15 deletions
28
examples/M-modules/quick/painted-item/lib/qml_lisp.cpp
Normal file
28
examples/M-modules/quick/painted-item/lib/qml_lisp.cpp
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#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, "EQL5", lisp_provider);
|
||||
qmlRegisterType<PaintedItem>("EQL5", 1, 0, "PaintedItem"); }
|
||||
return lisp; }
|
||||
|
||||
QVariant Lisp::apply(QObject* caller, const QString& function, const QVariantList& arguments) {
|
||||
return eql_fun("qml:qml-apply", QVariant::String,
|
||||
Q_ARG(QObject*, caller),
|
||||
Q_ARG(QString, function),
|
||||
Q_ARG(QVariantList, arguments)); }
|
||||
|
||||
void PaintedItem::paint(QPainter* painter) {
|
||||
eql_fun("qml:paint",
|
||||
Q_ARG(QQuickPaintedItem*, this),
|
||||
Q_ARG(QPainter*, painter)); }
|
||||
|
||||
QT_END_NAMESPACE
|
||||
Loading…
Add table
Add a link
Reference in a new issue