Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Transferring data between two QtQuick apps and local storage
Forum Updated to NodeBB v4.3 + New Features

Transferring data between two QtQuick apps and local storage

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
6 Posts 2 Posters 419 Views 2 Watching
  • 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.
  • Q Offline
    Q Offline
    qcoderpro
    wrote on last edited by qcoderpro
    #1

    Hi all,
    I've got two questions.

    1. If we want to create two qml apps named clientApp and serverApp running at the same time so that we can send messages from the client to the server app, is the following route correct to pass, please?

    In the server app:
    we firstly provide an IP address and port number. Then using a QDataStream in try to get the message sent from the client app and set it to a label.

    In the client app:
    we find all the ip addresses and among them select the one shown by the server already plus a port. Then define a QDataStream out to send a message to the server app.

    1. Since Qt Quick offers only limited ways of storing local data directly, and in this sense, it acts more like a browser and in many projects storing data is handled by the C++ backend and the required functionality is exported to the Qt Quick frontend side, (from Qt QML 6 book), if we have a Qmap<QString,QString>, how to store and retrieve it to/from local storage at the back-end part (C++), please?
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Are these two applications running on the same machine ?

      If so write your backend to use QLocalSocket/QLocalServer and if not QTcpSocket/QTcpServer. I don't see a reason to store anything on disk in between.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      Q 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Are these two applications running on the same machine ?

        If so write your backend to use QLocalSocket/QLocalServer and if not QTcpSocket/QTcpServer. I don't see a reason to store anything on disk in between.

        Q Offline
        Q Offline
        qcoderpro
        wrote on last edited by
        #3

        @SGaist

        Yes, the apps run on the same machine but I'd like to use QTcpSocket/QTcpServer not just to handle that functionality but this way also to get started learning using them practically. Now is the scenario (described in #1) right, please?

        As for storing data on secondary memory/disk, I need it for another QtQuick project where it's required to store data in a QMap and then be able to retrieve them when needed. What method do you suggest to be used at the back-end for that purpose, please?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Both can be drop in replacement for each other so you can start locally and once you have everything running for the client server part, you can add networking.

          Can you explain how that secondary application is supposed to work ? Reading and writing to a file from two different application has its own challenge in terms of synchronisation.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          Q 1 Reply Last reply
          1
          • SGaistS SGaist

            Both can be drop in replacement for each other so you can start locally and once you have everything running for the client server part, you can add networking.

            Can you explain how that secondary application is supposed to work ? Reading and writing to a file from two different application has its own challenge in terms of synchronisation.

            Q Offline
            Q Offline
            qcoderpro
            wrote on last edited by
            #5

            @SGaist

            Probably I should have posted the question #2 in another thread, but I though the answer would be simple so asked that also here alongside the question about networking.
            Anyway, let's get it straight and as simple as possible. You have a qml app running on , say, an Android device. The user adds some elements at the front-end. Each element consists of a name and some texture description. In the back-end, we use a QMap<QString,QString> to store data into. Then the user exits the app and tomorrow re-runs it. He should be able to see the data saved in the back-end yesterday.
            I hope it's now clear.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              So in fact, it's just some kind of setting of the app ? If so, just use QSettings.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              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