5 ms·
Try writing something as simple as a dialog in Qt. It all makes sense, you subclass a QDialog, instantiate it and show it. Try doing that in pure HTML/CSS/JS,
by shittyadmin 8y ago
Try writing something as simple as a dialog in Qt. It all makes sense, you subclass a QDialog, instantiate it and show it.
Try doing that in pure HTML/CSS/JS, you're basically left with a clusterfuck. There's piles and piles of libraries built to workaround this clusterfuck from Bootstrap to react-modal and even the best of them have worse APIs for this than Qt does.
Ultimately, drawing widgets just makes more sense for desktop applications than trying to hack document-oriented HTML to be a usable UI framework.
Don't get me started on layouts...
- htor 8y agoif you're having a hard time doing modals and layouts with html and css you should perhaps start over and try grasping the core concepts. this system, unlike qt, is about separation of concerns, so structure and presentation are defined separately. far from a clusterfuck, it's actually a very good idea. if you are having a hard time finding non-crap libraries, then build your own pile of shit library. at least there are plenty of choices to pick from. it's called an ecosystem and it, unfortunately, is what you people don't have.
- dchest 8y ago<dialog> <p>Hello world</p> <button>OK</button> </dialog> <script> let dialog = document.querySelector('dialog'); dialog.querySelector('button').addEventListener('click', () => dialog.close()); dialog.showModal(); </script>
- deleted 8y ago[deleted]
- yoavm 8y agoYeah, it would be great when it'll work for more than just 60% of the internet users. Maybe then we can actually use it!
- dchest 8y agoI'm so sorry that a little bit of HTML and JavaScript reminds you and other commenters under my post of web developer's Old Browser nightmares and brave endeavors of satisfying 100% of Web users at any the cost, but we're talking about Electron which ships a quite recent version of Chromium :-)
- deleted 8y ago[deleted]
- _ZeD_ 8y agocool... then now make it work for ie. and mobiles. and... everything else other than the betas of chrome and firefox
- thiht 8y agohere you go: https://github.com/GoogleChrome/dialog-polyfill https://github.com/GoogleChrome/dialog-polyfill
- singularity2001 8y agoTypeError: dialog.showModal is not a function
- dchest 8y agoYour Electron version is old; if you're shipping it, you're probably putting your users at risk due to security issues in them. Check the latest versions here: https://electronjs.org/releases https://electronjs.org/releases
- singularity2001 8y agohttps://caniuse.com/#search=dialog https://caniuse.com/#search=dialog ? NO! <script> confirm("No dialog needed") </script>
- dchest 8y agoNice table, which shows that you are free to use <dialog> and many other modern features to write your Electron app: Electron v2.0.2 Chromium v61.0.3163.100 Node v8.9.3v8 v6.1.534.41
- singularity2001 8y agoElectron… fair point! Except we were comparing new web GUIs. On the flip side Electron explicitly does not impliment confirm() and prompt() which made me furious. So there is definitely truth in the general js=cluster-fuck sentiment.
- hajile 8y ago`confirm()`, `alert()`, `prompt()` and similar are widely regarded as mistakes. Including them on your new Electron app isn't something you should be doing in the first place.
- dchest 8y agoIndeed: https://developers.google.com/web/updates/2017/03/dialogs-policy https://developers.google.com/web/updates/2017/03/dialogs-po... Electron has native dialog APIs: https://electronjs.org/docs/api/dialog https://electronjs.org/docs/api/dialog
- littlestymaar 8y agoYou forgot a few part of the experience : - learn C++ - install a C++ compiler - learn Qt - install Qt For the web, you just need a browser, and JavaScript & CSS is way simpler and with way more documentation (especially for beginners). And for a simple modal dialog, you'll end up with 20 lines of code with no need for any framework …
- _ZeD_ 8y agofor the web you need to - learn html - learn css - learn javascript - learn ui framework whatever - learn what a transpiler is - install node.js just to process your files - learn how a client-server architecture works - learn how to setup a web server ... dude, you just don't know how deep this rabbit hole is
- littlestymaar 8y agoLol, this is ridiculous. You need to learn HTML, CSS and JS, but that are orders of magnitude easier than C++. Many people using it doesn't even have any computer science training. Everything else you said (transpiling, framework, webserver) is totally optional and context dependent. And absolutely not needed to write a modal … I wrote a personal website this year, and I didn't need a single of this. Of course they are useful if you want to write a professional web app, but so is unit testing, a CI server, or a build system. But this isn't necessary to do simple stuff on the web. Writing a website has a incredibly low barrier to entry, that why so many people complain about web developers not being real devs. If you think the web is harder to grasp that the C++ ecosystem, you're being delusional to say the least.
- shittyadmin 8y agoOrders of magnitude easier than C++? Please. C++ at least done Qt style really isn't that bad, it took me a few hours to get up and running with a reasonable Qt setup at work and start a project, when I had to do the same for electron I spent nearly a week mucking with gulp, babel, react and reading about which packing solution I should use, if I want to use TypeScript or Flow and if I can integrate them with the libraries I need to work with... Learning Qt is much easier than the JS ecosystem. It's one intergrated package with no messing around and a very clear suggested structure to applications. My coworkers still seem to want to hack everything in to main.js, can't understand react and one of the main libraries we are required to work with just doesn't integrate well with it at all. On the Qt side of things everything flows smoothly, the class architecture makes sense.