Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Feasibility of embedding a QWidget app in a .NET/WPF project?



  • Hi, I'm brainstorming possibilities for integrating my own QWidgets based windows application with a partner's .NET/WPF application. (Two business colleagues having built complementary software tools exploring integration options that don't involve a rewrite.)

    Running two EXE processes and positioning them side by side on screen "works" but is ugly and puts the applications in two memory spaces.

    In a nutshell my question is, is there a known way, is it feasible to turn my QMainWindow app into a "User Control" which the .NET/WFP software application could embed within its own GUI?


  • Moderators

    @pmh4514 That's more of a .NET question. If you were asking the reverse, i.e. can you turn a .NET app into a QWidget inside a Qt app, then it would be a little more answerable here.

    As an tentative answer, yes you could do this. Not so much with Qt but with raw winapi code. It isn't easy and it's probably not a great thing to spend your time on.

    Depending on the size of your buddy's project I think the time would be better spent rewriting the GUI to Qt, or vice versa your GUI to .NET. Being the Qt forums you know which direction I'd prefer if it were my project. ;)

    If your buddy developed his app correctly, separating out logic from GUI, transitioning it to a new GUI like Qt should only be a week or so of work if it's a small-medium sized project. If there is tons of logic embedded in GUI stuff, well then you're looking at a LOT more work and a potential rewrite.

    Finally, I know of no way with Qt directly to encase a window inside a Qt widget. It may be possible but no solution pops into my head.



  • @ambershark
    Thanks for the reply. This is pretty much inline with my thinking just want to be educated on options.




  • Moderators

    @pmh4514 said in Feasibility of embedding a QWidget app in a .NET/WPF project?:

    @ambershark
    Actually, this is interesting:
    http://doc.qt.io/qt-5/activeqt-dotnet.html

    @pmh4514 It is indeed. That may allow him to put your QtWidgets into his window. I don't think it would allow putting a .NET component into a Qt Widget though. But I admit I only skimmed it as my interest in .NET is minimal at best. ;)



  • @ambershark

    mine as well.

    the goal would be to do just that though - drop my QMainWindow into his .NET window.



  • Hi @pmh4514 , did you actually get your project working? We are curious to try just that, embedding a QGraphicsView (or a full QMainWindow) in a WPF GUI. Did it ever work for you?


Log in to reply