13 ms·
Context: I was a Qt developer in a past life. The alternatives for cross-platform GUI are 1. Electron 2. Frameworks like C++/Qt C/Gtk 3. Bindings to (2) Us
by weberc2 8y ago
Context: I was a Qt developer in a past life.
The alternatives for cross-platform GUI are
1. Electron
2. Frameworks like C++/Qt C/Gtk
3. Bindings to (2)
Using frameworks like Qt in native C++ sucks because C and C++ are just terrible languages for GUI development, even with the bolted on object systems and language extensions (Qt extends the C++ language).
Using bindings to those frameworks is nice in theory because you don't have to manually manage your own memory or use their type system, but in practice you still need to understand how their types bridge to your language's types and how their memory management bridges with your language's memory management (typically a GC). So while you're dealing with C types and manual memory management less frequently, when you do have to deal with it, it's more complicated than dealing with it in standard C/C++. So (3) is hardly better than (2).
Electron is probably the most cost-effective option, but it has its own problems (notably the high resource consumption that comes from bundling a whole web browser).
With those considerations in mind, learning a new high level language is the least of all problems, especially if the GUI framework is high-quality.
- beojan 8y agoYou've completely ignored QML / Qt Quick here. That's the actual best option. Though Qt Widgets in C++ isn't too bad if you use the designer instead of insisting on doing everything in code.
- weberc2 8y agoQML is in the category of "learning a new language", although last I tried it it was very much a work in progress. Can't speak to how good it is today.
- darpa_escapee 8y agoLast time I played around with QML, it was basically Javascript.
- weberc2 8y agoQML is a declarative language; it has curly braces like JS, but that's about it. It also allows you to extend it with (some old, possibly noncompliant version of) JS, but the declarative markup is a distinct language.
- switchbak 8y agoThat's like saying every YAML or JSON dialect is a new language. Sure, but not a full-fledged "programming language". QML is quite nice to work with, and well suited to the problem at hand.
- weberc2 8y agoGranted, it's not a general purpose programming language, but it has a comparable learning curve. Certainy many times steeper than YAML or JSON or other markup languages.
- rat9988 8y agoI heard that qml/qt quick had worse performance.
- beojan 8y agoQuite the opposite, since it's GPU accelerated.
- mottosso 8y ago> So (3) is hardly better than (2). As someone developing GUIs with Qt bindings for Python daily, and has been for the past 8-9 years, I respectfully disagree. Understanding of the underlying types and memory management is rarely an issue (e.g. once every 3 months), and when it is it's incredibly straightforward (e.g. maintaining reference to a window you've just created else Python garbage collects it for you). Topics like these appear every now and then and remind me how there are still developers out there that still struggle to find the right combination of language and framework, some resorting to Electron because of assertions like this. This is a solved problem for my line of work - VFX and workflow related tools.
- devwastaken 8y agoPython probably does eliminate a lot of problems of QT, much of its being the static typing of c++. However you are still bound by qt's internal widgets. Creating custom widgets requires reasoning about the renderer and qt's internal code. The styling system of qt is also quite limited. Their 'css' is a small set that does not work well on everything. HTML+CSS allows for creating almost anything, it's the same on all platforms if the renderer is right. It's seperate from code and easily viewable and debuggable within a browser program. I have yet to see anything similiar with Qt, or a style heavy program like Discord made in Qt without becoming spaghetti.
- pfranz 8y agoI think Python is a poor choice for UI because it doesn't have a history of handling asynchronous things well. It leans on Qt a lot. But I also disagree that the styling is quite limited. Yeah, css in Qt is pretty limited, but creating a custom widget doesn't require all that much intimate knowledge (depending how custom we're talking). You can tweak the behavior of default widgets easily, you can draw a completely new one by painting and following the rules (for sizing, redrawing, etc). For new interaction models you'll need to be more familiar with the internals, but that's the case if you're stretching the limits of any framework. Qt works really well for cross-platform apps that adhere to the OS' style and behavior. I think way too many apps waste time and frustrate users by reinventing the wheel. QML seems to be their approach to UIs untethered to the host OS (I don't have any experience) and seems to be their focus for the past handful of years. Their Qt (Widget) demos always show a bunch of cool features I rarely use, but I do pilfer their code for examples when I need something. For a Discord like example; Maya, Nuke, and Houdini were all originally developed using their own UI toolkits and have migrated to Qt while maintaining each of their distinctive behaviors. They are all cross platform and require relatively low overhead and high performance with heavily customized UI behaviors. Maya: https://damassets.autodesk.net/content/dam/autodesk/www/campaigns/autodesk-for-games/opt/large-maya-2.jpg https://damassets.autodesk.net/content/dam/autodesk/www/camp... Nuke: https://www.foundry.com/sites/default/files/styles/teaser/public/paragraphs/feature-images/NUKE-3D-workspace.jpg?itok=fnhpbjNc https://www.foundry.com/sites/default/files/styles/teaser/pu... Houdini: https://d2wvmrjymyrujw.cloudfront.net/media/uploads/products/overview/character_houdini_ui.jpg https://d2wvmrjymyrujw.cloudfront.net/media/uploads/products... These apps did fork Qt5 when they moved from Qt4 to Qt5, but it was mostly Qt4 regressions and did it in a way intending to contribute their changes back into Qt mainline.
- kickopotomus 8y agoTo add to this, if you like concept/portability/cost-effectiveness of Electron but don't want to mess with the Node/npm ecosystem, there are chromium embedded frameworks out there for Java and Python[0][1][2]. [0]: https://bitbucket.org/chromiumembedded/java-cef https://bitbucket.org/chromiumembedded/java-cef [1]: https://github.com/cztomczak/cefpython https://github.com/cztomczak/cefpython [2]: https://www.teamdev.com/jxbrowser https://www.teamdev.com/jxbrowser
- LyndsySimon 8y agoThanks for this - I’d not heard of cefpython. It looks interesting, at the very least.
- kerberos84 8y agoIs java Swing/FX not cross-platfrom ?
- zerr 8y agoIt's with-platform :)
- edwinyzh 8y agoFreePascal with Lazarus, the true cross-platform GUI framework is similar to Delphi's VCL or .Net's WinForms, it's been in active development for over a decade, and you compile your program into native machine code to a lot of platforms. https://www.lazarus-ide.org/ https://www.lazarus-ide.org/
- jasonhansel 8y agoI really wish XUL had found uses beyond Mozilla -- IIRC it solved most of these issues.
- JTenerife 8y agoI've used PyQt some years ago and loved it. I can't remember any bigger issues at all. Super productive and fun.
- networkimprov 8y agoAnd there's the "localhost web app", where the app relies on whatever browser is installed. Jupyter Notebook does this. https://jupyter.org/ https://jupyter.org/
- mises 8y agoThere are other options. Two I've used a little: https://github.com/vurtun/nuklear https://github.com/vurtun/nuklear https://github.com/raysan5/raylib https://github.com/raysan5/raylib
- tapoxi 8y agoWhy is Electron so popular, but PWAs have seemingly failed to take off? Everyone was beating the PWA drum for a while, but I've almost never seen it implemented. What's the reason, lack of discoverability? I'd rather run one Chrome instance than a dozen apps that use varying versions of Electron.
- skybrian 8y agoMy guess is that teaching users a different way to install a desktop app limits adoption. The dependency on Chrome is a turnoff for people who don't already use Chrome. An Electron app just depends on the operating system (apparently), so the install is much like other desktop apps.
- Fnoord 8y agoBecause with Electron the "app builder" decides which extensions are ran. With a PWA, the user. Like 33% of all users use ad blockers, so its all about $$$. That (no incentive), and Electron was first...
- The_rationalist 8y agohttps://github.com/GoogleChromeLabs/carlo https://github.com/GoogleChromeLabs/carlo
- judge2020 8y ago> Carlo locates Google Chrome installed locally. Is this part of what Microsoft is doing with Chrome being pre-installed (via Edge)? I can't find a source, but I heard that using the existing chrome on the machine would reduce disk size for applications and possibly even allow them to share memory.
- devwastaken 8y agoWhat matters to developers is not the same as what matters to users. Users: Does it run and do the things I want and It's obvious how to access it? PWA's are a sandboxed environment, where devs do not have control of browser version, cannot modify chromium, and cannot bundle necessary binary code. Even Spotify bundles in faster JSON parsers, and probably a number of other things.
- fmxexpress 8y agoEmbarcadero Delphi Community Edition lets you compile to Android, iOS, macOS, and Windows with it's FireMonkey framework using a single UI and single codebase. It's free for hobbyists. The paid version plus a third party component adds Linux desktop support as well.
- robin_reala 8y agoYou missed out webapps, which for a lot of systems are intrinsically better.
- maga_2020 8y agoAnother alternative, I think is D-language bindings to QT (or betterC which is a subset of D allowes to use D with C runtime library, while retaining D-s class system, templates and memory safety). [1] https://github.com/MGWL/QtE5 https://github.com/MGWL/QtE5 D's team is doing an incredible job of matching C++ compiler specific ABIs, name mangling/etc -- just so D users can use C++ libraries (including templates) directly from D without loosing the features of the language. [2] https://dlang.org/spec/cpp_interface.html https://dlang.org/spec/cpp_interface.html Here is also an older video of Walter Bright (2015) talking about the challenges that D is tackling [3] https://www.youtube.com/watch?v=IkwaV6k6BmM https://www.youtube.com/watch?v=IkwaV6k6BmM