Skip to content

Commit cbc4111

Browse files
committed
minimer v3
1 parent 3bc70bd commit cbc4111

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed

FPSMonitor.qml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import QtQuick 2.0
66
Text {
77
property real t
88
property int frame: 0
9+
color: "red"
10+
text: "? Hz"
911

1012
Timer {
1113
id: fpsTimer
@@ -14,7 +16,7 @@ Text {
1416
interval: 1000
1517
running: true
1618
onTriggered: {
17-
console.log("FPS: " + fpsTimer.fps + " Hz")
19+
parent.text = "FPS: " + fpsTimer.fps + " Hz"
1820
fps = frame
1921
frame = 0
2022
}

main.qml

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,42 @@
11
import QtQuick 2.0
22

33
Item {
4-
width: 320
5-
height: 480
4+
width: 480
5+
height: 320
66

77
Image {
8+
id: root
89
sourceSize.width: parent.width
910
sourceSize.height: parent.height
10-
fillMode: Image.PreserveAspectCrop
11+
// fillMode: Image.PreserveAspectCrop
12+
13+
Component.onCompleted: {
14+
height = parent.height
15+
width = parent.width
16+
}
1117

12-
anchors.fill: parent
1318
source: "wallpaper.jpg"
1419

20+
SequentialAnimation {
21+
running: true
22+
loops: Animation.Infinite
23+
24+
NumberAnimation {
25+
target: root
26+
property: "scale"
27+
from: 0.5
28+
to: 4.0
29+
duration: 3000
30+
}
31+
32+
NumberAnimation {
33+
target: root
34+
property: "scale"
35+
from: 4.0
36+
to: 0.5
37+
duration: 1000
38+
}
39+
}
1540
NumberAnimation on rotation {
1641
id: rAnim
1742
from: 0
@@ -22,5 +47,7 @@ Item {
2247
}
2348

2449
FPSMonitor {
50+
anchors.top: parent.top
51+
anchors.left: parent.left
2552
}
2653
}

0 commit comments

Comments
 (0)