From 24ebb809c6a700115f18ed4e3c1b468f98d8314a Mon Sep 17 00:00:00 2001 From: "pls.153" Date: Fri, 27 Oct 2023 13:46:06 +0200 Subject: [PATCH] add macro QLATER-SEQUENCE; revisions --- doc/help.htm | 12 +++++++++++- src/cpp/main.cpp | 2 +- src/lisp/ini.lisp | 17 ++++++++++++++++- src/lisp/package.lisp | 1 + src/lisp/qml.lisp | 2 +- 5 files changed, 30 insertions(+), 4 deletions(-) diff --git a/doc/help.htm b/doc/help.htm index 4b41a97..28513a7 100644 --- a/doc/help.htm +++ b/doc/help.htm @@ -191,7 +191,7 @@ glue code function) which expects a JS dictionary, see example below. N.B: Does not work with JS default arguments. - (qjs |drawLine| *canvas* x1 y1 x2 y2)) + (qjs |drawLine| *canvas* (float x1) (float y1) (float x2) (float y2)) (qjs |addPlanet| *planets* (list :name "Jupiter" :src "img/jupiter.png")) @@ -200,6 +200,16 @@ Calls FUNCTION as soon as the Qt event loop is idle. +qlater-sequence (&rest forms) + + Example: (qlater-sequence (foo) (bar)) expands to: + + (qlater (lambda () + (foo) + (qlater (lambda () + (bar))))) + + qload-c++ (library-name &optional unload) Loads a custom Qt/C++ plugin (see 'cpp-lib' in sources). The LIBRARY-NAME diff --git a/src/cpp/main.cpp b/src/cpp/main.cpp index fe20e71..75642f6 100644 --- a/src/cpp/main.cpp +++ b/src/cpp/main.cpp @@ -70,7 +70,7 @@ int main(int argc, char* argv[]) { qputenv("QT_QPA_NO_TEXT_HANDLES", "1"); #endif if (QFile::exists("/etc/sailfish-release")) { // SFOS - QQuickStyle::setStyle("Basic"); + QQuickStyle::setStyle("Basic"); // independent from 'qt-runner' } #ifdef INI_WEBVIEW QtWebView::initialize(); diff --git a/src/lisp/ini.lisp b/src/lisp/ini.lisp index aec7680..ab823ad 100644 --- a/src/lisp/ini.lisp +++ b/src/lisp/ini.lisp @@ -24,7 +24,8 @@ (setf start (length q)) (return))) start) - (or (search "Item" name) + (or (and (not (search "QuickItem" name)) + (search "Item" name)) (position #\_ name)))))) (defmethod print-object ((object qt-object) s) @@ -101,6 +102,20 @@ Calls FUNCTION as soon as the Qt event loop is idle." `(qsingle-shot 0 ,function)) +(defmacro qlater-sequence (&rest forms) + "args: (&rest forms) + Example: (qlater-sequence (foo) (bar)) expands to: + (qlater (lambda () + (foo) + (qlater (lambda () + (bar)))))" + (labels ((later (forms) + (when forms + `(qlater (lambda () + ,(first forms) + ,(later (rest forms))))))) + (later forms))) + (defun %make-byte-vector (list) ;; for internal use (called from marshal.cpp') (make-array (length list) :element-type '(unsigned-byte 8) :initial-contents list)) diff --git a/src/lisp/package.lisp b/src/lisp/package.lisp index c19d494..00f0503 100644 --- a/src/lisp/package.lisp +++ b/src/lisp/package.lisp @@ -40,6 +40,7 @@ #:qget #:qset #:qlater + #:qlater-sequence #:qload-c++ #:qload-rc #:qlog diff --git a/src/lisp/qml.lisp b/src/lisp/qml.lisp index c7ae5ce..c3f6f30 100644 --- a/src/lisp/qml.lisp +++ b/src/lisp/qml.lisp @@ -205,7 +205,7 @@ A special use case is to populate an item model in QML (using a trivial JS glue code function) which expects a JS dictionary, see example below. N.B: Does not work with JS default arguments. - (qjs |drawLine| *canvas* x1 y1 x2 y2)) + (qjs |drawLine| *canvas* (float x1) (float y1) (float x2) (float y2)) (qjs |addPlanet| *planets* (list :name \"Jupiter\" :src \"img/jupiter.png\"))" `(qrun* (qfun (quick-item ,item/name) ,(if (symbolp function)