ritual icon indicating copy to clipboard operation
ritual copied to clipboard

Use custom C++ widgets in Ritual

Open notgull opened this issue 4 years ago • 2 comments

It would be nice to create a custom widget (derived from QWidget) in C++ code, then use it in Rust code. If this isn't possible already, I would be willing to add this functionality to the code.

notgull avatar Feb 06 '20 22:02 notgull

It appears that the main obstacle to this is that the QT-related dependencies are hardcoded into the qt_ritual and qt_ritual_common crates. In addition, it also appears that installation data is checked, which assumes that the crate in question is a main QT lib. It would be nice if either qt_ritual or qt_ritual_common exported a way to retrieve data for the QT compiler without needing to check if the installation was present. Again, I can add this functionality to the code, if it is desired.

notgull avatar Feb 08 '20 20:02 notgull

I think the plan here is:

  1. Modify qt_ritual so that it can return a Config for a library that depends on specified Qt crates.
  2. Use a recently added feature that allows you to inject arbitrary C++ code in the FFI library. It allows to avoid having to compile another library.
  3. Modify target_include_paths logic to allow processing libraries that consist of only extra C++ code. Right now, if you don't specify it, the parser will parse all available symbols, which is not what we need in this case.
  4. Modify qt_ritual_build so that it can be used for the produced crate. It's necessary to reuse its Qt detection logic so that the user's crate links to the same Qt as the main Qt crates.
  5. Make an example that can be used for a quick start.

I'm currently working on the next release of Qt crates, so some relevant changes to the generator are not yet finished. After I finish that, I'll look into this issue.

Riateche avatar Feb 09 '20 12:02 Riateche

Not interested in this anymore.

notgull avatar Apr 28 '23 19:04 notgull