Search code examples
javascriptc++qtiframedesktop-application

How to embed an iFrame into QT?


I am using Qt with c++ to create a desktop application and I have to embed an iFrame into my application but I am not pretty sure if it is going to work. The iFrame has an application writen in JavaScript that has to communicate with the GUI writen in c++ over Qt.

I know how to do it on Windows using MFC (Microsoft Foundation Classes), as it's explained in this tutorial but I want my application to be cross-platform.

As far as I remember, On Windows I was using the classes IWebBrowser or IHTMLDocument that do something like embedding an Internet explorer navigator into my desktop application. I would like to do the same but cross-platform.

I also would like to know what kind of navigator is going to be embedded (Chromium or Firefox?).

Also I am not just tied to Qt, any other cross-platform tool that allows me to do what I explained would be useful, and better if it is free software.

Any answer that orients me in the right direction would be highly appreciated!


Solution

  • In Qt 5, you may want to use the Qt WebEngine module which

    provides functionality for rendering regions of dynamic web content.

    Basically, you have Chromium at your disposal to be embedded in both qml or widgets applications.

    Moreover, javascript (and html) can interact with the Qt API (both c++ and QML) through the WebChannel module.