fix 'qml:find-quick-item' when used together with '*root-item*' (note comment in sources)
This commit is contained in:
parent
8494a71fae
commit
1695e9fc36
1 changed files with 13 additions and 13 deletions
|
|
@ -77,8 +77,8 @@
|
|||
(when *quick-view*
|
||||
(|rootContext| *quick-view*)))
|
||||
|
||||
(defun find-quick-item (object-name &optional (parent *root-item*))
|
||||
"Finds the first QQuickItem matching OBJECT-NAME. Optionally pass a QQuickItem as parent, which defaults to *ROOT-ITEM*, which is defined but NIL, and meant to be used as special variable (in case of multiple items with the same OBJECT-NAME, e.g. in QML 'Repeater')."
|
||||
(defun find-quick-item (object-name)
|
||||
"Finds the first QQuickItem matching OBJECT-NAME. Locally define *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*
|
||||
;;
|
||||
|
|
@ -88,19 +88,19 @@
|
|||
;; search in the specific item of the Repeater.
|
||||
;;
|
||||
;; So, we locally bind *ROOT-ITEM* in order to find a specific child item
|
||||
;; inside the Repeater:
|
||||
;; inside the Repeater (note QRUN* which is needed because of the special
|
||||
;; variable and threads):
|
||||
;;
|
||||
;; (let ((qml:*root-item* (q! |itemAt| ui:*repeater* 0)))
|
||||
;; ;; everything we do here will only affect children of the first item
|
||||
;; ;: in ui:*repeater* (see index 0 above)
|
||||
;; (q< |text| ui:*edit*)
|
||||
;; (qrun* (let ((qml:*root-item* (q! |itemAt| ui:*repeater* 0)))
|
||||
;; ;; everything we do here will only affect children of the first
|
||||
;; ;; item in ui:*repeater* (see index 0 above)
|
||||
;; (q< |text| ui:*edit*)))
|
||||
;;
|
||||
(unless parent
|
||||
(setf parent (root-item)))
|
||||
(unless (qnull parent)
|
||||
(if (string= (|objectName| parent) object-name)
|
||||
parent
|
||||
(qt-object-? (qfind-child parent object-name)))))
|
||||
(let ((parent (or *root-item* (root-item))))
|
||||
(unless (qnull parent)
|
||||
(if (string= (|objectName| parent) object-name)
|
||||
parent
|
||||
(qt-object-? (qfind-child parent object-name))))))
|
||||
|
||||
(defun quick-item (item/name)
|
||||
(cond ((stringp item/name)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue