Trying to get rid of our QML timer.
We now connect to our window after animation signal from C++.
It looks like it works much better now. Less UI lags smother animation.
2 import QtQuick.Controls 1.2
3 import QtQuick.Window 2.1
5 import QtQuick.Layouts 1.1
12 //SystemPalette { id: palette }
17 //This window is our VFD frame
23 //Splash screen type do not have any border which is what we want
24 flags: Qt.SplashScreen
26 //property int timeoutInterval: 41
28 property int timeoutInterval: 33
30 //! [splash-properties]
31 //! [screen-properties]
32 //Here comes some trick to keep our display frame within our app.
33 //This make sure this window follows our app window.
34 x: appWindow.x+appWindow.width-256-13
35 y: appWindow.y+appWindow.height-64-30
37 //! [screen-properties]
38 width: rectangleScreen.width
39 height: rectangleScreen.height
40 //property int frameCounter:0;
41 property int firstFrame:-1;
42 property var startTime:new Date();
46 anchors.centerIn: parent
58 anchors.verticalCenter: parent.verticalCenter
59 anchors.horizontalCenter: parent.horizontalCenter
60 text: "start ------ abcdefghijklmnopqrtaksdjfkdfjklsdjflksdjfklsjadfkljsad;flasjdlfjasdfjldsdfljf---- end"
61 //text: "start ------ end"
82 text: "Time/Frame (ms):"
104 id: labelTimePerFrame
120 function doFrame(frameCount)
122 var current = new Date();
123 var milliseconds = (current.getTime() - startTime.getTime());
127 firstFrame=frameCount
131 var frameCounter=frameCount-firstFrame;
132 labelFrameCount.text=frameCounter;
133 labelTime.text=milliseconds/1000;
134 labelTimePerFrame.text=(milliseconds/frameCounter).toFixed(3);
135 labelFps.text=(1000/(milliseconds/frameCounter)).toFixed(0);
137 if (checkBoxDoClear.checked)
142 if (checkBoxRenderToDisplay.checked)
144 if (checkBoxFillAndClearOnly.checked)
146 //Trying to make it a worse case scenario for our frame diff algo
161 else if (checkBoxOnePixelOnly.checked)
163 display.setPixel(0,0,frameCounter%2);
167 display.renderWindow(frameWindow);
170 if (!checkBoxNoSwapBuffers.checked)
172 display.swapBuffers();
182 interval: frameWindow.timeoutInterval; running: false; repeat: true
183 property bool doFill: true
186 //frameWindow.doFrame();
189 //frameWindow.timeout();
193 Component.onCompleted: {
195 display.connectWindow(frameWindow,doFrame);
206 text: qsTr("Render Window")
208 display.renderWindow(frameWindow);
209 display.swapBuffers();
214 text: qsTr("Reset stats")
216 frameWindow.startTime = new Date();
217 //frameWindow.frameCounter = 0;
218 frameWindow.firstFrame = -1;
223 text: qsTr("Run timer")
226 (checked?timer.start():timer.stop())
232 text: qsTr("Do clear")
237 id: checkBoxRenderToDisplay
238 text: qsTr("Render to display")
243 id: checkBoxFillAndClearOnly
244 text: qsTr("Only fill and clear")
249 id: checkBoxNoSwapBuffers
250 text: qsTr("No swap buffers")
255 id: checkBoxOnePixelOnly
256 text: qsTr("One pixel only")
261 text: qsTr("Off-Screen")
263 onCheckedChanged: {display.offScreenMode = checked;}
267 text: qsTr("Frame differencing")
269 onCheckedChanged: {display.frameDifferencing = checked;}
275 border.color: "black"
277 anchors.horizontalCenter: parent.horizontalCenter
279 height: text.height + 10
285 anchors.verticalCenter: parent.verticalCenter
286 anchors.horizontalCenter: parent.horizontalCenter
287 text: "start ------ abcdefghijklmnopqrtaksdjfkdfjklsdjflksdjfklsjadfkljsad;flasjdlfjasdfjldsdfljf---- end"
288 //text: "start ------ end"