small revisions

This commit is contained in:
polos 2017-05-10 22:02:00 +02:00
parent 754cc8ee39
commit 9367214ca3
4 changed files with 15 additions and 15 deletions

View file

@ -224,7 +224,7 @@ N.B. skip this if you already built from 'eql5.pro' (see above)
qmake module_<name>.pro (e.g. qmake module_network.pro)
make
sudo make install (unix only)
sudo make install (Unix only)
[Linux,OSX]
(N.B. skip this if you did "sudo make install")

View file

@ -305,9 +305,9 @@ Convenience macro: a <code>qsingle-shot</code> with a <code>0</code> timeout.<br
(qlater 'delayed-ini)
</pre>
<br><br>
<b>QLET (((variable-1 expression-1) (variable-2 expression-2)) &body body)</b>
<b>QLET (((variable-1 expression-1) (variable-2 expression-2) ...) &body body)</b>
<br><br>
Similar to <code>let*</code> (and to local C++ variables).<br><br>Creates temporary Qt objects, deleting them at the end of the <code>qlet</code> body.<br>If <code>expression</code> is a string, it will be substituted with <code>(qnew expression)</code>, optionally including constructor arguments.
Similar to <code>let*</code> (and to local C++ variables).<br><br>Creates temporary Qt objects, deleting them at the end of the <code>qlet</code> body.<br>If <code>expression</code> is a string, it will be substituted with <code>(qnew expression)</code>, optionally including constructor arguments.<br><br>This macro is convenient for e.g. local <code>QPainter</code> objects, in order to guarantee C++ destructors being called after leaving a local scope.
<br>
<pre>
(qlet ((painter "QPainter"))

View file

@ -22,26 +22,26 @@
(|runJavaScript| (|page| *view*) expression
(lambda (result) (qmsg result))))
;; Introducing macro SYNCALL allows to call asynchronous functions
;; Introducing macro SYN-CALL allows to call asynchronous functions
;; as if they were synchronous (more convenient in simple cases).
(defmacro syncall (expression)
(defmacro syn-call (expression)
"Converts asynchronous function calls to synchronous ones, using a local event loop."
(let ((result (gensym))
(ev-loop (gensym)))
`(let (,result)
(qlet ((,ev-loop "QEventLoop"))
(,@expression (lambda (x)
(setf ,result x)
(|exit| ,ev-loop)))
(|exec| ,ev-loop))
,result)))
(qlet ((,ev-loop "QEventLoop"))
(,@expression (lambda (x)
(setf ,result x)
(|exit| ,ev-loop)))
(|exec| ,ev-loop))
,result)))
(defun to-text* ()
(print (syncall (|toPlainText| (|page| *view*)))))
(print (syn-call (|toPlainText| (|page| *view*)))))
(defun js* (expression)
(qmsg (syncall (|runJavaScript| (|page| *view*) expression))))
(qmsg (syn-call (|runJavaScript| (|page| *view*) expression))))
(x:do-with *view*
(|setUrl| (qnew "QUrl(QString)" "http://planet.lisp.org/"))

View file

@ -13,8 +13,8 @@
`(setf (symbol-function ',s1) (function ,s2)))
(defmacro qlet ((&rest pairs) &body body)
"args: (((variable-1 expression-1) (variable-2 expression-2)) &body body)
Similar to <code>let*</code> (and to local C++ variables).<br><br>Creates temporary Qt objects, deleting them at the end of the <code>qlet</code> body.<br>If <code>expression</code> is a string, it will be substituted with <code>(qnew expression)</code>, optionally including constructor arguments.
"args: (((variable-1 expression-1) (variable-2 expression-2) ...) &body body)
Similar to <code>let*</code> (and to local C++ variables).<br><br>Creates temporary Qt objects, deleting them at the end of the <code>qlet</code> body.<br>If <code>expression</code> is a string, it will be substituted with <code>(qnew expression)</code>, optionally including constructor arguments.<br><br>This macro is convenient for e.g. local <code>QPainter</code> objects, in order to guarantee C++ destructors being called after leaving a local scope.
(qlet ((painter \"QPainter\"))
&nbsp;&nbsp;...)