mirror of
https://gitlab.com/eql/EQL5.git
synced 2025-12-06 18:40:50 -08:00
extend QML-SET to call |update| if desired (for QML 'PaintedItem' only)
This commit is contained in:
parent
7b8dcfcbb4
commit
560431046c
5 changed files with 49 additions and 43 deletions
|
|
@ -123,15 +123,17 @@
|
|||
t))
|
||||
(eql::%error-msg "QML-GET" (list item/name property-name)))))
|
||||
|
||||
(defun qml-set (item/name property-name value)
|
||||
"Sets QQmlProperty of either ITEM, or first object matching NAME. Returns T on success."
|
||||
(qlet ((property "QQmlProperty(QObject*,QString)"
|
||||
(quick-item item/name)
|
||||
property-name))
|
||||
(if (|isValid| property)
|
||||
(qlet ((variant (qvariant-from-value value (|propertyTypeName| property))))
|
||||
(|write| property variant))
|
||||
(eql::%error-msg "QML-SET" (list item/name property-name value)))))
|
||||
(defun qml-set (item/name property-name value &optional update)
|
||||
"Sets QQmlProperty of either ITEM, or first object matching NAME. Returns T on success. If UPDATE is not NIL and ITEM is a QQuickPaintedItem, |update| will be called on it."
|
||||
(let ((item (quick-item item/name)))
|
||||
(qlet ((property "QQmlProperty(QObject*,QString)" item property-name))
|
||||
(if (|isValid| property)
|
||||
(qlet ((variant (qvariant-from-value value (|propertyTypeName| property))))
|
||||
(prog1
|
||||
(|write| property variant)
|
||||
(when (and update (= (qt-object-id item) #.(qid "QQuickPaintedItem")))
|
||||
(|update| item))))
|
||||
(eql::%error-msg "QML-SET" (list item/name property-name value))))))
|
||||
|
||||
;;; JS
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue