Results 1 to 3 of 3

Thread: Qt DLL in non Qt application

  1. #1
    Join Date
    Apr 2008
    Location
    Germany
    Posts
    12
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Qt DLL in non Qt application

    Hi folks.

    I am working on a plugin implemented in Qt. The resulting DLL should be usable by non Qt applications. But currently I get a message that there need to be a QApplication object. Since the non Qt app can't provide one I should create it on my own in my DLL. But if I call qapp.exec() there the main app is blocked.

    So is there a solution for that? Something like InterProcessCommunication?

    I only found a Qt addon MFC to Qt Migration. But that is only available for commercial customers.

    Any other ideas?

    Thanks a lot and have a nice weekend!

    Thomas

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt DLL in non Qt application

    There needs to be an event loop running - otherwise gui will not be responsive. So it is your task to provide something that will process events. Usually this is done by calling QApplication::exec(), but you can call QApplication:rocessEvents() periodically instead. This is a hack, but it will work. Another hack is to run QApplication::exec() from within a separate thread - this is risky though - you're asking for all the problems related to thread synchronization.

    A proper solution would be to integrate Qt's event loop with the other event loop running in your application - this is how Glib integration works and one can write an own custom event dispatcher compatible with practically any event loop out there.

  3. #3
    Join Date
    Dec 2007
    Posts
    129
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt DLL in non Qt application


Similar Threads

  1. Start Qt application as Windows Service
    By ^NyAw^ in forum Qt Programming
    Replies: 12
    Last Post: 10th May 2008, 17:23
  2. Loading library from application
    By mourad in forum Installation and Deployment
    Replies: 0
    Last Post: 2nd April 2008, 15:10
  3. dll + application
    By fpujol in forum Qt Programming
    Replies: 11
    Last Post: 15th April 2007, 18:37

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.