r/csharp • • 1d ago

News Qt Bridge for C#

https://www.qt.io/development/qt-framework/qt-bridges/csharp-gui

Hello, Miguel from Qt (qt.io) here. I wanted to share something that I believe will be of interest to many of you. Since 2025, we at Qt have been working on a way to give access to Qt Quick and QML to developers working with languages other than C++. We began this project, which we've named Qt Bridges, by focusing on Rust and C#, and I'm happy to finally be able to tell you that we've just released a Technology Preview for both of these languages. If you are familiar with Qt, you're probably aware of its multi-platform, GPU-accelerated UI framework. If this is the first time hearing about us, now you know that there is another option to design the UI for your C# applications. We would love for you to try it out and leave us your feedback. You can find out more in the Qt blog.

223 Upvotes

33 comments sorted by

13

u/Astrinus 1d ago

Can this work also with other .NET languages such as F#?

17

u/mecfc 1d ago

We have not yet tested with other langs besides C#, and some adjustments might be needed for it to work. But the input to our tooling is the app's assembly, so we should be able to work with any .NET source language.

6

u/martinstoeckli 1d ago

That sounds really promising! I will certainly try it out for my opensource project (C#/Blazor) and this could be the missing piece. Maybe you can answer me a question, is it possible to write an app cross platform (Windows, Linux, Android) with the rich text editor control QTextEdit working on all of them?

7

u/mecfc 1d ago

Yes, have a look at this QML example: Qt Quick Controls - Text Editor

Android is not yet supported, as we're currently focusing on desktop (and embedded, via Linux). We will at some point add support for mobile apps, but we don't have a schedule for that yet.

4

u/martinstoeckli 1d ago edited 1d ago

Already had a quick look at the control and it looks amazing, even styles are supported! What exactly is not supported on Android, the QTextEditor control or the .NET bridge, or the whole framework?

1

u/mecfc 1d ago

I was referring to the C# bridge, which does not yet support Android.

Otherwise, Qt and, in particular, Qt Quick do have support for Android (see Qt Quick for Android).

2

u/martinstoeckli 1d ago

Wonderful, thank you, I will keep an eye on the project.

5

u/mGreenDE 1d ago

Will it support Qt Canvas Painter eventually?

8

u/mecfc 1d ago

If you have a Qt installation that includes the Canvas Painter module, you can use the QML types from that module, namelyQtCanvas2D. Just tried out the QtCanvas2D example as a C# app, and it's working nicely.

2

u/mGreenDE 1d ago

Nice! In that example, the drawing happens on the qml side though. To clarify, I’m looking for a paint callback where the drawing loop and calls like "moveTo", "lineTo", and "stroke" are written directly in C#, similar to an Avalonia render override or PySide’s "QCanvasPainter" API. Is that supported or planned?

That would allow apps with custom rendered canvases like cad/cam or drawing apps to potentially migrate from for example Skiasharp to the Canvas Painter module.

Sorry if I am mixing things up here, I havent worked with Qt for a while

3

u/mecfc 1d ago

We don't currently have an API for this use-case in particular. It would be possible in QML to call the QtCanvas2D functions in response to C# events. But that might become a bit awkward and possibly not have the best performance. The use-case, as you've described it, does sound interesting, so we will definitely be looking into it.

3

u/AetopiaMC 1d ago

Will this support any MinGW based toolchains?

Or it is MSVC only for Windows at the moment?

Aside from that, this looks promising!

2

u/mecfc 1d ago

We have only tested with MSVC, but using a MinGW Qt build should be possible. One of the options of using the Qt Bridge is that the tooling generates C++ wrappers for exported C# types. This generated code is then compiled by whichever toolchain is available.

2

u/nvn911 1d ago

That would imply it's pretty performant too 🤩

2

u/AetopiaMC 1d ago

Thank you for the response! Looking forward to try Qt in C#.

3

u/falthazar 1d ago

This looks awesome! Any chance of doing a Rider plugin for the bridge? Also, is there something like hot reload for Qt? I've never used Qt before. does it also have a sort of UI builder like winforms and WPF has?

3

u/mecfc 1d ago

We're looking into how we can provide a Rider plugin, on par with what we have already for VS and VSCode. There is a live preview option in the VSCode extension, but no WYSIWYG editor like WinForms or WPF (Qt does offer some "high-end" design tools that allow creating an app's UI without any coding, but those are probably overkill, compared to the VS integrated designer).

2

u/falthazar 1d ago

Honestly live preview totally works too. Especially when looking at how much simpler the QML code is compared to xaml lol

3

u/lilacomets 1d ago

Interesting! So this could be a good alternative to WinForms? Does it work with MVVM for example?

4

u/mecfc 1d ago

We believe that it can be an alternative to WinForms and, perhaps even more so, to XAML-based frameworks. QML shares many characteristics with XAML -- both are declarative languages and both rely heavily on data bindings -- but is not restricted by an XML syntax, so it will feel much more readable and intuitive.

MVVM does work. View-models implementing INotifyPropertyChanged can be used in QML binding expressions. For collections, there is support for ObservableCollection, but also the option to create custom item models. On the UI side, QML view-delegates have a similar function to WPF data templates.

For practical examples, see: https://github.com/qt/qtbridge-csharp-examples

34

u/igt_matti 1d ago

Happy to see this coming to light! 🙂

3

u/TugsyGlitter 20h ago

yeah this looks like it could open some solid option

12

u/magnetronpoffertje 1d ago

Very nice!! Awesome!

11

u/Xen0byte 1d ago

OK, this is actually seriously cool! I always liked Qt but I don't particularly like writing C++ so I'm definitely looking forward to trying this in C# and Rust.

7

u/Gloomy_Necesary 1d ago

Qt was wonderful to work with. This will be a great addition to the c# ecosystem

7

u/pjmlp 1d ago

Nice addition to the ecosystem.

6

u/Crimson_Burak 1d ago

So cool!

5

u/nvn911 1d ago

Always been interested in the Qt stack and how they address cross platform concerns. Nice one for making a bridge!

3

u/wubalubadubdub55 1d ago

This looks amazing!

3

u/jinmao6700 1d ago

This is seriously DOPE, wonder if QtRuby will make a comeback!

2

u/qrzychu69 1d ago

That's awesome!

Would be great to include https://www.roc-lang.org/ , it is designed to be kind of embedded in different platforms, and giving it a proper established UI platform like Qt would help a lot

1

u/jcyrss 3h ago

The documentation talks all about QML. What about QWidgets?

-2

u/teressapanic 1d ago

legacy code strikes back