PDA

View Full Version : Qt DLL in non Qt application



thomas_-_s
14th June 2008, 21:34
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 (http://doc.trolltech.com/solutions/qtwinmigrate/winmigrate-walkthrough.html#3-1). But that is only available for commercial customers.

Any other ideas?

Thanks a lot and have a nice weekend!

Thomas

wysota
14th June 2008, 22:33
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::processEvents() 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.

triperzonak
15th June 2008, 06:12
http://www.qtcentre.org/forum/f-qt-programming-2/t-how-to-export-functions-to-dll-tutorial-11908.html

try my post.. hope it helps