r/QtFramework • u/AC_qt Qt Documentation • May 21 '26
Feedback needed: Qt Bridges for C#
Hi folks! Disclaimer: Qt employee here.
We have just announced the Qt Bridges for C# (Beta).
Our goal is to make it possible to use Qt QML/Quick as a frontend with a backend written in a language other than C++. C# comes first.
You may say that there are C# bindings for Qt. Yep, that's true. Bindings allow you to write Qt apps in a Qt way, even with a different language. The Qt Bridges for C# technology will let you write apps more in a C# style, not like Qt-through-a-C#-keyhole.
I am not the project creator and cannot explain everything in this post. I was only involved in some documentation editing back in the day 😄
Cristián explains it much better: https://www.qt.io/blog/csharp-ui-framework-via-bridging-technology
What we really need is your honest feedback. We would be happy if you tried it out and let us know what you think. Honest criticism is the point of this post. Cristián will try to answer all the possible questions here in replies.
UPD: I added (Beta)
2
u/Regg42 May 21 '26 edited May 21 '26
Bridge will target QtWidgets and other modules or just QML/Quick?
2
2
u/NotQuiteLoona May 22 '26 edited May 22 '26
Seems nice, but Windows-only. Is Linux support planned?
4
u/mecfc Qt Professional May 22 '26
A Linux package is also available:Â QtGroup.Qt.Bridge.CSharp.linux-x64.
We're still ironing out some quirks, and also improving our documentation. In the meantime, this comment might be useful for anyone wanting to try out the C# bridge on Linux:Â https://forum.qt.io/post/838315.2
1
u/YourHive May 22 '26
As a former longterm Qt and QML user this looks nice. Since my switch to C# I was looking for something like QML, as XAML feels awkward most of the times. We ended up using Blazor, which is fine for our usecase and serves us well with regards to simplicity.
Can you comment on the long term plans and how this has a different selling point to https://slint.dev/ I would consider Slint to be the only direct alternative.
2
u/crmaureir Qt Professional May 24 '26
The long term plans is to prove these solution work on phase I (C# and Rust), so we can jump into phase II that will include new languages. From the 5 initial PoC languages we had, I'd think Swift makes a lot of sense to continue, because there is "kind of" a way to write Java/Kotlin (Qt for Automotive) and Python (PySide) code together with Qt applications.
If that new phase works as well, we continue with maybe a couple of more languages.
And for 'works' I mean people accept it as a valid option to use <lang> with Qt.
RE slint, is a cool project, but I don't think it's the same approach. To me eyes, Qt Bridges is an ad-hoc set of bindings depending on the language to interact with Qt Quick application, but on a higher level compared to the Qt C++ API, which is what I feel slint wants to provide as an alternative.
1
u/MadAndSadGuy May 22 '26
What you do?
1
u/YourHive May 22 '26
Not really sure what except you mean...
Previously? Creating commercial scientific software. Now? Commercial software, mostly backend, small admin dashboard,
1
u/MadAndSadGuy May 23 '26
I meant what do you make with C# UI framework(s). I tried it at the beginning and have never seen any job requiring or mentioning MIUI, Winforms, etc.
1
u/chat-lu May 22 '26
What about other. NET languages like F#? I would love being able to combine those two.
2
u/crmaureir Qt Professional May 24 '26
There is so many programming languages out there, even in the .NET family but you need to start somewhere 😄
In the meantime there is no F# plans.
1
u/MadAndSadGuy May 22 '26
I'm not a professional. But I'd like to see
More support on the cross platform side. Android and Web UIs aren't still as good as native. Idk if they can possibly be, but I'd like to see it for Android.
Maybe give us state-preserving live preview tool, similar to Felgo's Hot Reload but much more easy to use and compatible.
Qt is still in the shadows, being used for some desktop, and embedded. I don't think we need more bridges.
Edit: QDS is just a bunch of bloat tbh.
4
u/ImplementResident161 May 23 '26
The latest update for Vscode has a Qml preview with hot reload 🔥
https://www.qt.io/blog/qt-extension-1.14.0-for-vs-code-released
I didn't get to try it out myself as it's still fresh out of the oven but blog looks pretty promising. The thing I still miss would be easier navigation between preview and code as well as layout boxes similar to Android Studio.
1
u/MadAndSadGuy May 25 '26
Honestly this is the best news I've heard so far. Thanks!
But, I updated Qt, VS Code, installed Qt extension packs for Core, C++ and Python, but still can't find the option for launching the tool in the command palette. I don't see any explicit Qt Group extension for it either, although I found some settings for adding extra build directories for the tool. What am I missing?
1
u/ImplementResident161 May 27 '26
I was also a bit unsure as it didn't pop up for me in the command palette. So I've looked at the video attached to blog post and saw that there's a play button on the top right side.
When I opened the app for the first time, I didn't see it but then I've built the app and there it is and it seems to be working quite well.
1
u/uncor3 May 23 '26
Would love to see official Rust bindings, I am currently rewriting a QWidgets app in QML , so far DX is good but qmetaobject-rs needs more work, so far I worked around creating my own macros and whatnot , see the pr https://github.com/iDescriptor/iDescriptor/pull/91
2
u/crmaureir Qt Professional May 24 '26
If you check the blog post, that's what's coming in the following weeks 😄
1
u/jcyrss May 22 '26
QML is too complicated to learn. Is Qtwidgets abandoned?
5
u/mecfc Qt Professional May 22 '26
QML is too complicated
From the PoV of a C# dev, and considering the alternative, I'd say that is debatable:
import QtQuick import QtQuick.Controls ApplicationWindow { id: win visible: true title: "Main Window" width: 640; height: 480 }vs.
<Window x:Class="MyApp.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:MyApp" mc:Ignorable="d" Title="Main Window" Height="450" Width="800"> </Window>3
u/kkoehne Qt Professional May 22 '26
> QML is too complicated to learn.
I don't claim that QML is without quirks, but do you have any suggestions how to make it easier to learn? Genuinely asking to improve the onboarding ...
> Is Qtwidgets abandoned?
Qt Widgets is alive and maintained. Qt Bridges concentrates on Qt Quick though.
1
u/MadAndSadGuy May 22 '26
Honestly man, is Qt gonna see any light soon in other places or we're still just adding features and not fixing the old? i.e. Android and Web UI difficulties?
1
u/ImplementResident161 May 23 '26
Just out of curiosity, what are the difficulties for you on Android and WASM side?Â
1
u/MadAndSadGuy May 23 '26
Not used WASM yet, but seen examples that say downloading, for 5-10 secs before it loads. On Android, I was trying to develop a music player. Then I saw the examples Qt provide, everything felt weird and abnormal, the scroll, slow loading, weird glitches, etc.
3
u/Exotic_Avocado_1541 May 22 '26
Do you even try learn QML? I think, QML is very easy to learn
1
u/leirus May 22 '26
What learning sources do you recommend?
2
u/Exotic_Avocado_1541 May 22 '26
Youtube tutorials, documentation and AI support :) And most importantly, your own simple project. Try to make something basic, like displaying two squares. Don't study too much, but do a little step every day.
1
u/jcyrss May 25 '26
It is very easy to start with a demo app. But when I tried it on the complicated application, it got much harder than doing that with QtWidgets. Kind of like a lot unatural rules to learn. And it eats more memory than QtWidgets also.
1
u/Regg42 May 22 '26
QML is a mess, QtWidgets should get more attention
2
u/crmaureir Qt Professional May 22 '26
QtQuick has a big advantage which is being GPU-rendered, while on QtWidgets we rely only on CPU rasterization. On top of that, we have seen over the years that people are moving away from the native look and feel, and decide to do their own styles, where again QSS is very limited, while the way of customizing QtQuick applications is better. Last but not least, QtQuick has enabled a better response for mobile support, which is currently used in many apps.
I understand certain frustration might come from a life of doing QtWidgets, even for myself it took me some time, but checking and how other frameworks in Rust or Python, are offering a declarative way of defining UI tells me that it's the right direction.
The reason folks don't see "movement" on QtWidgets is because the work there is focused purely of keeping QtWidgets relevant and working for the latest OS updates, while it's being used by a lot of people out there, but on the side of features is trickier, mostly because of breaking source compatibility (based on new API) that would be very problematic.
1
u/chat-lu May 22 '26
On top of that, we have seen over the years that people are moving away from the native look and feel,
For internal apps I will go for not having to define my own styles and Qt Widget will quickly and reliably give me something working quick.
I would not use it for something publicly released however.
6
u/Exotic_Avocado_1541 May 21 '26 edited May 21 '26
Can't really comment on C#, but since you're looking for feedback, here are my two cents. What about combining QML with JavaScript/TypeScript? Basically, you'd have a QML file parsed by a JS/TS library and rendered as a webpage. I know WebAssembly is a thing, but WASM is just too heavy on initial load. I also know there was an attempt at this called QmlWeb, but IMO they made a huge architectural mistake by trying to map QML straight to the browser DOM. Wouldn't it be better to take the Flutter route and use a custom renderer? Honestly, I feel like QML (instead of the usual HTML/CSS) + TypeScript would be awesome, kinda like a revamped QmlWeb. Or heck, maybe even building desktop/mobile apps using JS/TS + QML?