|
From: | Alex Leach |
Subject: | Re: Removing __init_qt__ dependency on libgui |
Date: | Tue, 17 Nov 2020 10:27:18 +0000 |
From: John W. Eaton <jwe@octave.org>
Sent: 11 November 2020 18:52 To: Alex Leach <zander_leach@hotmail.com>; octave-maintainers@gnu.org <octave-maintainers@gnu.org> Cc: jwe@octave.org <jwe@octave.org> Subject: Re: Removing __init_qt__ dependency on libgui
Thanks for the response John, and apologies for the slow reply. Yes, you've hit the nail on the head, thanks and I'm glad
that you think this is a reasonable proposition. I've had a good think about how I think these components could, or should be initialised, as had previously just been thinking of target objectives. I'll summarise these below.
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.
Anyway, looking ahead, and I'm really grateful you would be willing to help and work in this direction, I'll try to help with some definitions as you've asked for.
Initialising
So, overall, I think the mechanisms of initialisation were designed quite well in the first place. However, maybe the reason more tests were added and it got more complicated was that the extra event_manager / octave_link instances were
absolutely required to be initialised outside of qthandles?
Event Manager / Octave Link
Looking at this more, I wonder if the event_manager definition can be simplified. In my app (when compiled against 5.2.0), a lot of the abstract functions were unnecessary, but I had to implement them regardless in
order to subclass octave_link and enable it. As the interpreter initialises an event_manager anyway, can we just use that base definition and implement it as a dynamic callback manager, with just a few generic methods, in place of all the dialog and preference
methods, something like:-
void event_manager::register_callback(std::string event_name, octave::octave_fcn cb);
octave_value_list event_manager::execute_callback(std::string event_name, octave_value_list args);
Objectives / Tests
To do
Other than the event manager stuff, I've tried making a stab at removing any dependency on libgui/src, and have made a fork on github, at https://github.com/alexleach/octave/tree/qthandles.
I might have made a bit of a mess of the commit history (sorry!), but it seems to be working okay for launching a figure Container and Canvas.
What isn't working are the Qt widgets for uigetfile / uiputfile / uigetdir, I guess because I don't have an event manager. Another thing that isn't working (in this or the fltk backend), are the buttons for 'Show / Toggle / Hide grid
on all axes'; these only affect the currently active axis, but I haven't looked into this much.
If there's anything else I can do to make this easier to implement, please let me know.
Best wishes,
Alex
|
[Prev in Thread] | Current Thread | [Next in Thread] |