News for hackers. Stuff that matters.
Re:Qt for WebAssembly by shittyadmin on Tuesday June 19, 2018 @04:49PM (#17350198)
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...

Re:Qt for WebAssembly by dchest on Tuesday June 19, 2018 @05:29PM (#17350421)

    <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>
Re:Qt for WebAssembly by yoavm on Tuesday June 19, 2018 @07:57PM (#17351287)
Yeah, it would be great when it'll work for more than just 60% of the internet users. Maybe then we can actually use it!
Re:Qt for WebAssembly by dchest on Wednesday June 20, 2018 @05:16AM (#17353713)
I'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 :-)
Re:Qt for WebAssembly by singularity2001 on Wednesday June 20, 2018 @05:13AM (#17353698)
https://caniuse.com/#search=dialog ? NO! <script> confirm("No dialog needed") </script>
Re:Qt for WebAssembly by dchest on Wednesday June 20, 2018 @05:24AM (#17353753)
Nice 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
Re:Qt for WebAssembly by singularity2001 on Wednesday June 20, 2018 @11:28AM (#17356286)
Electron… 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.

Re:Qt for WebAssembly by hajile on Wednesday June 20, 2018 @02:35PM (#17358288)
`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.
Re:Qt for WebAssembly by dchest on Wednesday June 20, 2018 @03:21PM (#17358796)
Re:Qt for WebAssembly by singularity2001 on Wednesday June 20, 2018 @05:01AM (#17353652)
TypeError: dialog.showModal is not a function
Re:Qt for WebAssembly by dchest on Wednesday June 20, 2018 @05:20AM (#17353724)
Your 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
Re:Qt for WebAssembly by _ZeD_ on Wednesday June 20, 2018 @01:57AM (#17352937)
cool... then now make it work for ie. and mobiles. and... everything else other than the betas of chrome and firefox
Re:Qt for WebAssembly by thiht on Wednesday June 20, 2018 @11:51AM (#17356491)
Re:Qt for WebAssembly by littlestymaar on Tuesday June 19, 2018 @08:54PM (#17351531)
You 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 …

Re:Qt for WebAssembly by _ZeD_ on Wednesday June 20, 2018 @02:00AM (#17352945)
for 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

Re:Qt for WebAssembly by littlestymaar on Wednesday June 20, 2018 @04:04AM (#17353438)
Lol, 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.

Re:Qt for WebAssembly by shittyadmin on Wednesday June 20, 2018 @09:36AM (#17355182)
Orders 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.

Re:Qt for WebAssembly by pjmlp on Wednesday June 20, 2018 @03:10AM (#17353236)
A computing course that doesn't teach C++ is a quite poor one.
Re:Qt for WebAssembly by littlestymaar on Wednesday June 20, 2018 @04:16AM (#17353478)
What year is it again? Many (if not most?) computer science classes don't teach C++ anymore. They still teach C or Java, but not C++.

You need to realize the world you live in: while still useful for some specific applications, C++ is not a mainstream language anymore.

Re:Qt for WebAssembly by ahartmetz on Wednesday June 20, 2018 @08:49AM (#17354859)
C++ is used by most games and widely used in embedded computing, often with Qt. All major HTML engines are written in C++, too. You seem to be confusing your immediate environment with the world.
Re:Qt for WebAssembly by pjmlp on Wednesday June 20, 2018 @04:24AM (#17353518)
My university never teached C, first year students were perfectly able to understand C++ in early 90's.

It still does nowadays, in 2018, and like any good CS degree it teaches lots of other programming languages and paradigms as well.

There is lot of room for learning during 5 years.

If a computer science class in 2018 only does language X or Y, it is indeed quite poor.

Re:Qt for WebAssembly by littlestymaar on Wednesday June 20, 2018 @05:01AM (#17353651)
Oh, but there's plenty of language to teach : Java, Python, JavaScript, etc. and guess what. None of those were invented «early 90's» ;).

If a university wants to teach object-oriented programming, they can teach Java or C++. Guess which wins the decision in the majority of cases …

C++ isn't mainstream anymore, get used to it.

Re:Qt for WebAssembly by pjmlp on Wednesday June 20, 2018 @05:35AM (#17353803)
An university teaches much more than just object-oriented programming.

In 2018 C++ is the programming language driving Machine Learning, VR/AR, HPC, Fintech, GPGPU, WebAssembly, compiler research, OS research.

Which are all CS degree relevant subjects.

If you want to learn a specific language for whatever is currently cool on the job market there are vocational schools for that.

Re:Qt for WebAssembly by detaro on Wednesday June 20, 2018 @05:09AM (#17353686)
Java: 1995

Python: 1991

JavaScript: 1995

> If a university wants to teach object-oriented programming, they can teach Java or C++

Or Python. Or Smalltalk. Or Ruby. Or...

IMHO you both go off the opposite ends: No, a generic "developer" isn't badly educated if they don't know C++, but that doesn't mean C++ is some irrelevant language. It's critical for some domains of computing, and widely used.

Re:Qt for WebAssembly by littlestymaar on Wednesday June 20, 2018 @06:19AM (#17353985)
> IMHO you both go off the opposite ends: No, a generic "developer" isn't badly educated if they don't know C++, but that doesn't mean C++ is some irrelevant language. It's critical for some domains of computing, and widely used.

I never said it was irrelevant, I said it wasn't the mainstream it was in the early 90s. See my post above:

> while still useful for some specific applications, C++ is not a mainstream language anymore.

So are on the same line you and I :

> a generic "developer" isn't badly educated if they don't know C++

Re:Qt for WebAssembly by htor on Tuesday June 19, 2018 @05:20PM (#17350375)
if 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.