octave-maintainers
[Top][All Lists]
Advanced

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

Re: Removing __init_qt__ dependency on libgui


From: John W. Eaton
Subject: Re: Removing __init_qt__ dependency on libgui
Date: Tue, 17 Nov 2020 11:34:42 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0

On 11/17/20 5:27 AM, Alex Leach wrote:
*From:* John W. Eaton <jwe@octave.org>

    As you note, however, the Qt graphics code is not usable
    without the Octave interpreter.  So why not have your application start
    the interpreter and interact with it to create plots using the Qt
    graphics code?

This was exactly what I had originally been attempting, however I was really struggling to get it to work. My 'simple' example got larger and larger as I was implementing various derived classes (e.g. octave_link) in attempts to get figures to show with the qt backend, using the 5.2.0 release code. I finally got the figures to show, but none of the toolbar or menubar buttons worked. I then noticed the really small example file in the original QtHandles github repository (that I linked to in my previous email) and realised a small example might not need to be any more complicated than that. However, over the last year or two, dependencies on the main GUI have crept in to the qthandles code, so that when I ran the example (replacing octave_main with octave::cli_application, then executing that), loading __init_qt__ results in missing symbol errors from liboctgui. Linking against liboctgui would fix these issues, but I think should be unnecessary.

OK. My goals for the Qt graphics code in Octave was focused mostly on getting it to work better in the context of the Octave GUI and I wanted to eliminate the global access to the interpreter and GUI objects.

But before we go too far discussing details, I'd like to agree on the goals. How do you want to use the Octave graphics code? I imagine that

  octave::interpreter octave_interpreter (...);
  QOctaveGraphics *graphics_widget
    = new QOctaveGraphics (parent_qt_widget, octave_interpreter);

where you create the graphics widget that is linked to your already initialized embedded Octave interpreter or perhaps

  QOctaveGraphics *graphics_widget
    = new QOctaveGraphics (parent_qt_widget);

and the QOctaveGraphics widget will initialize it's own interpreter object would be reasonable. However, due to global variable usage in the interpreter, only one Octave interpreter is allowed in a given process so only one graphics object could be created this way.

Is that the kind of thing you would like to do? If so, how would you interact with this object? Would you use interpreter functions to create plots or would you use Qt signals to pass data and plot options to the graphics widget?

jwe



reply via email to

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