slint icon indicating copy to clipboard operation
slint copied to clipboard

Default backend selection depending on platform

Open ogoffart opened this issue 2 years ago • 7 comments

Don't have Qt by default on non-linux

Make skia the default on non-wasm (but unfortunately still builds femtovg by default)

In order to have default feature dependent on the platform, one must use an intermediate crate

ogoffart avatar Oct 11 '23 06:10 ogoffart

I'm putting this up for discussion. But I actually don't think it is a good idea to merge as is, because it will slow down compilation by building both skia and femtovg. Also Qt is the default but usually doesn't get enabled on Win and Mac anyway because it's not installed usually.

ogoffart avatar Oct 11 '23 06:10 ogoffart

Yeah, I guess in practice this is a no-op on macOS, Windows, and wasm.

I acknowledge that once rust-skia built-in binaries don't apply, the barrier of entry for trying Slint increases a lot - and then the build time goes by a lot, too. The big advantage of femtovg is that it's the opposite: a super low barrier of entry for trying out Slint.

In my experience so far, we end up two tiers: It's easy to get going right now (especially if you don't have Qt installed) and for some users that's enough. And often for others we recommend "upgrading" to Skia, at which point it is a conscious choice and trade-offs are evaluated. I have the feeling that we could keep going with this strategy for a little longer.

The topic of the Qt backend is an entirely different one (with other issues such as complicating cross-compilation) and I think if we want to make changes there we need to agree on the styling first.

tronical avatar Oct 11 '23 08:10 tronical

I think if we want to make changes there we need to agree on the styling first.

What do you mean agree on the styling? I though we already agreed in https://github.com/slint-ui/slint/issues/3431 (which is implemented: Qt is no longer the default style even if Qt is found on windows and mac)

ogoffart avatar Oct 11 '23 08:10 ogoffart

I think if we want to make changes there we need to agree on the styling first.

What do you mean agree on the styling? I though we already agreed in #3431 (which is implemented: Qt is no longer the default style even if Qt is found on windows and mac)

Sorry, that came across wrongly. I'm only talking about Linux now. According to https://github.com/slint-ui/slint/issues/3431#issuecomment-1729684329 we need the Qt backend, which comes with benefits and trade-offs. Over time the benefits and trade-offs change, and so if we ever end up discussing those again, then it's possible that in the future we come to a different conclusion and perhaps technical solution as we did in #3431 . If that conclusion implies that we don't need the Qt style by default anymore, then what I was referring to talking - possibly making the qt backend not the default anymore on Linux - will become affected. Anyway, this isn't news - I don't to suggest changing anything in this PR. With this comment I merely want to clarify what I think we agree on: We can only make changes to the default Qt backend choice on Linux if we make changes to the default styling choice on Linux.

tronical avatar Oct 11 '23 08:10 tronical

Note that a similar trick was done for the qt backend o linux only #4566 Now this PR is outdated but the question is whether skia should be the default backend.

ogoffart avatar Jun 10 '24 06:06 ogoffart

Now this PR is outdated but the question is whether skia should be the default backend.

Since Qt is the default backend on Linux, that would mean either

  1. We make Skia work with the QWidget (possible by choice of software rendering)

or

  1. Skia would be the default renderer on macOS and Windows, on Linux QPainter would remain the default renderer

Either way, FemtoVG would remain the default for WASM builds.

tronical avatar Jun 10 '24 14:06 tronical

  1. Skia would be the default renderer on macOS and Windows, on Linux QPainter would remain the default renderer

Yes. ... and femtoVG the default on wasm. (... and skia the default on linux if Qt is not found and always built)

ogoffart avatar Jun 10 '24 16:06 ogoffart

Qt is already no longer built on non-linux. Changing the default renderer is not a good idea as skia is harder to build.

ogoffart avatar Apr 23 '25 16:04 ogoffart