Live data from Hacker News

Qt or HTML5? A Million Dollar Question

embedded-computing.com

71–80 of 88 posts

Re: Qt or HTML5? A Million Dollar Question

#71
post #55

Ideally we would have UI framework that can target both web and native. Or maybe some kind of next gen HTML that is targeted for maximum performance (like webassembly is to javascript).

> Ideally we would have UI framework that can target both web and native. What is ideal about that? Ideally we would have a vehicle that can target both trips to the local shop and a vacation to Morocco. What? I like having a separate bicycle and airplane.

The main enemy are Electron apps and this kind of framework would perhaps eliminate them.

Also I would prefer my flying car with autopilot over airplane.

Re: Qt or HTML5? A Million Dollar Question

#72
post #71

Earlier quoted context omitted.

> Ideally we would have UI framework that can target both web and native. What is ideal about that? Ideally we would have a vehicle that can target both trips to the local shop and a vacation to Morocco. What? I like having a separate bicycle and airplane.

The main enemy are Electron apps and this kind of framework would perhaps eliminate them. Also I would prefer my flying car with autopilot over airplane.

That's the problem: Electron _is_ the one-language-everywhere framework and that's why a chat client or a text editor has a 200 MiB runtime.

Re: Qt or HTML5? A Million Dollar Question

#73

Earlier quoted context omitted.

And licensing. Qt is LGPL or commercial. HTML is (in practice) more liberally licensed. (Edit: not GPL, but LGPL. Which is almost as bad for embedded systems as GPL itself is. How do you let the user relink Qt or replace Qt with their own version, in the field? Nightmare. Just pay up. Qt LGPL is (or was) fine for desktop apps pre app stores. Now, not so much.)

> And licensing. Qt is LGPL or commercial. And if you need on-screen keyboard, there’s no LGPL option available. You have to pay them significant amount of money, and also per-device fee.

There is an API for creating one yourself, I did, not hard at all. Now it might not have a dictionary and other fancy features but it was adapted to our needs and it didn't take long at all to implement.

Re: Qt or HTML5? A Million Dollar Question

#74
post #71

Earlier quoted context omitted.

The main enemy are Electron apps and this kind of framework would perhaps eliminate them. Also I would prefer my flying car with autopilot over airplane.

That's the problem: Electron _is_ the one-language-everywhere framework and that's why a chat client or a text editor has a 200 MiB runtime.

Maybe I should have been more specific. Ideal UI framework would generate HTML+webassembly for the web target, but native code for native targets.

Alternatively, there would be smart browser engine which can strip itself from unused modules during deployment.

Re: Qt or HTML5? A Million Dollar Question

#75
post #19

As for me and for many businesses the most important question is what is easier to engineer, support and run on different platforms.

Unfortunately, that is usually understood as what is easier for the front-end engineer who only knows js/html/css and doesn't want to learn other tech.

Wanting to learn other tech is mostly a question of how much effort will you have to invest in it before you get reasonably fluent. I don't really know about Qt but if learning it is a matter of a weekend (provided you already know a compatible programming language and have experience in UI design) then I don't think it's a problem. But I doubt it is this easy with Qt. I have had an idea of developing a KDE5 desktop plasmoid widget so I have taken a look at other plasmoids QML source codes and they didn't look easy to me, it felt like HTML is more intuitive (although I am not a web developer actually).

Re: Qt or HTML5? A Million Dollar Question

#76
post #39
post #10

I've done both and the real answer is "it depends". If performance is all that matters, the yes, it's Qt hands down. But Qt is also significantly harder to develop and maintain, especially if you want optimized application for minimal hardware.

>> But Qt is also significantly harder to develop and maintain, especially if you want optimized application for minimal hardware. If by that you mean it's easier to hack together some awful JS+HTML compared to hacking together a Qt application, I agree. If you want to build a maintainable, reliable and efficient solution, I don't think there is that much difference between the two. Qt has bindings to many languages,…

I can sort of confirm this. Disclaimer: I work with C++ and Qt and only know some basic HTML and JS.

I have worked on a project where we reimplemented an HTML5... application (information omitted to protect possible secrets). We did it in a quarter of the time with IIRC a tenth of the staff from the original, according to those who did the HTML5 version. Line count was also lower. Of course not having to redo high-level design and some lower level services was a massive benefit for us, and HTML5 frameworks weren't as good at the time.

Perhaps the most important point is that while they got a skeleton up in reasonable time, things slowed down greatly from there. The HTML5 / JS code was kind of hard to understand due to callback hell, and getting smooth performance took a huge amount of work. In the Qt version, we implemented it following some best practices and performance was great right away.

Re: Qt or HTML5? A Million Dollar Question

#77
post #39

Earlier quoted context omitted.

>> But Qt is also significantly harder to develop and maintain, especially if you want optimized application for minimal hardware. If by that you mean it's easier to hack together some awful JS+HTML compared to hacking together a Qt application, I agree. If you want to build a maintainable, reliable and efficient solution, I don't think there is that much difference between the two. Qt has bindings to many languages,…

Just a side note, but if you are building a commercial/serious product then your language options for Qt shrink down to just C++ and Python. Qt doesn't have many mature and maintained bindings to other languages.

This is true for desktop applications. On embedded, even PyQt or PySide could be difficult, depending on the amount of application logic required.

Re: Qt or HTML5? A Million Dollar Question

#78
post #19

Earlier quoted context omitted.

Unfortunately, that is usually understood as what is easier for the front-end engineer who only knows js/html/css and doesn't want to learn other tech.

Wanting to learn other tech is mostly a question of how much effort will you have to invest in it before you get reasonably fluent. I don't really know about Qt but if learning it is a matter of a weekend (provided you already know a compatible programming language and have experience in UI design) then I don't think it's a problem. But I doubt it is this easy with Qt. I have had an idea of developing a KDE5 desktop…

Well, HTML does not contain any APIs for creating plasmoids... So of course you have never seen that particular complexity in HTML.

Re: Qt or HTML5? A Million Dollar Question

#79
post #64

I've been a full-stack web developer for many years but the last two years I've switched to C++ & Qt development and god is it a pleasure to work with. I only work with Qt Widgets, but I've always wanted to fiddle with QML/QtQuick, although I find the official tutorials lacking. Any good resources to start working with QML/QtQuick?

It's easy as pie, start with qmlscene and a QML Rect, add some MouseArea and change the rect's color when you click, later follow some QML / C++ binding tutorials.

Some best practices: Still do your nontrivial models and other application logic in C++, don't try to solve every UI state problems with states and transitions - they are overkill for simple situations and underpowered when it gets really difficult. Also you'll learn to, and how to, avoid imperative code in JS over time.

Do use the QML profiler to investigate performance.

Re: Qt or HTML5? A Million Dollar Question

#80

Earlier quoted context omitted.

I used to call Qt ".Net for people who can't have anything better". When you code in Qt you rarely, if ever, are exposed to the hairy parts of C/C++. If anything, it feels like coding in C#. Nesides UI there are a gazillion helper and utility classes for everything from networking to threading to string handling. And with QML there's even less C++ :)

I actually just migrated a small Rust application to C++ with Qt because I have to use DBus and Qt has a very nice DBus library, which Rust has not. (In general, DBus hates runtime environments that don't have an event loop.)

It's pretty hard to have asynchronous calls without an event loop ;)

Using DBus synchronously is, strictly speaking, wrong unless you can PROVE that there can be no deadlocks; talking to the DBus daemon itself synchronously is generally safe though. Unfortunately QtDBus encourages synchronous calls. Maybe you remember desktop hangs in early KDE 4 related to global shortcuts - that was me not knowing that rule at the time.

Post reply on HN