help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: QtHandles in a C++ application with embedded interpreter


From: Alex Leach
Subject: RE: QtHandles in a C++ application with embedded interpreter
Date: Mon, 19 Oct 2020 13:49:42 +0000

> -----Original Message-----
> From: Alex Leach <zander_leach@hotmail.com>
> Sent: 19 October 2020 09:22
> To: Kai Torben Ohlhus <k.ohlhus@gmail.com>
> Cc: help-octave@gnu.org
> 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

Attachment: TestOctaveQtHandles.zip
Description: TestOctaveQtHandles.zip


reply via email to

[Prev in Thread] Current Thread [Next in Thread]