Browse Source

Actually working. Added example.

master
Daniel Ziltener 6 months ago
parent
commit
c95bafaca9
5 changed files with 280 additions and 12 deletions
  1. +21
    -0
      examples/helloworld.qml
  2. +11
    -0
      examples/helloworld.scm
  3. +133
    -8
      qml.core.scm
  4. +3
    -1
      qml.egg
  5. +112
    -3
      qml.lowlevel.scm

+ 21
- 0
examples/helloworld.qml View File

@ -0,0 +1,21 @@
import QtQuick 2.5
import QtQuick.Window 2.2
Window {
visible: true
width: 320
height: 480
Rectangle {
id: page
width: 320; height: 480
color: "lightgray"
Text {
id: helloText
text: "Hello world!"
y: 30
anchors.horizontalCenter: page.horizontalCenter
font.pointSize: 24; font.bold: true
}
}
}

+ 11
- 0
examples/helloworld.scm View File

@ -0,0 +1,11 @@
(import (qml core)
coops)
(gui-application-create)
(define engine (make <QQmlApplicationEngine>))
(define loc (new-QUrl "examples/helloworld.qml"))
(load-url engine loc)
(do ((loop #t))
((not loop) #t)
(process-events-timed (qevent-loop-process-event-flag process-all-events:) 50))

+ 133
- 8
qml.core.scm View File

@ -1,13 +1,132 @@
;; -*- geiser-scheme: chicken -*-
(module (qml core)
*
(import scheme)
(import (r7rs))
(define-library (qml core)
(import (chicken gc))
(import (chicken string))
(import (chicken base))
(import (chicken condition))
(import (qml lowlevel))
(import (scheme base))
(import coops coops-primitive-objects coops-extras srfi-1 srfi-69)
(export application-dir-path
process-events
process-events-timed
gui-application-create
gui-application-exec
gui-application-quit
gui-application-delete
qapplication-create
qapplication-exec
qapplication-quit
qapplication-delete
qquickstyle-set-style
qquickstyle-set-fallback-style
initialize-instance
set
to
is-null?
assign
copy
delete-pointer
delete-pointer-later
<Enum>
<QEventLoopProcessEventFlag>
qevent-loop-process-event-flag
<QtConnectionType>
qt-connection-type
<QQuickViewResizeMode>
qquick-view-resize-mode
<QItemDataRole>
qitem-data-role
<QtOrientation>
qt-orientation
<QMLBase>
add-ptrentry
remove-ptrentry
<QObject>
signal-emit
<QVariant>
qvariant
<QQmlContext>
base-url
set-property
<QUrl>
new-QUrl
to-string
valid?
<QPixmap>
new-QPixmap
load
load-from-data
fill
assign
<QQuickImageProvider>
new-QQuickImageProvider
<QQmlApplicationEngine>
load
load-url
load-data
add-import-path
context
add-image-provider
<QQuickView>
show
source
set-source-url
set-source
set-resize-mode
root-context
<QMetaObject>
new-QMetaObject
invoke-method
<QModelIndex>
row
column
valid?
data
parent
child
sibling
assign
<QAbstractItemModel>
new-QAbstractItemModel
set-data
flags
header-data
<QAbstractListModel>
new-QAbstractListModel
index
parent
column-count
<QAbstractTableModel>
new-QAbstractTableModel
index
parent
)
(begin
;; Enums
(define-class <Enum> ()
@ -119,7 +238,9 @@
(define-method (add-ptrentry (qbase <QMLBase>))
(hash-table-update! callback-registry (ptr qbase)
(lambda (alist)
(alist-update refcount: (+ 1 (refcount alist)) alist))
(let* ((refc (refcount alist))
(alist (alist-delete refcount: alist)))
(alist-cons refcount: (+ 1 refc) alist)))
(lambda ()
(alist-cons refcount: 1 '()))))
(define-method (remove-ptrentry (qbase <QMLBase>))
@ -127,7 +248,9 @@
(hash-table-delete! callback-registry (ptr qbase))
(hash-table-update! callback-registry (ptr qbase)
(lambda (alist)
(alist-update refcount: (- (refcount alist) 1) alist)))))
(let* ((refc (refcount alist))
(alist (alist-delete refcount: alist)))
(alist-cons refcount: (- refc 1) alist))) )))
(define-method (initialize-instance (qbase <QMLBase>))
(call-next-method)
(add-ptrentry qbase)
@ -292,7 +415,7 @@
(dos_qmodelindex_row (ptr qmi)))
(define-method (column (qmi <QModelIndex>))
(dos_qmodelindex_column (ptr qmi)))
(define-method (is-valid? (qmi <QModelIndex>))
(define-method (valid? (qmi <QModelIndex>))
(dos_qmodelindex_isValid (ptr qmi)))
(define-method (data (qmi <QModelIndex>) (role <QItemDataRole>))
(dos_qmodelindex_data (ptr qmi) (val role)))
@ -333,4 +456,6 @@
(define-method (index (qatm <QAbstractTableModel>) (row <integer>) (column <integer>) (parent <QModelIndex>))
(dos_qabstracttablemodel_index (ptr qatm) row column (ptr parent)))
(define-method (parent (qatm <QAbstractTableModel>) (child <QModelIndex>))
(dos_qabstracttablemodel_parent (ptr qatm) (ptr child))))
(dos_qabstracttablemodel_parent (ptr qatm) (ptr child)))
)
)

+ 3
- 1
qml.egg View File

@ -50,7 +50,8 @@
dotherside/lib/src/DosQQuickImageProvider
dotherside/lib/src/DOtherSide
dotherside/lib/src/DOtherSideTypesCpp)
(csc-options "-c++" "-Idotherside/lib/include"
(csc-options "-X" "r7rs" "-R" "r7rs" "-sJ"
"-c++" "-Idotherside/lib/include"
"-L" "-lQt5Core"
"-L" "-lQt5Widgets"
"-L" "-lQt5Gui"
@ -63,4 +64,5 @@
"-L" "-lQt5QuickTest"
"-L" "-lOpenGL"))
(extension qml.core
(csc-options "-X" "r7rs" "-R" "r7rs" "-sJ")
(component-dependencies qml.lowlevel))))

+ 112
- 3
qml.lowlevel.scm View File

@ -1,9 +1,118 @@
;; -*- geiser-scheme: chicken -*-
(module (qml lowlevel)
*
(import scheme)
(import (r7rs))
(define-library (qml lowlevel)
(import (scheme base))
(import (chicken foreign))
(import foreigners)
(export DosQEventLoopProcessEventFlagProcessAllEvents
DosQEventLoopProcessEventFlagExcludeUserInputEvents
DosQEventLoopProcessEventFlagProcessExcludeSocketNotifiers
DosQEventLoopProcessEventFlagProcessAllEventsWaitForMoreEvents
DosQtConnectionTypeAutoConnection
DosQtConnectionTypeDirectConnection
DosQtConnectionTypeQueuedConnection
DosQtConnectionTypeBlockingConnection
DosQtConnectionTypeUniqueConnection
dos_qcoreapplication_application_dir_path
dos_qcoreapplication_process_events
dos_qcoreapplication_process_events_timed
dos_qguiapplication_create
dos_qguiapplication_exec
dos_qguiapplication_quit
dos_qguiapplication_delete
dos_qapplication_create
dos_qapplication_exec
dos_qapplication_quit
dos_qapplication_delete
dos_qquickstyle_set_style
dos_qquickstyle_set_fallback_style
dos_qobject_signal_emit
dos_qobject_delete
dos_qobject_deleteLater
dos_qvariant_create
dos_qvariant_create_int
dos_qvariant_create_bool
dos_qvariant_create_string
dos_qvariant_create_qobject
dos_qvariant_create_float
dos_qvariant_setInt
dos_qvariant_setBool
dos_qvariant_setFloat
dos_qvariant_setString
dos_qvariant_setQObject
dos_qvariant_toInt
dos_qvariant_toBool
dos_qvariant_toString
dos_qvariant_toFloat
dos_qvariant_toQObject
dos_qvariant_isnull
dos_qvariant_assign
dos_qvariant_create_qvariant
dos_qvariant_delete
dos_qqmlcontext_baseUrl
dos_qqmlcontext_setcontextproperty
dos_qurl_create
dos_qurl_to_string
dos_qurl_isValid
dos_qurl_delete
dos_qpixmap_create
dos_qpixmap_create_width_and_height
dos_qpixmap_create_qpixmap
dos_qpixmap_load
dos_qpixmap_loadFromData
dos_qpixmap_fill
dos_qpixmap_assign
dos_qpixmap_isNull
dos_qpixmap_delete
dos_qquickimageprovider_create
dos_qquickimageprovider_delete
dos_qqmlapplicationengine_create
dos_qqmlapplicationengine_load
dos_qqmlapplicationengine_load_url
dos_qqmlapplicationengine_load_data
dos_qqmlapplicationengine_add_import_path
dos_qqmlapplicationengine_context
dos_qqmlapplicationengine_addImageProvider
dos_qqmlapplicationengine_delete
dos_qquickview_create
dos_qquickview_show
dos_qquickview_source
dos_qquickview_set_source_url
dos_qquickview_set_source
dos_qquickview_set_resize_mode
dos_qquickview_rootContext
dos_qquickview_delete
dos_qmetaobject_create
dos_qmetaobject_invoke_method
dos_qmetaobject_delete
dos_qobject_qmetaobject
dos_qabstractitemmodel_qmetaobject
dos_qabstracttablemodel_qmetaobject
dos_qabstractlistmodel_qmetaobject
dos_qmodelindex_create
dos_qmodelindex_create_qmodelindex
dos_qmodelindex_row
dos_qmodelindex_column
dos_qmodelindex_isValid
dos_qmodelindex_data
dos_qmodelindex_parent
dos_qmodelindex_child
dos_qmodelindex_sibling
dos_qmodelindex_assign
dos_qmodelindex_delete
dos_qabstractitemmodel_create
dos_qabstractitemmodel_setData
dos_qabstractitemmodel_flags
dos_qabstractitemmodel_headerData
dos_qabstractlistmodel_create
dos_qabstractlistmodel_index
dos_qabstractlistmodel_parent
dos_qabstractlistmodel_columnCount
dos_qabstracttablemodel_create
dos_qabstracttablemodel_index
dos_qabstracttablemodel_parent)
(begin
(foreign-declare "#include <DOtherSide/DOtherSideTypes.h>")
(foreign-declare "#include <DOtherSide/DOtherSide.h>")


Loading…
Cancel
Save