Qt / Html 5



  • I have done only native c++ apps in Qt. Following are the things I wants to know.

    1. Is it possible to do the UI in html 5 and logic in c++ just like the case with Qml / c++.

    2. Also I It is possible to do an entire app in Qml / JS. Is it possible to do the same with html5 / JS in Qt.

    3. Is it possible to mix c++ , JS and Html5



    1. Partially "yes". Use WebView QML component for example. You will have big problem however to expose phone functionality to your HTML5. If you really want to use HTML5 instead of QML I think you should use Cordova (http://cordova.apache.org/).

    2. Absolutely yes. You will still need to use auto-generated code to wrap QML/JS into launchable app but basically you can live without writing single line of C++ code yourself.

    3. If you are not interested in Qml use Cordova IMHO. Still I highly advice to learn Qt Quick (QML + JS) - you will love it.



  • Thanks for the answers. I just wanted to know if I can develop a hybrid app (c++ / html5) using Qt if needed. From your answer, it seems not easy. I know of corodova. But what I wanted to know was that if it is possible with Qt. Html5 / css is what the designers know. So that will be most probably used over Qml.



  • That's up to you. If your designer creates CSS and HTML then you are free to choose HTML5. Usually designers just draw how UI should look like and it is up for developers to write code corresponding to the design. In that case QML is better option IMHO.



  • This is not about whether Qml or html is better. I specifically wanted to know if Html / c++ is possible with Qt. Some other frameworks like Mosync allow this. And about html being choosen over Qml, I was not generalizing. I was thinking about the projects I'am going to work on. Sorry for not being clear. For lots of work, and depending on the skillset of the company Qml may be a better choice.



  • As I have said - possible but most probably you will hit the wall pretty fast somewhere (e.g. if you want to upload/download file). That's my opinion - maybe somebody knows about secret ways I'm not aware about.



  • Its ok if the answer is No. I just wanted to know if it is possible.


  • Moderators

    Actually it is pretty straight forward to expose QObjects to the web engine. Javascript can then call slots/Q_INVOKEABLE methods from JS. So you can expose C++ functionality to JS in a pretty straight forward way.

    At least that was the case in Qt 4.6, which is the last time I tried that:-)


  • Moderators

    I really do not see why you would want to do this though: The resulting app is Qt specific anyway, why not use QML then in favor of HTML5?



  • [quote author="Tobias Hunger" date="1360741742"]I really do not see why you would want to do this though: The resulting app is Qt specific anyway, why not use QML then in favor of HTML5?[/quote]

    Being part of Qt, I would have loved to use Qml over html / css. But that decision is out of my control.



  • [quote author="Jayakrishnan.M" date="1360824618"][quote author="Tobias Hunger" date="1360741742"]I really do not see why you would want to do this though: The resulting app is Qt specific anyway, why not use QML then in favor of HTML5?[/quote]

    Being part of Qt, I would have loved to use Qml over html / css. But that decision is out of my control.[/quote]

    You could still make presentation for designers. They might love QML more than CSS. Of course there is question what platforms you are going to support, what timeframe we are talking about and etc. but let's not forget that Digia promised to support Android and iOS in the future as well and actually future in mobile world is very very uncertain.



  • @tobias.hunger
    was it using Qwebkit or Qwebengine ??
    I am struggling to do the same, i.e. make js a bridge between my html and c++. I see a lot of examples using Qwebkit but none related to QwebEngine. As Qwebkit is deprecated, I can't use it.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.