
Ask HN: Should Qt be considered in the place of electron? - mhh__
When a cross platform app is required, Electron is often mentioned first: Should Qt be considered  to fill that gap (As in the new QML-y Qt)
======
ken
I hear this a lot, as a contrast to Electron, but I haven't seen any examples
of good cross-platform Qt apps.

The only Qt app I've used recently is VirtualBox, which is terrible on the
Mac. The controls don't look or work right at all. On Windows, it's less bad,
but still noticeably non-native.

I searched the web and found that Google Earth Pro also uses Qt, so I
downloaded that. It looks awful, too. The scrollbars, split panes, buttons,
and toolbars look wrong. Checkboxes are drawn mangled, animation is absent,
and the outline view doesn't size its rows correctly so the bottom half of
text is cut off. Despite language being "System default" in the Earth prefs,
and English being the top language in my System Prefs, part of the UI is in
Japanese (my #2). The view right after launch:
[https://i.imgur.com/eDvSoUm.png](https://i.imgur.com/eDvSoUm.png)

I think a good first step would be looking at existing Qt apps. Are you OK
with the quality of apps like VirtualBox and Earth? Alternatively, do you
think you can do a better job at this than Google and Oracle?

I think if you're planning to write a typical Qt app, in order to make 'native
app' fans happy, you're going to be in for a surprise.

~~~
cpburns2009
> The only Qt app I've used recently is VirtualBox, which is terrible on the
> Mac. The controls don't look or work right at all. On Windows, it's less
> bad, but still noticeably non-native.

On Windows and Linux (primarily Ubuntu), KeePassXC, VirtualBox and VLC have
been pretty good in my experience and they're Qt as far as I know. Dropbox
uses Qt as well, however, it's interface is minimal. Electron doesn't even try
to look or behave natively for what it's worth.

~~~
ken
Curious. VLC on MacOS doesn't exhibit any of the weird UI glitches that other
Qt apps have, and an inspection of the package shows it doesn't contain any Qt
frameworks.

VLC's Wiki [1] says: "Qt / Qt4 is the default, plain, graphical, interface to
VLC, made using the Qt library (Linux users may need to have this installed).
It is used as the default interface on the Windows and Linux versions of VLC
media player from version 0.9.0 and above."

[1]:
[https://wiki.videolan.org/Qt_Interface/](https://wiki.videolan.org/Qt_Interface/)

I googled for "dropbox mac qt" and only found this page [2] from 2014 which
says they were experimenting with rewriting the Dropbox UI in Qt for Linux and
Windows. The linked post [3] says the Qt rewrite is for Windows and Linux
only.

[2]: [http://www.webupd8.org/2014/07/dropbox-ui-rewritten-in-qt-
fo...](http://www.webupd8.org/2014/07/dropbox-ui-rewritten-in-qt-for-
latest.html) [3]:
[https://web.archive.org/web/20141015093406/https://forums.dr...](https://web.archive.org/web/20141015093406/https://forums.dropbox.com/topic.php?id=118006)

I consider Qt (along with Gtk+) to be native on Linux -- there's no more-
native toolkit that it's wrapping or emulating.

So I find it interesting that these cross-platform applications (Wikipedia
lists _9_ platforms for VLC!) both use Qt for only 2 platforms, and 1 of those
is where it's native, anyway. These are mature applications which have clearly
put a lot of effort into both user experience and cross platform support, and
they have already gone to the trouble of implementing their UI in Qt, but for
most platforms they choose not to use it.

What I get from this is: Qt is useful as a cross-platform GUI toolkit only for
targeting Windows. Is that overly cynical?

~~~
cpburns2009
It's interesting that it seems Qt is not used to target Macs. Perhaps Qt
really is only good for cross-platform development on Windows and Linux.

------
eivarv
Heck yes. I still don't get how so many creators of apps justify choosing
Electron to themselves, what with all the downsides (resource usage, power
consumption, accessibility, security, and so on).

Another GUI-framework I've enjoyed using is wxWidgets, which provides a thin
abstraction to a platform's native widgets. Has a bunch of language bindings,
and a pretty liberal license as well.

~~~
h1d
What exactly is the security concern by using Electron?

Accessibility is only achieved by the creator's intention.

~~~
eivarv
Well, it brings the usual web security issues to the desktop, dragging with it
much of the browsers' attack surface. Also, there's been a bunch of CVE –
there's one [0] in particular that springs to mind.

    
    
        Accessibility is only achieved by the creator's intention.

That's a problem. Native widgets come with accessibility built in (to the
extent accessibility is supported on the platform in question).

[0]: [https://www.trustwave.com/en-
us/resources/blogs/spiderlabs-b...](https://www.trustwave.com/en-
us/resources/blogs/spiderlabs-blog/cve-2018-1000136-electron-nodeintegration-
bypass/)

------
Memosyne
As much as I enjoy working with Qt, I wouldn't bet on it for the future. QML
support still seems a bit iffy and being told QWidgets are being phased out is
disheartening. The framework is in a sort of limbo stage where newcomers don't
really know how to proceed. The lack of popularity (outside of some niches)
doesn't help either.

I hate working with web frameworks but the network effect is real and not in
favor of Qt. Perhaps there was a time when Qt was thriving and innovating, but
right now it seems like it's just a bunch of fortune 500 companies paying 1-2
Qt developers to maintain legacy software.

Sometimes I wonder if there is an alternate universe where Qt won "the battle"
and made the world a better place. Sadly for us, that didn't happen here.

~~~
iqy
QWidgets are being phased out? What???

~~~
Data_Junkie
No, they are just mostly finished and aren't seeing a lot of new feature work
being done ,if any. Qml is a way better way so that's what they are working
on. It gets better every release, and that guy doesn't have a clue. Sorry.
Just for the record, QML is awesome.

~~~
Memosyne
> they are just mostly finished

Yeah, I don't know how much experience you have with Qt but widgets are far
from being "finished". There's plenty of things that could be improved if
their focus wasn't on Qt Quick.

The use of Qt Widgets is declining (albeit slowly), as stated in
[http://blog.qt.io/blog/2019/01/14/qt-customer-
survey-2018/](http://blog.qt.io/blog/2019/01/14/qt-customer-survey-2018/).
You're telling me that they're going to support two different technologies
that do the same thing without giving preference to the newer, technically
superior one?

Qt Quick is intended to replace Qt Widgets, but it isn't currently at a stage
where that's feasible -- hence my apprehension.

~~~
Data_Junkie
Yeah, that's not true. They have said that Qt4 widgets are feature finished,
and not being deprecated. Obviously eventually there will be little use of the
older way, but they have repeatedly said they are not deprecating them.
Believe what you want.

~~~
Memosyne
I'm aware that they aren't being deprecated, but that doesn't mean they aren't
being phased out. When I say it is being "phased-out" I'm referring to how it
will no longer be advertised as the optimal solution to a problem. Perhaps
we're just arguing semantics at this point?

~~~
iqy
Phasing out is the same as sunsetting, i.e., terminating:
[https://whatis.techtarget.com/definition/sunsetting](https://whatis.techtarget.com/definition/sunsetting)

From the first post, I assumed the commenter meant something like, "in Qt 6
QWidgets will stop working", which is insane.

~~~
Memosyne
I guess it was poor wording on my part then, sorry. I only meant that it was
not going to be the focus of the product anymore.

------
invaliduser
Actually, this is funny because that's literally what I have been doing for
the last 2 startups I co-founded.

The first one was in 2013, so Electron was not an option at the time, I needed
a runtime to run my webapp (in the healthcare industry, for many legal reasons
and budget, I could not and would not have it hosted on the internet, so I
needed it to be a desktop app). At the time it was webkit, and it already was
a great experience. The app was part C++, part Angular1, all the data was
stored locally in a sqlite db. The company is still running, and the app is on
the verge of being rewritten (basically because the new CTO is not much into
C++) with Electron.

Second project, started in 2016, originally a React Native app (IOS and
android), but many customers wanted a desktop/web version. Web was a lot of
work because the app depends on storing data locally (sqlite again), so to
make it fast, I did a first prototype with Electron, spent a week on but I had
many issues with building native nodejs modules, so I dropped it and back
again on Qt, but today it's all chromium-based instead of webkit. So I wrote
the native part I needed in C++ (was fast and easy because the Qt library
covers a lot), bridged it to the application, and the port of the ReactNative
app was completed in less than 2 months.

I like Electron very much, but if you know C++, Qt is great competitor as a
webengine runtime. Of course, I had my share of issues with Qt, but I don't
feel like it would have been really better with Electron, whatever the
framework, there are always issues.

------
cpburns2009
Qt with or without QML should definitely be considered. Granted, I can't say
I've ever made more than a toy application in Qt (via Python and PySide).

A third option if you're too afraid of C++ or one of the Qt bindings, and you
really _need_ something web-like, is JavaFX.

------
tlb
I'm developing something on Electron, but casting occasional glances at Qt
wondering if it'd be better.

It's hard to beat the edit-test-debug cycle of Electron, where I can tweak a
line of code, hit Cmd-R, and see the results in less than a second.

~~~
CarVac
QML is just as fast. If you don't make any changes to the C++ side of things
then there's no recompiling needed.

------
dbla
Does anyone have experience with Proton Native? [https://proton-
native.js.org/#/](https://proton-native.js.org/#/)

Never used it myself but I wonder if it is a more performant alternative to
Electron

------
actf
Does anyone else find Qt difficult to setup/compile and find the qtmoc hoops
that are necessary really frustrating when it comes to compiling projects in a
non standard way?

------
pookeh
Has anyone tried react-native-desktop that uses QT? What are your experiences?

[https://github.com/status-im/react-native-desktop](https://github.com/status-
im/react-native-desktop)

------
zerr
Of course. If it's only for desktops, you should go with Qt Widgets.

------
ctrlaltdev
Well, if I can ditch chromium, I'm all for it. Will look into it.

------
mindcrime
Another option is SWT and the Eclipse RCP.

------
quickthrower2
Also consider Adobe AIR.

------
miguelrochefort
Can Qt run in a browser?

There's your answer.

~~~
eliaspro
Yes, it does: [http://blog.qt.io/blog/2018/05/22/qt-for-
webassembly/](http://blog.qt.io/blog/2018/05/22/qt-for-webassembly/)

~~~
flukus
Looking at the widget gallery ([http://example.qt.io/qt-
webassembly/quickcontrols2/gallery/g...](http://example.qt.io/qt-
webassembly/quickcontrols2/gallery/gallery.html)) I want to complain about
what a waste the 5.6MB download is, but that's probably smaller than a lot of
new sites and most android apps.

I now fear this might become viable and websites will become a black box where
things like ad blockers don't work.

------
johnny22
Qt is brought up in almost every thread where electron is mentioned.

~~~
techntoke
Because it is awesome

