Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [SOLVED] Howto use BusyIndicator?
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Howto use BusyIndicator?

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 1 Posters 1.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    olheem
    wrote on 17 Dec 2013, 19:33 last edited by
    #1

    Hi!

    I have written the following code:

    @
    import QtQuick 2.2
    import QtQuick.Controls 1.1

    Rectangle {
    width: 360
    height: 360

    BusyIndicator {
        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.

    1 Reply Last reply
    0
    • O Offline
      O Offline
      olheem
      wrote on 18 Dec 2013, 12:02 last edited by
      #2

      Hi!

      In the meantime I have found a solution:

      @
      import QtQuick 2.2
      import QtQuick.Controls 1.1

      Rectangle {
      id: main
      width: 360
      height: 360

      BusyIndicator {
          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.

      1 Reply Last reply
      0

      2/2

      18 Dec 2013, 12:02

      • Login

      • Login or register to search.
      2 out of 2
      • First post
        2/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved