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
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 |
Loading…
Add table
Add a link
Reference in a new issue