Demonstrating reading properties

This commit is contained in:
Daniel Ziltener 2022-02-04 18:52:23 +01:00
parent 7ef338bda5
commit 412c528a27
2 changed files with 5 additions and 4 deletions

View File

@ -9,9 +9,6 @@
(print cbdata)
(print "Loaded QML file: " (to (cadr argv) string:)))
(define (textChangeCallback cbdata argv) void
(print cbdata))
(define callback-data "Test")
(define textchange-cbdata "Text Edited")
@ -24,6 +21,10 @@
(load-url engine loc)
(define nameInputField (find-child (root engine) "nameInputField"))
(define (textChangeCallback cbdata argv) void
(print "Text changed to " (to (property nameInputField "text") string:)))
(define conn2 (connect nameInputField "textEdited()"
textChangeCallback
textchange-cbdata

View File

@ -342,7 +342,7 @@
(define-method (set-object-name (qo <QObject>) (name <string>))
(dos_qobject_setObjectName (slot-value qo) name))
(define-method (property (qo <QObject>) (propertyName <string>))
(dos_qobject_property (slot-value qo 'ptr) propertyName))
(make <QVariant> 'ptr (dos_qobject_property (slot-value qo 'ptr) propertyName)))
(define-method (set-property (qo <QObject>) (propertyName <string>) (value <QVariant>))
(dos_qobject_setProperty (slot-value qo 'ptr) propertyName (slot-value value 'ptr)))
(define-method (find-child (qo <QObject>) (child-name <string>))