Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. OpenMP and processEvents()
Qt 6.11 is out! See what's new in the release blog

OpenMP and processEvents()

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 2.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.
  • J Offline
    J Offline
    JulienMaille
    wrote on last edited by
    #1

    Hello,
    I'm facing a problem when trying to refresh GUI during a big computation.
    I have something like this
    @
    int main()
    {
    #pragma omp parallel for
    for( int i=0; i<stop; i++ )
    heavyStuff(i);
    }

    void heavyStuff(int i)
    {
    for( int j=0; j<maxJ;j++ )
    {
    // lengthy computation
    doSomething();

         // would like to processEvents here, but we are in a thread!
        qApp->processEvents();
    

    }
    @

    1 Reply Last reply
    0
    • A Offline
      A Offline
      ankursaxena
      wrote on last edited by
      #2

      Sorry but I haven't understand your problem ?? what problem r u facing ??

      1 Reply Last reply
      0
      • J Offline
        J Offline
        JulienMaille
        wrote on last edited by
        #3

        Thanks for looking at my problem.
        Is that ok to call qApp->processEvents(); from any thread?

        1 Reply Last reply
        0
        • M Offline
          M Offline
          MuldeR
          wrote on last edited by
          #4

          [quote]void QCoreApplication::processEvents()

          Processes all pending events for the calling thread according to the specified flags until there are no more events to process.[/quote]

          So, yes. It should be "okay". But it only processes the pending events for the calling thread. You probably want to call this from the "main" thread - at least if your goal is to keep the UI "responsive" during a lengthy operation.

          My OpenSource software at: http://muldersoft.com/

          Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

          Go visit the coop: http://youtu.be/Jay...

          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