Can I mix HTML5 Local application with C++?



  • Can I make an application with UI using HTML5, for localhost application, and make some stuff with C++.
    I will need C++ to send/receive data from USB/SERIAL!
    It's possible to do?



  • Sure, why not? But not in the same .html file :)
    You can use websockets to call your binaries written in c++, or you can create server-side application which evaluates requests from browser and returns html5 as response.

    Write more exact explanation about what you actually want...



  • AcerExtensa, I need to code a Fast UI and HTML I can make all UI's very fast, and another devs can maintain the code easily.
    That's A reason to use HTML5!

    C++, as I said, I will need to develop to capture data from USB/SERIAL, and this data will be treated and show in HTML5 local app. I'm trying to avoid use TOMCAT/Glassfish...

    If I could do what I want using QT, HTML5, JavaScript, XML, XSLT, C++ on a local app will be good enough or me.



  • First of all: are you planing to code html file which will be when accessible over the network with browser, or you want one app which GUI is coded in HTML?



  • I want one app which GUI is coded in HTML!



  • When just use QtWebKit, load HTML file on app-start and create some objects "which will be available from javascript":http://qt-project.org/doc/qt-4.8/qwebframe.html#addToJavaScriptWindowObject

    "Here":http://qt-project.org/doc/qt-4.8/qtwebkit-bridge.html is more info about the QtWebKit bridge



  • AcerExtensa, thank you very much. I will study the brigde!
    But just another question... Can I use something like this:

    main.qml:
    @
    // import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
    import QtQuick 1.1
    import QtWebKit 1.0

    Rectangle {
    id: window
    width: 800
    height: 600

    WebView {
        //url: "http://www.nokia.com"
        url: "html/index.html"
        x: 0
        y: 0
        smooth: false
        anchors {
            top: window.top
            bottom: window.bottom
            left: window.left
            right: window.right
        }
    }
    

    }
    @

    My project:
    @
    /Other files
    /html
    /index.html
    @



  • I use this:

    @
    WebView {
    url: Qt.resolvedUrl( "html/index.html" )
    x: 0
    y: 0
    smooth: false
    anchors {
    top: window.top
    bottom: window.bottom
    left: window.left
    right: window.right
    }
    }
    @

    Appers to work! It's correct?


  • Moderators

    Are you seriously doing a C++ application with a QML UI consisting of one WebView displaying a HTML5 UI?

    I don't really like HTML for UIs in the first place, but if that is your requirement, then you can just use a (C++) QWebView directly.



  • It's not a requirement, but it's gonna be easier to me use HTML5!
    QML is very very powerful, but I couldn't understand how to create an entry app using them!
    I have try here to create something, but appears any errors and I see that will be not easy to learn!
    Well, I will try a little bit more!



  • QML + QtWebKit + HTML5 UI will be very tricky, and you will need to do C++ coding anyway if you need USB/Serial access. So, just use pure Qt C++, subclass QWebView & QWebPage and you can do then anything you want through bridging.


Log in to reply
 

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