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. Passing control from Main loop
Forum Updated to NodeBB v4.3 + New Features

Passing control from Main loop

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 507 Views 2 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.
  • X Offline
    X Offline
    Xaegis
    wrote on last edited by
    #1

    Hello. I have a very beginner question to ask.
    It is my understanding that the main loop has the control for the UI elements. How do I pass control to my program logic in a way that avoids GIL? I am programming in C++ and an utter beginner and cannot figure out how this works. What does it look like?

    Thank you in advance !

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome
      GIL ? , like in global interpreter lock ?

      The QApplication::exec() is a event loop that runs the application.

      Im not sure what you mean by
      "How do I pass control to my program logic"

      Except you if you just mean run your application.
      In that case, you write your classes and functions.

      Say when you click a button. a click event is generated.
      If you connect a function to that event, your code is then run.
      (Right click the button and select go to slot)

      If you make a loop that runs forever, you will block the event loop and in that case the
      application will hang.

      To avoid that one could call QCoreApplication::processEvents() to avoid it hanging but in most cases such
      heavy calculations should be done in a new Thread.

      Hope it sort of answer what you ask.

      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