Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Can I mix HTML5 Local application with C++?

    General and Desktop
    3
    11
    12648
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      dcbasso last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • A
        AcerExtensa last edited by

        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...

        God is Real unless explicitly declared as Integer.

        1 Reply Last reply Reply Quote 0
        • D
          dcbasso last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • A
            AcerExtensa last edited by

            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?

            God is Real unless explicitly declared as Integer.

            1 Reply Last reply Reply Quote 0
            • D
              dcbasso last edited by

              I want one app which GUI is coded in HTML!

              1 Reply Last reply Reply Quote 0
              • A
                AcerExtensa last edited by

                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

                God is Real unless explicitly declared as Integer.

                1 Reply Last reply Reply Quote 0
                • D
                  dcbasso last edited by

                  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
                  @

                  1 Reply Last reply Reply Quote 0
                  • D
                    dcbasso last edited by

                    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?

                    1 Reply Last reply Reply Quote 0
                    • T
                      tobias.hunger last edited by

                      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.

                      1 Reply Last reply Reply Quote 0
                      • D
                        dcbasso last edited by

                        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!

                        1 Reply Last reply Reply Quote 0
                        • A
                          AcerExtensa last edited by

                          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.

                          God is Real unless explicitly declared as Integer.

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post