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. [SOLVED] Cross-process UI interactions (Qt 4.8, Windows)
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Cross-process UI interactions (Qt 4.8, Windows)

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 4.6k Views 1 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.
  • P Offline
    P Offline
    PEspie
    wrote on last edited by
    #1

    Hi All,

    I'm quite new on Qt platform, sorry if I ask for some trivial questions (you can kick me to HOWTO if I've missed some ;)

    I need to create a system to permit the creation of plug-in in our application, which is obviously written with Qt.
    The requirement are simple:

    • Plug-in should live in another process (for security/stability reasons)
    • Plug-in should have access to at least a QWidget (I guess that behind, it will be a class derived from QWidget) to plys with (add it own widgets, draw inside, etc.)

    On other words, I would need a kind of screen server (in my app) and a screen client (in my plug-in). The last one should be perfectly transparent for the plug-in.

    There is an old demonstration wrote by "Marius" (I guess a kind of Qt God?) which do exactly what I need here: "A Lighthouse with Windows":http://labs.qt.nokia.com/2010/02/10/a-lighthouse-with-windows/ but the code is quite old (2010/02) and does not compile at all on Qt 4.8 version.

    It seems that all this is working on Linux, but I can't choose the platform: it's Windows.

    Any suggestion are welcome!

    Thanks a lot
    PEspie

    1 Reply Last reply
    0
    • R Offline
      R Offline
      rcari
      wrote on last edited by
      #2

      Because you need to isolate the plugin in another process you'll have to deal with Inter Process Communication (IPC).
      On Windows there are two ways of doing this with Qt: shared memory and sockets. Shared memory can work but it's usually overkill to implement or maintain... You should maybe look at TCP/IP and design some sort of client/server protocol for the plugin to interact with your main application.

      Otherwise, I think you can use Windows native SendMessage/PostMessage to do some remote calls across processes given a window handle.

      1 Reply Last reply
      0
      • R Offline
        R Offline
        rcari
        wrote on last edited by
        #3

        Another option could be to create the child process using QProcess and use stdin/stdout streams to communicate with it. Some more protocol needed :)

        1 Reply Last reply
        0
        • P Offline
          P Offline
          PEspie
          wrote on last edited by
          #4

          Thanks for your answer.

          We finally choose to use some IPC for communication between processes, but the real challenge was the display ... how to display from a process into another process window ?

          This was solved by using, on Windows platform, the API function ::SetParent which permit to attach a window as a child of another window. This works across process boundary, so our problem is solved.

          Once again, thanks!

          1 Reply Last reply
          0
          • F Offline
            F Offline
            francois
            wrote on last edited by
            #5

            Pespie,

            I have to execute a QWidget (in fact a QAxWidget) into an other process to protect my application from ActiveX crashes.

            If I understand well, you used the SetParent() function to attach two widgets running in two different processes and then created an IPC protocol to handle signals, slots, method calls, etc... Am I right ?

            Thanks

            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