[Interest] Opening Qt/Qml window inside host app
Nuno Santos
nunosantos at imaginando.pt
Wed Dec 3 21:13:26 CET 2014
Tim,
I cannot tell you exactly how it is working. That was what I supposed as well. I even considered not calling exec and call app->processEvents(); on a regular basis somehow. This is what I have:
IVstWrapper::IVstWrapper(audioMasterCallback audioMaster) : AudioEffectX (audioMaster, kNumPrograms, kNumParams)
{
int argc=0;
settings = new IBasicSynthSettings(this);
wrapper = new IBasicSynthWrapper(this);
QGuiApplication::instance()->setAttribute(Qt::AA_MacPluginApplication);
app = new QGuiApplication(argc, 0);
engine = new QQmlApplicationEngine(app);
engine->rootContext()->setContextProperty("settings", settings);
engine->rootContext()->setContextProperty("wrapper", wrapper);
engine->load(QUrl(QStringLiteral("qrc:/main.qml")));
if (audioMaster)
{
setNumInputs(0);
setNumOutputs(2);
canProcessReplacing();
isSynth();
setUniqueID('VxS2');
}
suspend();
}
Like this, qml is responding to events and I can communicate with the C++ core of the synth from the GUI.
I had to switch context and work on other project in the meanwhile. But next week I will get back to this again and maybe I will be faced with any sort of limitation (hopefully not).
Right now, I have just tried this approach on Mac.
If anyone knows any limitation on this approach, I would be glad to know about it or better understand it. If there is an even better and solid solution, i’m looking forward to know about it.
Regards,
Nuno
> On 10/11/2014, at 08:18, Tim Blechmann <tim at klingt.org> wrote:
>
>> In general, for VST2 your implementation of AEffEditor::open() should
>> create the thread creating the application object and invoking
>> exec(). That is the latest point you can use before it has to be
>> created.
>
> out of curiosity: doesn't QApplication::exec have to be created from the
> main thread? in my experience, it is better to call sendPostedEvents()
> from the main thread.
>
> tim
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
More information about the Interest
mailing list