small revisions of QML examples

This commit is contained in:
polos 2017-03-07 00:23:14 +01:00
parent 20e3c27983
commit 622d2cb9fa
11 changed files with 40 additions and 27 deletions

View file

@ -89,6 +89,6 @@ same name.
QML Example:
Item {
id: myItem
objectName: "myItem"
id: my_item
objectName: "my_item"
}

View file

@ -47,7 +47,7 @@
(return-from winner t)))
(defun restart-game ()
(qml-set "messageDisplay" "visible" nil)
(qml-set "message_display" "visible" nil)
(qml-set "game" "running" t)
(dotimes (i 9)
(set-cell-state i "")))
@ -129,6 +129,6 @@
(make-move choice "O")))))
(defun game-finished (message)
(qml-set "messageDisplay" "text" message)
(qml-set "messageDisplay" "visible" t)
(qml-set "message_display" "text" message)
(qml-set "message_display" "visible" t)
(qml-set "game" "running" nil))

View file

@ -11,7 +11,7 @@ Rectangle {
signal clicked
width: buttonLabel.width + 20; height: buttonLabel.height + 6
width: button_label.width + 20; height: button_label.height + 6
border { width: 1; color: Qt.darker(container.color) }
radius: 8
color: "lightgray"
@ -34,8 +34,8 @@ Rectangle {
}
Text {
id: buttonLabel
objectName: "buttonLabel"
id: button_label
objectName: "button_label"
anchors.centerIn: container
text: container.text
font.pixelSize: 14

View file

@ -13,8 +13,8 @@ Rectangle {
property int difficulty: 10 // chance it will actually think
Image {
id: boardImage
objectName: "boardImage"
id: board_image
objectName: "board_image"
source: "../pics/board.png"
}
@ -25,7 +25,7 @@ Rectangle {
Grid {
id: board
objectName: "board"
width: boardImage.width; height: boardImage.height
width: board_image.width; height: board_image.height
columns: 3
Repeater {
@ -63,8 +63,8 @@ Rectangle {
}
Text {
id: messageDisplay
objectName: "messageDisplay"
id: message_display
objectName: "message_display"
anchors.centerIn: parent
color: "blue"
style: Text.Outline; styleColor: "white"
@ -72,7 +72,7 @@ Rectangle {
visible: false
Timer {
running: messageDisplay.visible
running: message_display.visible
onTriggered: { Lisp.call("restart-game") }
}
}

View file

@ -42,7 +42,7 @@
"color: 'black'"
(let ((n 0))
(dolist (char *chars*)
(qml "Image { id: img~A; source: 'img/~A.png' }"
(qml "Image { id: img~D; source: 'img/~A.png' }"
(incf n)
(image-of-char char))))
(qml "SequentialAnimation"
@ -59,11 +59,11 @@
(let ((target 0))
(mapc (lambda (from-xy to-xy)
(incf target)
(qml "PalindromeAnimation { target: img~A; property: 'x'; from: ~A; to: ~A }"
(qml "PalindromeAnimation { target: img~D; property: 'x'; from: ~D; to: ~D }"
target
(* 31 (first from-xy))
(* 31 (first to-xy)))
(qml "PalindromeAnimation { target: img~A; property: 'y'; from: ~A; to: ~A }"
(qml "PalindromeAnimation { target: img~D; property: 'y'; from: ~D; to: ~D }"
target
(* 31 (second from-xy))
(* 31 (second to-xy))))

View file

@ -14,7 +14,7 @@
(let ((num 0))
(mapc (lambda (char xy)
(incf num)
(qml "PalindromeImage { objectName: 'img~A'; source: 'img/~A.png'; x: ~D; y: ~D }"
(qml "PalindromeImage { objectName: 'img~D'; source: 'img/~A.png'; x: ~D; y: ~D }"
num
(image-of-char char)
(* 31 (first xy))

View file

@ -94,7 +94,7 @@ same name.
QML Example:
Item {
id: myItem
objectName: "myItem"
id: my_item
objectName: "my_item"
}

View file

@ -21,7 +21,7 @@ Image {
// final animation
SequentialAnimationExt {
objectName: "wiggle"
objectName: "wiggle_box"
loops: 5
RotationAnimation {

View file

@ -2,6 +2,8 @@ import QtQuick 2.0
import "../ext/"
Image {
id: player
Behavior on x {
NumberAnimationExt {
duration: 120
@ -15,5 +17,15 @@ Image {
easing.type: Easing.InOutSine
}
}
}
// final animation
RotationAnimation {
objectName: "rotate_player"
target: player
property: "rotation"
from: 0; to: 360
duration: 600
loops: 5
}
}

View file

@ -19,7 +19,7 @@ Rectangle {
// level change animations
ScaleAnimatorExt {
objectName: "zoomOut"
objectName: "zoom_board_out"
target: root
from: 0.8
to: 0
@ -27,7 +27,7 @@ Rectangle {
}
ScaleAnimatorExt {
objectName: "zoomIn"
objectName: "zoom_board_in"
target: root
from: 0
to: 0.8

View file

@ -136,9 +136,9 @@
*level*))))))
(when (/= level *level*)
(setf *level* level)
(queued (qml-set "zoomOut" "running" t) ; start animation
(queued (qml-set "zoom_board_out" "running" t)
(set-maze)
(qml-set "zoomIn" "running" t)))) ; start animation
(qml-set "zoom_board_in" "running" t))))
*level*)
(defun key-pressed (object event)
@ -229,7 +229,8 @@
t)
(defun final-animation ()
(queued (qml-set-all "wiggle" "running" t) ; start animation
(qml-set "rotate_player" "running" t)
(queued (qml-set-all "wiggle_box" "running" t)
(qml-set-all "object2" "rotation" 0)))
(defun run ()