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. QCoreApplication::processEvents() and QEventLoop::ExcludeUserInputEvents
Forum Updated to NodeBB v4.3 + New Features

QCoreApplication::processEvents() and QEventLoop::ExcludeUserInputEvents

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 2.7k 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.
  • Q Offline
    Q Offline
    qttester5
    wrote on last edited by
    #1

    I've been reading this page a few times trying to understand exactly what is going on:

    "http://qt-project.org/wiki/ThreadsEventsQObjects#e3189e3dc40b94d64bb90318c4c401cb":http://qt-project.org/wiki/ThreadsEventsQObjects#e3189e3dc40b94d64bb90318c4c401cb

    In particular, they talk about how a function could be "recursed" if you use processEvents() and then call that same function again from a UI event event while it is still running from a prior similar UI event, and how passing QEventLoop::ExcludeUserInputEvents can prevent this by instead queuing the subsequent UI click.

    Do I interpret this to mean that if you pass QEventLoop::ExcludeUserInputEvents then subsequent UI events are still going to affect program operation, but that they will wait until current processes are complete and proceed down the UI event queue one-by-one, each UI event waiting for the prior one to complete whatever function it launched?

    If you do not pass QEventLoop::ExcludeUserInputEvents, what exactly is happening? The same function could be running multiple times simultaneously? I don't know what that really means.

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      zeljko
      wrote on last edited by
      #2

      When you create responsive ui (eg. thread is doing it's job in button click ,or you use processMessages), if user clicks again onto button (while processing first click) it will start unwanted new processing.
      So if you add QEventLoop::ExcludeUserInputEvents input events won't be processed until first processMessages() without that flag. That means that you can successfully finish your job in button click slot and then disconnect it or set some flag so it won't process new click for same data.
      Postponed input events will come on later, but they will not trigger your code again since you disconnected that slot or made any barrier.

      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