RE: QtHandles in a C++ application with embedded interpreter
Alex Leach <[email protected]>
| Newsgroups | gmane.comp.gnu.octave.general |
|---|---|
| Message-ID | <VI1PR0102MB2606BE7E57474369571E091AF51E0@VI1PR0102MB2606.eurprd01.prod.exchangelabs.com> |
> -----Original Message----- > From: Alex Leach <[email protected]> > Sent: 19 October 2020 09:22 > To: Kai Torben Ohlhus <[email protected]> > Cc: [email protected] > Subject: RE: QtHandles in a C++ application with embedded interpreter > > I will put together a minimal example and upload to my github account. I'll > send a link shortly. I don't think it actually needs any widgets to demonstrate > what I'm trying to do, just a sub-class of octave::application and > octave::interpreter. The latter I did perhaps unnecessarily, so that I can also > subclass QObject and pass it to a worker QThread, and then all .m files are > called from the same thread. That's how I've gone about multi-threading, I > haven't bothered with mutexes and locks, like octave_link provides. But it > does mean that .m code is completely blocking and un-cancellable! > Struggling to get into my github account, as have moved phone recently and need to reset my 2FA, which will take some time. So, assuming attachments are acceptable, please find attached a relatively minimal project example created using Qt Creator. This was tested on windows, so the include and lib build variables may need to be changed depending on your environment. The concept is pretty simple here:- 1. Launch a QApplication with a QMainWindow containing a Start and Stop button. - On launch, MyInterpreter is created as well as a worker QThread. 2. When press Start:- - Try and register the qt graphics toolkit. - Move MyInterpreter to the QThread. - Send a signal from MyApplication to MyInterpreter. - MyInterpreter then calls a custom octave function that plots some graphs in a separate window. 3. Press Stop to close the MyApplication window and join all threads. What I'm struggling with here is the MyInterpreter::registerGraphics method. I don't need to implement this, but I would like to, so it can register and use the Qt backend in my app, if possible. Do you know anyway to make this happen? Thanks and kind regards, Alex
TestOctaveQtHandles.zip
(application/x-zip-compressed, 9.7 KB) - not displayed