Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Can I mix HTML5 Local application with C++?
QtWS25 Last Chance

Can I mix HTML5 Local application with C++?

Scheduled Pinned Locked Moved General and Desktop
11 Posts 3 Posters 13.2k Views
  • 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 Offline
    D Offline
    dcbasso
    wrote on last edited by
    #1

    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
    0
    • A Offline
      A Offline
      AcerExtensa
      wrote on last edited by
      #2

      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
      0
      • D Offline
        D Offline
        dcbasso
        wrote on last edited by
        #3

        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
        0
        • A Offline
          A Offline
          AcerExtensa
          wrote on last edited by
          #4

          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
          0
          • D Offline
            D Offline
            dcbasso
            wrote on last edited by
            #5

            I want one app which GUI is coded in HTML!

            1 Reply Last reply
            0
            • A Offline
              A Offline
              AcerExtensa
              wrote on last edited by
              #6

              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
              0
              • D Offline
                D Offline
                dcbasso
                wrote on last edited by
                #7

                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
                0
                • D Offline
                  D Offline
                  dcbasso
                  wrote on last edited by
                  #8

                  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
                  0
                  • T Offline
                    T Offline
                    tobias.hunger
                    wrote on last edited by
                    #9

                    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
                    0
                    • D Offline
                      D Offline
                      dcbasso
                      wrote on last edited by
                      #10

                      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
                      0
                      • A Offline
                        A Offline
                        AcerExtensa
                        wrote on last edited by
                        #11

                        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
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved