Qt GUI environment in a DLL
-
Qt doesn't really have stock widgets that are suitable for a VST plugin such as dials, knobs, meters and so on... There are some addons for Qt that have such widgets but they mostly use OS specific styling, making them a little odd for use in VST plugins.
You can still use Qt, you can still implement your own widgets, but Qt doesn't provide VST functionality out of the box, you have to use the Steinberg SDK or something similar, with Juce it is supported by the framework, and there are dozens of popular plugins that use the framework.
-
Yes I am aware that Qt doesn't support VST out of the box. I have created Qt Creator projects that compile against the VST SDK, that is not the issue.
All of the components will be my own custom ones anyway, derived from QWidget. I find the Qt GUI library very comfortable to work with and that is why I want to use it in this way. Furthermore I like the Qt Core ibrary and am very familiar with it.
The only problem I have got is in creating the event loop Qt needs to run from my plug-in. The fact it is a VST is irrelevant, I just want to work out how to use Qt GUI without having a main function that calls qApp->exec().
It seems there is no simple way to do this that I can find, so Juce might be more appropriate like you say
-
The whole concept of QtGui revolves around the exec loop - event handling, signals and slots and such. It is the way the framework is designed to operate, I am not sure there is a workaround for this.
-
Did you look at the link I posted? From the qtsolutions/winmigrate help:
@The Qt/MFC Migration Framework tool assists in the migration of existing Win32 or MFC applications to the Qt toolkit.
The project provides a set of classes that allow using Qt and MFC/Win32 windows in the same application. User interface elements developed with Qt can be embedded into an existing MFC or Win32 based user interface, and existing custom controls developed with MFC or Win32 can be integrated into Qt widgets.@
-
@utcenter - Well I linked to 2 possible workarounds and suggested another in my original post. Just none of them are very clean, because Qt GUI wasn't designed with this in mind like you say. I was just curious to see if I was missing something, it would seem not and there is no simple way to achieve what I want
-
@blobfish - Yeh I've got a clone of that repository now, thanks for that. I'l give it a go later, looks promising for Windows. Not sure how to tackle Mac OS though
-
I tried only modal dialogs in my dll's on both windows and mac. Since modal dialogs use local event loop, it works. However if you want to create modeless dialogs or other widgets, maybe you can take a look to "QAbstractEventDispatcher":http://qt-project.org/doc/qt-4.8/qabstracteventdispatcher.html#details.
bq. QAbstractEventDispatcher also allows the integration of an external event loop with the Qt event loop. For example, the Motif Extension includes a reimplementation of QAbstractEventDispatcher that merges Qt and Motif events together.
-
@cincirin - Cool, looks like a good lead. I wonder whether it's possible to use QAbstractEventDispatcher in the manner "described here":http://stackoverflow.com/questions/1051333/combing-an-external-event-loop-with-qts using another event loop (which I already have from the host application) to call processEvents()
-
Yes, maybe processEvents() will work. See "this Qt DLL in non Qt application forum":http://www.qtcentre.org/threads/14188-Qt-DLL-in-non-Qt-application Look at second post/solution proposed by @wysota :
bq. call QApplication:rocessEvents() periodically instead. This is a hack, but it will work
-
This conversation jogged my thinking. Since the Qt framework requires you to buy a license in order to statically link to their libraries, this may be ... inconvenient at best. VST plugin users are used to having a single DLL in order for their plugin to work, although external impulses or other WAV files are also employed. You will need QtCore4.dll and QtGui4.dll, in addition to your main DLL in order to make a working plugin. I have no problem delivering a normal application with extra DLL's, as most users won't care, but VST users don't usually expect their plugin consisting of three or more DLL's - especially if you're doing a fairly simple effect. Of course, you could pay for the commercial version.