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. Share Qt classes between two Qt app?
Qt 6.11 is out! See what's new in the release blog

Share Qt classes between two Qt app?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 1.5k 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.
  • M Offline
    M Offline
    Mr Pang
    wrote on last edited by
    #1

    Imagining that I have two Qt apps running. The first one creates a Qt class QDir,for example:
    QDir dir("/");
    Can I send "dir" to another app?
    Or how does another app access "dir"?

    kshegunovK 1 Reply Last reply
    0
    • M Mr Pang

      Imagining that I have two Qt apps running. The first one creates a Qt class QDir,for example:
      QDir dir("/");
      Can I send "dir" to another app?
      Or how does another app access "dir"?

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by
      #2

      @Mr-Pang
      Hello,
      When you want to share classes, you put them in a library (usually a dynamically loaded one) and export them from it. Each application then uses that library and the classes contained within,

      Kind regards.

      Read and abide by the Qt Code of Conduct

      R 1 Reply Last reply
      0
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by mrjj
        #3

        Hi
        To add to @kshegunov , if you want two apps to share data, you can also use
        QSharedMemory as shown in the
        Shared Memory Example
        http://doc.qt.io/qt-5/qtcore-ipc-sharedmemory-example.html

        Also, a low tech version could also be via
        parameters
        http://doc.qt.io/qt-5/qcommandlineparser.html
        Even if one app is allowed to start the other.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          Mr Pang
          wrote on last edited by
          #4

          Thanks. This tip seems useful.

          1 Reply Last reply
          0
          • kshegunovK kshegunov

            @Mr-Pang
            Hello,
            When you want to share classes, you put them in a library (usually a dynamically loaded one) and export them from it. Each application then uses that library and the classes contained within,

            Kind regards.

            R Offline
            R Offline
            Rondog
            wrote on last edited by
            #5

            @kshegunov said:

            @Mr-Pang
            Hello,
            When you want to share classes, you put them in a library (usually a dynamically loaded one) and export them from it. Each application then uses that library and the classes contained within,

            Kind regards.

            I think the data is what is required to be shared. A library file won't help in this area without something elaborate going on inside (like QSharedMemory or equivalent).

            kshegunovK 1 Reply Last reply
            0
            • R Rondog

              @kshegunov said:

              @Mr-Pang
              Hello,
              When you want to share classes, you put them in a library (usually a dynamically loaded one) and export them from it. Each application then uses that library and the classes contained within,

              Kind regards.

              I think the data is what is required to be shared. A library file won't help in this area without something elaborate going on inside (like QSharedMemory or equivalent).

              kshegunovK Offline
              kshegunovK Offline
              kshegunov
              Moderators
              wrote on last edited by
              #6

              @Rondog
              Yes, I realized that after @mrjj's post but was reluctant to change my original comment after the fact.

              Read and abide by the 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