Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. The Lounge
  4. Why not to make QML support loading over net?

Why not to make QML support loading over net?

Scheduled Pinned Locked Moved Unsolved The Lounge
6 Posts 2 Posters 1.5k 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.
  • A Offline
    A Offline
    astreye
    wrote on 2 Dec 2017, 10:32 last edited by A Former User 12 Feb 2017, 14:37
    #1

    The current world is over http, so why not to make QML support loading from a web server, so we can write web page in QML.

    To approach this goal, I think we need to implement the following features:

    1. import qml/javascript over net with absolute/relative|local/remote URL
      • say, with a qml import provider, etc.
      • to recognize a relative URL over net, we need a session manager to keep the URL of current page
      • it's better to support import a explicit qml file instead of the directory, or else we need to handle the case of multi directories import, which in the network situation will be high costly.
    2. support http/https
      • we can also support other custom transfer protocols via custom plugins
      • say, ssh
    3. support multiple QML versions
      • check the compatibility of importing Modules, and give the needed QML library name if the checking fail
      • support loading QML library from the given url, then we can download the needed libraries to local and give it to QML engine
    4. support replacing unsupported Item or the one failed to load with a default empty one but not to crash or throw exception
    5. to provide an item for link
      • or we need to implement this item in a qml file and find a way to tell the root qml reload whole page
    6. a page cache/persistent module is also needed

    I think we need to implement these features in the QML engine to meet the basic requirement of loading QML over net.

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on 2 Dec 2017, 23:23 last edited by
      #2

      You can already implement that on top of the current engine. On the other hand, there is already a global standard for that usecase, with various implementations across all platforms: html et al.

      A 2 Replies Last reply 3 Dec 2017, 05:07
      0
      • A Offline
        A Offline
        astreye
        wrote on 3 Dec 2017, 04:58 last edited by
        #3
        This post is deleted!
        1 Reply Last reply
        0
        • ? A Former User
          2 Dec 2017, 23:23

          You can already implement that on top of the current engine. On the other hand, there is already a global standard for that usecase, with various implementations across all platforms: html et al.

          A Offline
          A Offline
          astreye
          wrote on 3 Dec 2017, 05:07 last edited by
          #4

          @Wieland thanks for your answer, and I'm sorry for posting before reading the doc throughout, I'll try the remote loading.

          1 Reply Last reply
          0
          • ? A Former User
            2 Dec 2017, 23:23

            You can already implement that on top of the current engine. On the other hand, there is already a global standard for that usecase, with various implementations across all platforms: html et al.

            A Offline
            A Offline
            astreye
            wrote on 3 Dec 2017, 05:50 last edited by
            #5

            @Wieland I tried to load a qml file with a single Rectangle via http with qmlscene and it works

            import QtQuick 2.0
            import QtQuick.Controls 1.4
            
            ApplicationWindow {
                id: window
                visible: true
                width: 640
                height: 480
            
                Rectangle {
                    id: container
                    anchors.fill: parent
                    color: "blue"
                }
            }
            

            However, when I add a relative import, it works for local loading, but not work for remote loading:

            # hello_world.qml
            import QtQuick 2.0
            import QtQuick.Controls 1.4
            
            import "sub"
            
            ApplicationWindow {
                id: window
                visible: true
                width: 640
                height: 480
            
                Rectangle {
                    id: container
                    anchors.fill: parent
                    color: "blue"
            
                    Sub {
                        id: sub
                        anchors.left: parent.left
                        anchors.right: parent.right
                        anchors.top: parent.top
                        height: parent.height / 2
                    }
                }
            }
            
            #sub/Sub.qml
            
            import QtQuick 2.0
            import QtQuick.Controls 1.4
            
            Rectangle {
            }
            

            I load the qml with command:

            qmlscene "http://localhost/qml/hello_world.qml"
            

            it throws the error: "http://localhost/qml/hello_world.qml:17 Sub is not a type"

            I think this means that, though QQmlApplicationEngine support loading a remote url, but it doesn't work correctly in importing case. I think maybe it keep the incorrect url for sub directory or it want to import all files under the remote url, which is impossible. I haven't read the QQmlApplicationEngine code and can't make conclusion, but obviously, the current QQmlApplicationEngine can't be used in real work of remote deploying.

            1 Reply Last reply
            0
            • ? Offline
              ? Offline
              A Former User
              wrote on 3 Dec 2017, 12:43 last edited by
              #6

              You can submit a suggestion at bugreports.qt.io to make sure that the framework developers take notice of it (this forum is more for users).

              1 Reply Last reply
              0

              1/6

              2 Dec 2017, 10:32

              • Login

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