Search code examples
c++windowsqtwebkit

QtWebkit as a desktop application GUI


I was wondering if anyone knows about good tutorials or articles describing methods of creating an HTML GUI for an application using QTWebKit for a windows desktop application.

I am mainly concerned about communicating messages, events and information between lets say a DLL(written in C++ for example) and the GUI (QtWebKit).

need good reliable references...


Solution

  • This won't be easy: Web browsers are fortresses because of security concerns. So it's pretty hard to get from JS in a web page to something outside of the browser.

    Also, QtWebKit isn't a very open API. The biggest obstacle in your case is that it doesn't offer you access to the DOM, so you can only replace the whole HTML.

    Therefore, you'll need to patch and write a lot of code to implement the missing APIs and functions.

    Since Qt 4.6 has been released, there is QWebElement (see the docs for examples), so you can at least access the DOM and modify it. That will make a lot of things more simple. I suggest to decide who controls the browser: Will your app be JavaScript which calls outside or is the app really in C++ and you use the browser as a smart UI renderer?

    A much more simple way might be to make your idea work would be to start an internal web server when your app starts and then open a QtWebKit view pointing to the URL of the local server. Then, you could use all the standard web development tools. Eclipse uses this technique for its internal help system.