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. ProgressBar doesn't redraw until function returns control
Forum Updated to NodeBB v4.3 + New Features

ProgressBar doesn't redraw until function returns control

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 4 Posters 3.3k 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.
  • D Offline
    D Offline
    DieHertz
    wrote on 12 May 2012, 09:22 last edited by
    #1

    Greetings!
    I'm redesigning an application which handles telemetry data and performs visualization to use QML for it's GUI.
    Data processing takes noticeable amount of time on large input files, so I've decided adding a progress bar for indication.
    Processing method emits a signal when called, a signal per each fifth iteration and a signal before return, but the GUI never redraws before the method return control.
    Is there a viable solution to force redraw from QML signal handler?
    @import QtQuick 1.1
    import com.hertz 1.0
    import "ProgressBar" // from QtExamples

    Item {
    width: 300; height: 250

    Opener {
    id: opener
    onStart: { console.log('Started'); pb.value = 0 }
    onProcess: { pb.value = val; Qt.processEvents() }
    onEnd: console.log('Finished')
    }

    ProgressBar {
    id: pb
    width: 300
    }

    MouseArea {
    anchors.fill: parent
    onClicked: opener.open()
    }
    }
    }@
    P.S. I cannot alter Opener class (the only allowed modification is addition of three signals and their emission during data processing. Since there is no such standard component as ProgressBar, I see a solution in implementing ProgressBar in C++ and then exporting it to QML, but I hope there is a more elegant solution.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on 16 May 2012, 05:14 last edited by
      #2

      Where is "val" coming from and what is its value?

      1 Reply Last reply
      0
      • A Offline
        A Offline
        acranbury
        wrote on 31 May 2013, 14:53 last edited by
        #3

        'val' most likely comes from the process signal.

        I've been having the same issue, signals emitted from c++ don't update my progress bar until the c++ code returns.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on 31 May 2013, 19:22 last edited by
          #4

          Make sure the intensive C++ code runs in a separate thread then?

          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