QML.jl icon indicating copy to clipboard operation
QML.jl copied to clipboard

Move Makie Support to QMLMakie

Open steffenhaug opened this issue 1 year ago • 6 comments

This is probably not quite ready for a merge, but I'm starting a PR so we have a place to discuss where to go from here, and for visibility in case someone wants to play around with it or help out.

This PR moves the Makie Support to a new package, QMLMakie, as suggested in the roadmap and discussed in https://github.com/JuliaGraphics/QML.jl/issues/206.

This has a number of benefits:

  • Decoupling the Makie integration from the QML version
  • Possibility of compat bounds
  • No need to rely on janky loading of GLMakie which breaks PackageCompiler.jl

As it is, I basically just copied the code from makie_support.jl verbatim and made the necessary changes injlqml to initialize Makie Support in a separate JlCxx module, so that can be wrapped by QMLMakie.jl. There is still a lot of work to do before QMLMakie can be registered, but simple examples already work:

steffenhaug avatar Sep 07 '24 17:09 steffenhaug

Thanks, tried it out and it works beautifully. Some comments:

  • Could you split the commits in this PR in one commit to fix the white space consistency and one commit that has the actual change?
  • steffenhaug/QMLMakie should probably be named steffenhaug/QMLMakie.jl
  • In your QMLMakie package, the module is named QtMakie but that should be QMLMakie

The last two points are of no infulence on this PR of course.

barche avatar Sep 08 '24 18:09 barche

Thanks, tried it out and it works beautifully. Some comments:

Glad to hear :-)

Could you split the commits in this PR in one commit to fix the white space consistency and one commit that has the actual change?

Yeah, will do! I accidentally made the commit before i noticed the LSP had completely blown out the diff :-p

steffenhaug/QMLMakie should probably be named steffenhaug/QMLMakie.jl

Agreed!

In your QMLMakie package, the module is named QtMakie but that should be QMLMakie

Oh yeah, nice catch. Thanks!

steffenhaug avatar Sep 08 '24 19:09 steffenhaug

I ran JuliaFormatter on all the files in src while I was at it. That made for quite a large change technically unrelated to the PR. Let me know if that isn't desirable.

Also, if you have an opinion on style, we could add a JuliaFormatter config file to the project, so everyone is on the same page. As is, I just ran it with the default settings.

steffenhaug avatar Sep 08 '24 20:09 steffenhaug

Hi @steffenhaug. Was wondering if you're still pursuing this? Thinking about starting a project using QML.jl and running into issues with compat with GLMakie. Seems like this would fix the issue.

Larbino1 avatar Feb 28 '25 14:02 Larbino1

Not really. I'm interested, but I hit some snags trying to get QMLMakie to support modern Makie versions, to the point where I could not justify the time investment on the clock, where I had a use case for it.

Even though embedding GLMakie is not that complicated in principle (as demonstrated by the ImGui embedding, the code is quite short), I have not been able to get modern Makie versions to render anything from a callback in QML, and I'm also not exactly sure what the problem is. Makie is not designed to run in multithreaded contexts, and I suspect that it doesn't play nicely with Qt's runtime.

I was hoping to get at least a proof of concept going before publishing anything, because publishing QMLMakie with a dependency on Makie 0.17 is silly, and alas I had not had time to work on this any further.

steffenhaug avatar Mar 01 '25 18:03 steffenhaug

Thank you for taking the time to respond - I understand

Larbino1 avatar Mar 07 '25 15:03 Larbino1

Even though embedding GLMakie is not that complicated in principle (as demonstrated by the ImGui embedding, the code is quite short), I have not been able to get modern Makie versions to render anything from a callback in QML, and I'm also not exactly sure what the problem is. Makie is not designed to run in multithreaded contexts, and I suspect that it doesn't play nicely with Qt's runtime.

How far did you get? In general, what is the furthest progress anyone has made in getting this to work: https://docs.makie.org/stable/explanations/backends/glmakie#embedding

Eg, has anyone gotten an empty plot (window, screen, figure, idk the correct term here) to show up without error?

tetrakai1 avatar May 16 '25 03:05 tetrakai1

Closing this because of the changes in #221, the new release #222 and https://github.com/steffenhaug/QMLMakie.jl/pull/1

barche avatar Jun 20 '25 15:06 barche