slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
16.94k stars 568 forks source link

TabWidget native MacOS style issues #690

Closed cmot17 closed 11 months ago

cmot17 commented 2 years ago

Here is an example of a tabbed view from Handbrake, which matches the system style:

handbrake

Here is what it looks like in the "gallery" example:

gallery

Besides the obvious style differences, the line from the box underneath the tabs is visible in the SixtyFPS version, under the tabs that are not currently selected.

cmot17 commented 2 years ago

These both seem possibly related:

https://bugreports.qt.io/browse/QTBUG-71741 https://bugreports.qt.io/browse/QTBUG-73852

It also seems like the style difference is because Apple changed the native style sometime after Mojave - might be a Qt issue.

ogoffart commented 2 years ago

Yes this looks like a Qt bug.

In the long term, we would like to have a specific rendering backend for Mac that does not use Qt. But this is not really in our priority right now, and it would be a lot of work.

n-raine commented 2 years ago

@ogoffart Would you accept a PR adding native theme(s) to the GL backend?

(This is definitely not a guarantee that I'll make one due to the amount of work required, but I'd be interested in trying.)

ogoffart commented 2 years ago

@n-raine yes of course we would accept. It would be amazing. It's just that this can be a huge task.

There are different way to go with this: either implement a similar enough looking theme in .skint. It won't look exactly native but it might be good enough. Or implement the native style with native code that draw the widgets using calls to the macOs libraries.

Either way, i'd be happy to review or answer questions

n-raine commented 2 years ago

I think I'll go with the first one if possible. One of the many things I like about Slint is that there's very little room for security vulnerabilities; as I understand it, when using the GL backend, almost everything is done in safe Rust, including vector graphics rendering. Adding a native theme to the GL backend would therefore improve security.

tronical commented 2 years ago

when using the GL backend, almost everything is done in safe Rust, including vector graphics rendering.

Unfortunately that's not the case. Basically any call to a GL driver is "unsafe" - the driver can do anything with those pointers to texture data provided.

n-raine commented 2 years ago

I know, I just meant that the vector graphics drawing itself is done in safe Rust (rather than rasterizing on the GPU or in C/C++)

ogoffart commented 11 months ago

The cupertino style is now recommended on macOS. (and that's the default in 1.3) closing issue related to the Qt style on macOS

kekeimiku commented 7 months ago

How did you achieve the native style? Do you need to customize the theme? Why does mine look so different from yours?

image