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. API Development - QEventLoop: Cannot be used without QApplication
Forum Update on Monday, May 27th 2025

API Development - QEventLoop: Cannot be used without QApplication

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 4.0k Views
  • 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.
  • E Offline
    E Offline
    erichumenay
    wrote on 17 Feb 2015, 15:16 last edited by
    #1

    We developed an API in Qt, and it worked beautifully when called from another Qt application. However, whenever I tried use the API by calling it from a C# application I ran into some troubles. I noticed the API functions that used helper threads were not working when I called them from the C# application. Whenever I started debugging this on the API side I realized the following error was occurring "QEventLoop: Cannot be used without QApplication". This error occurs for each helper thread that the API spawns with the end result being the threads don't appear to be doing anything.

    I did some research on this and I realize the problem being that QEventLoop needs to be called from an instance of QApplication which in my limited QT experience resides in main.cpp.

    So with all that being said, I am left with the impression that the API in its current state is only going to be compatible with QT applications, and if I needed it to be compatible with anything else we are going to have reimplement the threading on the API side.

    Is my conclusion correct? Does anyone have any suggestions and/or workarounds for this issue?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 17 Feb 2015, 23:36 last edited by
      #2

      Hi and welcome to devnet,

      You would to do something like described "here":http://stackoverflow.com/questions/2150488/using-a-qt-based-dll-in-a-non-qt-application

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      1/2

      17 Feb 2015, 15:16

      • Login

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