mirror of
https://gitlab.com/eql/lqml.git
synced 2025-12-06 02:30:38 -08:00
add new snippet 'hourglass'; revision of 'help.htm'
This commit is contained in:
parent
ec4c140f9c
commit
6a664c9d27
11 changed files with 71 additions and 1 deletions
|
|
@ -54,6 +54,8 @@
|
||||||
Meant for passing INTEGER to QML/JS, where we only have floats. The integer
|
Meant for passing INTEGER to QML/JS, where we only have floats. The integer
|
||||||
is stored as a hex string in QML, and automatically converted back to a
|
is stored as a hex string in QML, and automatically converted back to a
|
||||||
'qint64' integer when passed with 'Lisp.call()'.
|
'qint64' integer when passed with 'Lisp.call()'.
|
||||||
|
If the conversion to 'qint64' is not possible, the hex string is returned,
|
||||||
|
which can be passed to READ-FROM-STRING to get arbitrary integer length.
|
||||||
|
|
||||||
|
|
||||||
<b>pixel-ratio ()</b>
|
<b>pixel-ratio ()</b>
|
||||||
|
|
|
||||||
40
snippets/busy-hourglass/qml/ext/Hourglass.qml
Normal file
40
snippets/busy-hourglass/qml/ext/Hourglass.qml
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
import QtQuick 2.15
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
visible: animation.running
|
||||||
|
|
||||||
|
Image {
|
||||||
|
id: hourglass1
|
||||||
|
anchors.centerIn: parent
|
||||||
|
width: 40
|
||||||
|
fillMode: Image.PreserveAspectFit
|
||||||
|
source: "../img/hourglass.png"
|
||||||
|
}
|
||||||
|
|
||||||
|
Image {
|
||||||
|
id: hourglass2
|
||||||
|
anchors.centerIn: parent
|
||||||
|
width: hourglass1.width
|
||||||
|
fillMode: Image.PreserveAspectFit
|
||||||
|
source: "../img/hourglass.png"
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
SequentialAnimation {
|
||||||
|
id: animation
|
||||||
|
objectName: "hourglass"
|
||||||
|
loops: Animation.Infinite
|
||||||
|
|
||||||
|
RotationAnimation { target: hourglass1; from: 0; to: 180; duration: 1000; easing.type: Easing.InOutSine }
|
||||||
|
|
||||||
|
ParallelAnimation {
|
||||||
|
NumberAnimation { target: hourglass1; property: "opacity"; from: 1; to: 0; duration: 1500; easing.type: Easing.InOutSine }
|
||||||
|
NumberAnimation { target: hourglass2; property: "opacity"; from: 0; to: 1; duration: 1500; easing.type: Easing.InOutSine }
|
||||||
|
}
|
||||||
|
|
||||||
|
// reset
|
||||||
|
NumberAnimation { target: hourglass1; property: "opacity"; to: 1; duration: 0 }
|
||||||
|
NumberAnimation { target: hourglass2; property: "opacity"; to: 0; duration: 0 }
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
snippets/busy-hourglass/qml/img/hourglass.png
Normal file
BIN
snippets/busy-hourglass/qml/img/hourglass.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
9
snippets/busy-hourglass/qml/main.qml
Normal file
9
snippets/busy-hourglass/qml/main.qml
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
import QtQuick 2.15
|
||||||
|
import 'ext/' as Ext
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: 300
|
||||||
|
height: 500
|
||||||
|
|
||||||
|
Ext.Hourglass {}
|
||||||
|
}
|
||||||
5
snippets/busy-hourglass/readme.md
Normal file
5
snippets/busy-hourglass/readme.md
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
Description
|
||||||
|
-----------
|
||||||
|
|
||||||
|
An hourglass animation (written in QML) during a long activity running in
|
||||||
|
a thread.
|
||||||
12
snippets/busy-hourglass/run.lisp
Normal file
12
snippets/busy-hourglass/run.lisp
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
(in-package :qml-user)
|
||||||
|
|
||||||
|
(defun load-huge-library ()
|
||||||
|
(q> |running| "hourglass" t) ; start animation
|
||||||
|
;; run task in thread
|
||||||
|
(mp:process-run-function
|
||||||
|
:loading
|
||||||
|
(lambda ()
|
||||||
|
(sleep 10) ; loading patiently...
|
||||||
|
(q> |running| "hourglass" nil)))) ; stop animation
|
||||||
|
|
||||||
|
(qsingle-shot 1000 'load-huge-library)
|
||||||
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
|
|
@ -18,7 +18,9 @@
|
||||||
"args: (integer)
|
"args: (integer)
|
||||||
Meant for passing INTEGER to QML/JS, where we only have floats. The integer
|
Meant for passing INTEGER to QML/JS, where we only have floats. The integer
|
||||||
is stored as a hex string in QML, and automatically converted back to a
|
is stored as a hex string in QML, and automatically converted back to a
|
||||||
'qint64' integer when passed with 'Lisp.call()'."
|
'qint64' integer when passed with 'Lisp.call()'.
|
||||||
|
If the conversion to 'qint64' is not possible, the hex string is returned,
|
||||||
|
which can be passed to READ-FROM-STRING to get arbitrary integer length."
|
||||||
(assert (integerp integer))
|
(assert (integerp integer))
|
||||||
(let ((*print-base* 16))
|
(let ((*print-base* 16))
|
||||||
(x:cc "#x" (princ-to-string integer))))
|
(x:cc "#x" (princ-to-string integer))))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue