revert beta hacks (sorry); fix comment in 'qml.lisp'

This commit is contained in:
polos 2021-06-10 22:28:45 +02:00
parent c3d4050dc6
commit 1758101cf2
6 changed files with 10 additions and 17 deletions

View file

@ -23,9 +23,9 @@ int main(int argc, char* argv[]) {
EQL::addObject(new Test(main), "*test*", true); // 'define-qt-wrappers'
EQL::eval("(load \"test.lisp\")"); // will start a REPL
app.processEvents(); // needed for 'qlater' in 'test.lisp'
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
return 0; // no 'app.exec()' because of REPL
}

View file

@ -19,7 +19,7 @@ public Q_SLOTS:
// pointers, of course), as you'll find in any Qt example code
QString concat(const QStringList&);
// pass Lisp data ('cl_object' is just a word hosting e.g. a pointer)
// pass Lisp data ('cl_object' is just a pointer)
void processData(cl_object);
// call back to Lisp

View file

@ -126,8 +126,6 @@ void iniCLFunctions() {
cl_make_package(1, eql); }
si_select_package(eql);
DEFUN ("%error-msg", error_msg2, 2)
DEFUN ("%finalize", finalize2, 1)
DEFUN ("%finalize-and-delete", finalize_and_delete2, 1)
DEFUN ("%make-qimage/dangerous", make_qimage_dangerous, 5)
DEFUN ("no-qexec", no_qexec, 0)
DEFUN ("qadd-event-filter", qadd_event_filter, 3)
@ -697,9 +695,6 @@ QtObject toQtObject(cl_object l_obj, cl_object l_cast, bool* qobject_align, bool
static cl_object new_qt_object(void* pointer, uint unique, int id, bool finalize = false) {
STATIC_SYMBOL_PKG (s_new_qt_object, "NEW-QT-OBJECT", "EQL")
QPointer<QObject>* safePointer = 0;
if((id > 0) && pointer) { // QObject
safePointer = new QPointer<QObject>((QObject*)pointer); }
cl_object l_qt_object = cl_funcall(5,
s_new_qt_object,
ecl_make_unsigned_integer((quintptr)pointer),

View file

@ -242,8 +242,6 @@ class QObject;
class QEvent;
cl_object error_msg2 (cl_object, cl_object);
cl_object finalize2 (cl_object);
cl_object finalize_and_delete2 (cl_object);
cl_object make_qimage_dangerous (cl_object, cl_object, cl_object, cl_object, cl_object);
cl_object no_qexec ();
cl_object qadd_event_filter (cl_object, cl_object, cl_object);
@ -301,11 +299,10 @@ cl_object set_shutdown_p (cl_object);
struct EQL_EXPORT QtObject {
void* pointer;
QPointer<QObject>* safe_pointer;
uint unique;
int id;
QtObject() : pointer(nullptr), safe_pointer(nullptr), unique(0), id(0) {}
QtObject() : pointer(0), unique(0), id(0) {}
bool isQObject() const { return (id > 0); }
bool isStatic() const { return !pointer; }

View file

@ -391,7 +391,8 @@
(defun new-qt-object (pointer unique id finalize)
(let ((obj (qt-object pointer unique id finalize)))
(ext:set-finalizer obj (if finalize '%finalize-and-delete '%finalize))
(when finalize
(ext:set-finalizer obj 'qdelete))
obj))
(defmethod print-object ((object qt-object) s)

View file

@ -78,7 +78,7 @@
(|rootContext| *quick-view*)))
(defun find-quick-item (object-name)
"Finds the first QQuickItem matching OBJECT-NAME. You may set *ROOT-ITEM* if you want to find items inside a specific item, like in a QML Repeater. See also note in sources."
"Finds the first QQuickItem matching OBJECT-NAME. Locally set *ROOT-ITEM* if you want to find items inside a specific item, like in a QML Repeater. See also note in sources."
;;
;; when to use *ROOT-ITEM*
;;
@ -97,8 +97,8 @@
;; (q< |text| ui:*edit*)
;; (setf qml:*root-item* nil) ; (2) reset
;;
;; N.B. we need SETF here because of the global variable and threads (because
;; QRUN* is used internally here)
;; N.B. we need SETF (instead of LET) because of the global var and threads
;; (QRUN* is used internally here)
;;
(let ((parent (or *root-item* (root-item))))
(unless (qnull parent)