lqml/examples/qsqlite
2025-04-14 14:00:41 +02:00
..
blob add new example 'qsqlite': use SQL from Lisp, load QML images from DB 2025-03-21 12:16:34 +01:00
cpp revisions 2025-03-24 18:37:52 +01:00
lisp revisions 2025-04-14 14:00:41 +02:00
qml add new example 'qsqlite': use SQL from Lisp, load QML images from DB 2025-03-21 12:16:34 +01:00
app.asd add new example 'qsqlite': use SQL from Lisp, load QML images from DB 2025-03-21 12:16:34 +01:00
app.pro add new example 'qsqlite': use SQL from Lisp, load QML images from DB 2025-03-21 12:16:34 +01:00
make.lisp add new example 'qsqlite': use SQL from Lisp, load QML images from DB 2025-03-21 12:16:34 +01:00
readme.md update readme 2025-03-21 12:24:44 +01:00
run.lisp add new example 'qsqlite': use SQL from Lisp, load QML images from DB 2025-03-21 12:16:34 +01:00

Info

This is a simple example of:

  • using the qsqlite (Qt specific SQLite DB) library directly from Lisp
  • providing a custom image provider, so we can directly load images in QML from an SQL database

The qsqlite library that comes with Qt has the advantage of being pulled in automatically as a dependency, and behaving exactly the same, no matter what OS is used. This is especially convenient on mobile.

If you run the example with:

$ lqml run.lisp -slime

you can then try to change the image source from the REPL:

(in-package :app)

(q> |source| ui:*logo* "image://db/logo-256")

This will load the image directly from the database.

Prepare

Please copy the app template files first:

$ cd ..
$ ./copy.sh qsqlite

For running on the desktop, you'll also need to compile the plugin:

$ cd cpp
$ qmake; make

Run

lqml run.lisp

Optionally pass -slime to start a Swank server, and connect from Emacs with M-x slime-connect.

During development you can pass -auto, which will reload all QML files after you made a change to any of them and saved it. For re-initialization after reloading, file lisp/qml-reload/on-reloaded will be loaded.

Closing the window quits the app. If you try to kill it with ctrl-c, you need an additional ctrl-d to exit from ECL. To quit from Slime, do (qq) which is short for (qquit).