qml-old/examples/helloworld.scm

36 lines
1.0 KiB
Scheme
Raw Normal View History

2022-02-03 14:02:59 +00:00
(import
(qml core)
coops)
2021-04-10 09:43:03 +00:00
(gui-application-create)
(define engine (make <QQmlApplicationEngine>))
(define (windowLoadCallback cbdata argv) void
(print cbdata)
(print "Loaded QML file: " (to (cadr argv) string:)))
2022-02-03 14:02:59 +00:00
(define callback-data "Test")
2022-02-04 17:47:36 +00:00
(define textchange-cbdata "Text Edited")
2022-02-03 14:02:59 +00:00
2022-02-04 17:47:36 +00:00
(define conn (connect engine "objectCreated(QObject*,QUrl)"
windowLoadCallback
callback-data
(qt-connection-type auto:)))
2022-02-03 14:02:59 +00:00
(define loc (new-QUrl "examples/helloworld.qml"))
(load-url engine loc)
2022-02-04 17:47:36 +00:00
(define nameInputField (find-child (root engine) "nameInputField"))
2022-02-04 17:52:23 +00:00
(define (textChangeCallback cbdata argv) void
(print "Text changed to " (to (property nameInputField "text") string:)))
2022-02-04 17:47:36 +00:00
(define conn2 (connect nameInputField "textEdited()"
textChangeCallback
textchange-cbdata
(qt-connection-type auto:)))
2021-04-10 09:43:03 +00:00
(do ((loop #t))
((not loop) #t)
(process-events-timed (qevent-loop-process-event-flag process-all-events:) 50))