Qt_Performance_Benchmark/Qt_Performance_Benchmark/main.qml

57 lines
1.1 KiB
QML
Raw Normal View History

2020-10-11 22:12:32 +02:00
import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.3
2020-10-12 10:48:41 +02:00
import be.mindgoo.tools 0.1
2020-10-11 22:12:32 +02:00
Window {
id: rootwin
2020-10-12 12:13:15 +02:00
width: 1920
height: 1080
2020-10-11 22:12:32 +02:00
visible: true
2020-10-12 12:13:15 +02:00
property var elements: 0
2020-10-11 22:12:32 +02:00
2020-10-12 12:13:15 +02:00
FrequencyMonitor {
id: monitor
refreshPeriod: 500
}
2020-10-11 22:12:32 +02:00
2020-10-12 12:13:15 +02:00
function doSomething(){
rootwin.elements++
var component = Qt.createComponent("Rect.qml");
var rect = component.createObject(rootwin,{"x":0,"y":0});
if(rect !== null ) {
rect.name = "Test";
rect.x = Math.floor(Math.random() * 100 );
rect.y = Math.floor(Math.random() * 100 );
}
2020-10-11 22:12:32 +02:00
}
2020-10-12 12:13:15 +02:00
Button{
id: doBtn
text: "do"
2020-10-11 22:44:19 +02:00
x: 20
2020-10-12 12:13:15 +02:00
y: 1000
onClicked: rootwin.doSomething()
2020-10-11 22:44:19 +02:00
}
2020-10-12 12:13:15 +02:00
Text {
id: fpsCounter
x: 200
y: 1000
text: "FPS: " + monitor.fps
2020-10-11 22:12:32 +02:00
}
2020-10-12 12:13:15 +02:00
Text {
id: elementsCounter
x: 300
y: 1000
text: "Elements: " + rootwin.elements
}
2020-10-11 22:12:32 +02:00
}
/*##^##
Designer {
D{i:0;formeditorZoom:2}
}
##^##*/