Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to port Qt qml to web server with C++ backend

Tags:

c++

apache

web

qt

qml

Is it possible to write front-end of my application in QML and back-end in C++ and compile it somehow so that I can deploy it to a web-server like Apache or JBoss so that it is accessible from within a web browser ?

If yes, do you have any examples how to perform this ?

Thank you very much for your answers :)

I was trying to find an answer to my question on the Internet but I was not successful.

like image 757
Reshi Avatar asked Jul 29 '13 12:07

Reshi


People also ask

How do I connect QML to CPP?

Connecting to QML Signals All QML signals are automatically available to C++, and can be connected to using QObject::connect() like any ordinary Qt C++ signal. In return, any C++ signal can be received by a QML object using signal handlers.

Can QT be used for Web development?

To create Qt-based web applications, Qt provides interfaces that support a wide range of standard web techologies such as HTML, CSS, and JavaScript. These interfaces enable applications to embed content from the World Wide Web.

What is difference between Qt and QML?

QML is the language; its JavaScript runtime is the custom V4 engine, since Qt 5.2; and Qt Quick is the 2D scene graph and the UI framework based on it. These are all part of the Qt Declarative module, while the technology is no longer called Qt Declarative.


2 Answers

QmlWeb is a JavaScript library that is able to parse QML-code and create a website out of it using normal HTML/DOM elements and absolute positions within CSS, translating the QML properties into CSS properties.

QmlWeb is a small project started primarily by Lauri Paimen who developed it for a few years and is now a KDE project maintained by Anton Kreuzkamp.

QmlWeb of course doesn’t yet support everything Qt’s implementation of QML does, but it already supports a quite usable subset of it. It supports nearly all of the most basic QML syntax. Moreover it has support for HTML input elements (Button, TextInput, TextArea are currently supported, more to come).

Well, QmlWeb is not finished. I hope Digia help with this project to make it ready with mature features.

like image 132
Nejat Avatar answered Nov 03 '22 23:11

Nejat


The javascript currently sits on top of v8 but serves the purpose of expressing complex bindings and some (preferably small) client logic. But the engine could change (http://blog.qt.digia.com/blog/2013/04/15/evolution-of-the-qml-engine-part-1/).

Like in a browser, the actual graphics are kind of orthogonal to javascript which can only interact (or instantiate) with already existing graphical objects. In a browser, the graphics are described by html/css/svg/dom, and interpreted by the web engine written in C++. In QtQuick, the graphics are written in Qml and interpreted by the qml engine (scengraph) written in C++.

The two stacks are completely different.

Exception made of the Html canvas and the Qml canvas (which almost share the same api). But those are graphics working in immediate mode (opposed to a SVG or Qml scenegraph, working in a Retained mode fashion).


That being said...

There are 3 attempts to port Qml to the web:

  • A Qt port to Google Nacl (never heard of it from a long time, most likely dead)
  • Qt port through Emscripten/asm.js (awesome project, but not viable for production, and I don't think QtQuick is even supported... might require a huge effort to be actively maintained)
  • QmlWeb (Javascript apis to translate Qml files and interpret those on top of the HTML5 stack). Work in progress and only a subset of the whole QtQuick ecosystem might be supported in the long term. But still a really interesting project and maybe the most promising of all three. At least, it is the youngest one, and it might get some traction from the KDE community. http://akreuzkamp.de/2013/07/10/webapps-written-in-qml-not-far-from-reality-anymore/

You might also be interested in other scenegraphs technologies sitting on top of the web stack (amino, cake.js, rapahel.js...).

Last but not least, you might be interested by Wt (http://www.webtoolkit.eu/wt).

like image 23
QuidNovi Avatar answered Nov 04 '22 00:11

QuidNovi