Hacker News new | ask | show | jobs
by Klonoar 2343 days ago
> But those components are not native, meaning they are drawn by Qt instead of using the components provided by the OS.

In the case of macOS, this is no longer true - when Apple finally kicked Carbon fully, Qt (IIRC, in 5.13 or something? 5.12 and prior used HIThemes, which was... showing age) switched to rendering true AppKit behind the scenes. There's a few custom controls where they render their own, if no AppKit equivalent exists, but otherwise it's AppKit all the way down.

As someone who used to decry Qt as not native, I'll be the first to admit it's fine now - if something looks "off" on macOS, it's probably moreso the implementing the author doing something different than the underlying framework.

2 comments

I personally don’t think Qt gives a native feeling in macOS: the look is similar, but the feeling when I get using it... isn’t macOS. Like Emacs style keybindings isn’t supported, I think it’s because the textfield doesn’t get a first responder status... (which is pretty free when programming Cocoa directly).

However I do agree that Qt is much nicer than before, and I can live with them: it’s not like a GTK app in macOS. Qt is def. an improvement compared to the very minimal libui. I’m very excited about that, and so I should get along :-)

Hm, are you sure about that? The documentation[1] for 5.14 still says it uses HIThemes for drawing:

"As with Cocoa and Carbon, Qt provides widgets that look like those described in the Human Interface Descriptions. Qt's widgets use HIThemes to implement the look and feel. In other words, we use Apple's own APIs for doing the rendering."

I guess the documentation could be outdated, but changing over from drawing native-looking widgets to wrapping native widgets (like wxWidgets, SWT and libui) sounds like a big and fundamental (and likely incompatible) change, especially since Qt doesn't do this on other platforms. The release notes[2] don't mention any rewrite of the Mac widget implementation.

[1] https://doc.qt.io/qt-5/macos-issues.html

[2] https://doc.qt.io/qt-5/qt5-intro.html

You're right that we no longer use HITheme to render the macOS style for Qt Widgets, we use AppKit. But it's used to render into pixmaps, so we're not actually wrapping native NSViews.
Ah! Learn something new every day.

My knowledge of that came from digging through the source code over the course of the changes. Great to hear from someone more involved with it - and also, great job on the approach, really glad to see it!