5 ms·
I was really hoping we'd have bindings to Qt by now, but looking at the GUI category on crates.io I didn't find any. What do people use to make cross platform G
by shock 9y ago
I was really hoping we'd have bindings to Qt by now, but looking at the GUI category on crates.io I didn't find any. What do people use to make cross platform GUIs in Rust?
- shmerl 9y agoThe last time I checked there was this: https://github.com/White-Oak/qml-rust https://github.com/White-Oak/qml-rust But it looks stalled. Not sure if anyone is working on such bindings today. UPDATE: I just found this which looks active: https://github.com/rust-qt/cpp_to_rust https://github.com/rust-qt/cpp_to_rust
- JoshTriplett 9y agobindgen has native C++ support (as of recently), so hopefully that will help.
- shmerl 9y agoThat's great!
- kodablah 9y agoThere are some glaring issues w/ the Rust Qt crates, namely subclassing things like QWidget. But it is high priority [0]. This is essential for using Qt as many things are not "signals" but instead overridable protected methods. I started a embedded browser PoC [1] until I hit these limitations which forced me to use C++ [2]. And many other static langs (i.e. not-python) have issues with their Qt bindings (e.g. Go [3] which can't compile via MSVC which some things like the QtWebEngine stuff need). Sadly, for advanced UI (e.g. complex tree views, docking, etc) that is cross platform and looks native, Qt is all there is, and it's reliance on C++ makes it a bit tough to use across languages. A maintained C iface for Qt is really needed. 0 - https://github.com/rust-qt/cpp_to_rust/issues/53 https://github.com/rust-qt/cpp_to_rust/issues/53 1 - https://github.com/cretz/rust-qt_cef_poc https://github.com/cretz/rust-qt_cef_poc 2 - https://github.com/cretz/qt_cef_poc https://github.com/cretz/qt_cef_poc 3 - https://github.com/therecipe/qt/ https://github.com/therecipe/qt/
- nicoburns 9y agoGTK is the best option at the moment. Apparently QT is difficult due to it being heavily based in C++'s view of the world, which doesn't translate particularly well to Rust (notably Rust not supporting OOP in the same way). There is hope of a new rust-native GUI library (possibly in the vain of Flutter[1]) based on the work done for Servo[2], but that looks to be a way off. [0] https://www.reddit.com/r/rust/comments/6l5c94/can_we_crowdfund_a_crossplatform_gui_lib_for_rust/ https://www.reddit.com/r/rust/comments/6l5c94/can_we_crowdfu... [1] https://flutter.io/ https://flutter.io/ [2] https://github.com/servo/webrender https://github.com/servo/webrender
- shmerl 9y agoI think translation problems aren't caused by OOP itself, but by messed up name mangling, and total lack of any sane standard for it in C++.
- wyldfire 9y agoThis thread [1] has some good recent discussion of the current state. [1] https://users.rust-lang.org/t/current-state-of-gui-development-in-rust/11643 https://users.rust-lang.org/t/current-state-of-gui-developme...
- rexicus 9y agoYou might try the imgui/nuklear crates, dealing with generated bindings for something massive like Qt will never be pleasant.
- dom0 9y agoBoth PyQt and PySide work quite well for something that "will never be pleasant".
- rexicus 9y agoPyQt and PySide was exactly what I had in mind. It'll leak memory, segfault on load 1% of the time, segfault if you call unrelated methods in the wrong order, you'll randomly get QStrings and QExceptions instead of their Python equivalents, and it'll be impossible to debug.
- coldtea 9y agoNothing much (some OpenGL bindings and such). They use it for systems software and backend services.