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. BusyIndicator and function JS

BusyIndicator and function JS

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
7 Posts 3 Posters 1.1k 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.
  • F Offline
    F Offline
    felipefontes
    wrote on last edited by aha_1980
    #1

    how do I make a busyindicator active and running while running a function in javascript?

    ODБOïO 1 Reply Last reply
    0
    • F felipefontes

      how do I make a busyindicator active and running while running a function in javascript?

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by ODБOï
      #2

      hi
      @felipefontes said in BusyIndicator and funtion JS:

      how do I make a busyindicator active

      set running property to true.

      what do you mean by ?
      @felipefontes said in BusyIndicator and funtion JS:

      while running a function in javascript

      can you show that function?

      F 1 Reply Last reply
      2
      • ODБOïO ODБOï

        hi
        @felipefontes said in BusyIndicator and funtion JS:

        how do I make a busyindicator active

        set running property to true.

        what do you mean by ?
        @felipefontes said in BusyIndicator and funtion JS:

        while running a function in javascript

        can you show that function?

        F Offline
        F Offline
        felipefontes
        wrote on last edited by
        #3

        @LeLev I'm going to make an insert in sqlite. While doing the insert I want to show a loading for the user

        1 Reply Last reply
        0
        • Shrinidhi UpadhyayaS Offline
          Shrinidhi UpadhyayaS Offline
          Shrinidhi Upadhyaya
          wrote on last edited by
          #4

          @felipefontes , you can just set the running property to true at the start of JS function and you can set it to false once it ends.

          For example:-

          BusyIndicator {
           id: loadingIndicator
           running: false
          }
          
          [..]
          [..]
          
          function insertData() {
            loadingIndicator.running = true
            //inserting in sqlite
            [..]
            [..]
            loadingIndicator.running = false
          }
          

          Shrinidhi Upadhyaya.
          Upvote the answer(s) that helped you to solve the issue.

          1 Reply Last reply
          -1
          • F Offline
            F Offline
            felipefontes
            wrote on last edited by felipefontes
            #5

            @Shrinidhi-Upadhyaya , does not work. It performs the function and locks the rest of the application

            1 Reply Last reply
            0
            • Shrinidhi UpadhyayaS Offline
              Shrinidhi UpadhyayaS Offline
              Shrinidhi Upadhyaya
              wrote on last edited by
              #6

              Hi @felipefontes , can show me the code once?

              Shrinidhi Upadhyaya.
              Upvote the answer(s) that helped you to solve the issue.

              1 Reply Last reply
              0
              • F Offline
                F Offline
                felipefontes
                wrote on last edited by
                #7

                @Shrinidhi-Upadhyaya

                                onPressed: {
                
                                    //adjust position on the screen
                                    var _height = flickable.contentHeight / 2 - 350;
                                    flickable.contentY = _height;
                
                                    //visible loading
                                    loading.visible = true
                
                                    
                                    //insert simulation
                                    var i = 0
                                    while (i<= 10000){
                                        console.log(i)
                                        i++
                                    }
                
                                    //disable loading
                                    loading.visible = false
                
                                }
                
                BusyIndicator {
                        id: loading
                        running: true
                        visible: false
                        anchors.horizontalCenter: parent.horizontalCenter
                        anchors.verticalCenter: parent.verticalCenter
                        Material.accent: app.accentColor
                
                
                        background: Rectangle {
                            id: syncWindow
                            //color: "transparent"
                            //clip: true
                            visible: true
                
                
                            Rectangle {
                                anchors.centerIn: parent
                                width: 125 * scaleFactor
                                height: 100 * scaleFactor
                                color: "lightgrey"
                                opacity: 0.8
                                radius: 5
                                border {
                                    color: "#4D4D4D"
                                    width: 1 * scaleFactor
                                }
                
                                Column {
                                    anchors {
                                        fill: parent
                                        margins: 10 * scaleFactor
                                    }
                                    spacing: 10
                
                
                                    Text {
                                        id:txt_loading
                                        anchors.horizontalCenter: parent.horizontalCenter
                                        anchors.bottom: parent.bottom
                                        text: "Carregando..."
                                        font.pixelSize: 16 * scaleFactor
                                    }
                                }
                            }
                
                        }
                
                    }
                
                1 Reply Last reply
                0

                • Login

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