[SOLVED] Howto use BusyIndicator?
-
Hi!
I have written the following code:
@
import QtQuick 2.2
import QtQuick.Controls 1.1Rectangle {
width: 360
height: 360BusyIndicator { id: indicator anchors.centerIn: parent running: false } MouseArea { anchors.fill: parent onClicked: { indicator.running = true console.log(fib(35)) indicator.running = false } } function fib(n){ if (n === 0 || n === 1){ return 1 } else { return fib(n-1) + fib(n-2) } }
}
@I have assumed, that I can see a running BusyIndicator while the 35th Fibonnaci-number is calculated. Unfortunately this does not happen. What am I doing wrong?
Best regards,
Oliver. -
Hi!
In the meantime I have found a solution:
@
import QtQuick 2.2
import QtQuick.Controls 1.1Rectangle {
id: main
width: 360
height: 360BusyIndicator { id: indicator anchors.centerIn: parent running: false } MouseArea { anchors.fill: parent onClicked: { indicator.running = true timer.start() } } Timer { id: timer repeat: false onTriggered: fct() } function fct(){ console.log(fib(35)) indicator.running = false } function fib(n){ if (n === 0 || n === 1){ return 1 } else { return fib(n-1) + fib(n-2) } }
}
@Best regards, Oliver.