PDA

View Full Version : Alternative QT Initialization (inside DLL)



komorra
15th September 2010, 07:59
Hi, yesterday I've downloaded QT, because I'm interested in making plugins for FL Studio application, and I need something to handle with GUI. The question is: how to initialize QT without calling app.exec() (this call hungs up my plugin), and with opportunity to use gui widgets and windows? The FL Studio SDK requires one very important function:


extern "C" TFruityPlug * _stdcall CreatePlugInstance(TFruityPlugHost *Host, int Tag)

This function must be exported and returns the TFruityPlug compatible class instance.
It will be great if QT have something like "QTInitialize" or something. Now using app.exec in above mentioned function hungs up everything and plugin is useless.
Thank you in advance for help.

e8johan
15th September 2010, 09:14
The QApplication::exec method does not initialize Qt - it *runs* Qt. The exec method contains the Qt event loop that lets Qt process and distribute events to widgets and other components. Not being able to run the event loop, a Qt application just sits there.

Extending a non-Qt application with a Qt extension is a hard thing to do - if not impossible. I, sadly, think that you will have to look for another solution.

komorra
15th September 2010, 09:58
QT is great library, I've seen many of demos attached - its very impresive. The only way to use QT is to build standalone application? This only point making disability to use whole library... but I need just a small part - the gui.
I have some experience with wxWIdgets - it works almost perfectly without one important thing that QT has - performance. So wxWidgets can work with FL Studio (which is written in Delphi) and QT not? Strange. There must be a trick to directly show QWidget or QWindow. Only what i need is to view QWidget and to have a DLL...

wysota
15th September 2010, 10:29
You need to integrate the event loop of Qt with the event loop of the other mechanism you use. In other words you need to make sure that periodically QApplication::processEvents() will be called by the other event loop so that Qt's events are being processed. Note that you can't use Qt timers to trigger the method because they require events too.