PDA

View Full Version : What's the best way to put a Qt GUI on a webpage?



MattPhillips
11th January 2012, 18:02
I may be overlooking the obvious answer to this, but when I look at QtWebKit, and (by extension, Qt Quick's integration with QtWebKit) it seems to be about embedding a webpage into a Qt desktop application. I want to go in the other direction. I want to take my Qt desktop application and embed it into a website. It seems that there's no direct way to embed a traditional QWidget-based desktop GUI in a webpage, that's fine. Rather I'll have to use components from a different class/module, but which ones? I can use QtSVG for rendering QPaintDevices, which can then be put into HTML5 <canvas> elements, correct? That seems like a relatively straightforward transition, but how do I do it for widgets (push buttons, checkboxes, etc.)?

pkj
11th January 2012, 18:31
Do you know of NaCl of google chrome fame? http://labs.qt.nokia.com/2010/06/25/qt-for-google-native-client-preview/
Even this works only partially. And only for chrome. You seem to aim/want a generic solution. That I can add, on any day, to my Christmas wish list. Java was accused of lack of interest in web technologies back in '95. They went ahead and allayed those fears. Qt never ventured there. Alas.

MattPhillips
11th January 2012, 18:45
Ok thanks I'll look into that but is this really the only (semi-)option? Qt Quick is supposed to be JavaScript/CSS-like, it seems like was designed for this, so there's no way to auto-generate, from a Qt Quick QML file, something that the html5 parser can read? :(

pkj
11th January 2012, 19:08
AFAIK, Qt is a windowing system. And more. But that's just about it. What you are asking for is a web application framework, which is entirely different ball game. There is a library called Wt (Witty) which tries to do dynamic websites using something similar to model view framework of qt. There is qxt library which extends web services using qt.
JavaScript/CSS is something which any big application can have. Thanks to QtScript. Having the ability to script, cannot mean the application is web ready...
But how I wish Qt had web application framework too:(

wysota
11th January 2012, 19:49
You could do web programming with Qt but it requires you to implement, support and ask your users to download and install a web browser plugin, just as we have a browser plugin for Java. What's more difficult is that contrary to Java that runs a virtual machine (so the "executable" is pretty much platform agnostic), Qt apps are compiled for a specific platform (of course this doesn't apply to pure QML apps).

sp27
24th June 2012, 23:35
Hi all, I am new in the forum.
I reopen this discussion to ask if someone has succeeded in using Qt and NaCl.
I've trying to do it for some days following the few guides on web (e.g., http://qt-project.org/wiki/Qt_for_Google_Native_Client), but with no success, I have too many configuration issues.
I've heard that with Qt5 would be easier to use NaCl (http://devworks.thinkdigit.com/Features/Qt-5-Coming-for-Googles-NaCl-as_8287.html), can you confirm this?
Or is there an alternative, for example Wt? My application is based on the Qt example "Elastic Nodes": I have a graph and some dialog boxes.
Thank you.

wysota
24th June 2012, 23:43
It really depends on what you want to do.

sp27
25th June 2012, 10:15
It would be a bit long to explain: my application is the graphical interface of an algorithm over a network. The user can set the parameters via dialog boxes, run the algorithm, and see "the nodes of the network changing color". I use QWidget, QGraphicsItem, QGraphicsScene, QLabel, QString, QPushButton....

Anyway, I'm going to try Wt and then tell you if it was ok or not.

What about Qt5? Can you tell me if NaCl will be "integrated" in it as I have heard?
Thank you!

EDIT: Reading Wt documentation I immediately got that there is no equivalent WGraphics* for QGraphics* ... this seems to make impossible to rewrite my code in Wt.
I wonder if I could I use only widgets... I'll try.

wysota
25th June 2012, 11:06
Wt has nothing to do with Qt apart the API. As output you will get a regular HTML webpage.

sp27
25th June 2012, 11:43
I understand, and I realize I cannot easily convert my code from Qt to Wt for what concerns QGraphics*.
I will study Wt better. My first goal is the reproduce something like the "Elastic Nodes" Qt example in Wt.
Any hint will be appreciated!

wysota
25th June 2012, 12:31
I don't think you can do that in Wt.