3 ms·
I'm sure there's a million things out in reactland for this, but even in vanilla JS it's pretty simple. I'd write it something like this: https://github.com/Jac
by jakear 4y ago
I'm sure there's a million things out in reactland for this, but even in vanilla JS it's pretty simple. I'd write it something like this: https://github.com/JacksonKearl/JSEnumComboBox/blob/main/index.ts https://github.com/JacksonKearl/JSEnumComboBox/blob/main/ind..., demo at https://jacksonkearl.github.io/JSEnumComboBox/ https://jacksonkearl.github.io/JSEnumComboBox/
Neither JS nor Python really have types at runtime or any other time, but you can approximate them with Objects and/or Classes (of course, I repeat myself ;) ). With some TS magic you can even get the `setEnumClass` call to be well typed, though if I were building it from scratch I'd make the EnumClass prop immutable, too many weird corner cases otherwise.
I've never worked extensively with Qt myself, but when helping out a friend making Maya plugins in Qt we'd occasionally hit SEGFAULTS from writing seemingly mundane Python that'd crash all of Maya. That was enough to turn me off of it, but looking through the docs you linked there are some compelling components. It's nice to have a component library separated from a specific framework (in the React/VUE/etc. sense)... I don't know of any in JS. Every framework seems to think their (incompatibile with everything else) approach to reactivity is the hold grail, and being modular across it would be impossible.
Though reconsidering, I suppose Qt is sorta the same... it's just another framework and their "signals" aren't Python. Ah well.
Diving deeper, signals are weird... they aren't even really part of the underlying C++! Some sort of strange new modifier Qt invented at the level of `private`/`public`/`protected` and such. https://doc.qt.io/qt-6/signalsandslots.html https://doc.qt.io/qt-6/signalsandslots.html
- xenonite 4y agoI am not aware of Qt being the problem here, having built large Qt apps that run stable (coding in C++ only). I guess it is rather an issue with the Python to Qt interface.