Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved Remote graphics over network

    General and Desktop
    5
    28
    6593
    Loading More Posts
    • 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.
    • H
      Harry123 last edited by Harry123

      My question is motivated by my wish to package a Qt application inside a Windows Docker image. In Linux this easy enough to do using X11 sockets, but not in Windows.

      The problem here is that recent Docker images released by Microsoft do not contain any GUI. This includes omitting any graphic support or Remote Desktop, so the only possible interface is via the console. This is probably by design, as Microsoft did demonstrate this capability in early versions of Windows Server 2016 in a demo, but which has since disappeared completely.

      My question is whether there exists any support or project that will let me run a Windows Qt program inside a Windows container (which is basically a headerless server), connected over the network to another program that acts as its graphical and user-interface front-end.

      This is basically enabling in the Windows environment the capability for having server and graphical-client, and such a utility would have more uses than just for Docker. As Docker usage is currently rocketing up, I believe that Qt can become relatively easily the world's only solution for containerizing Windows GUI programs.

      Any ideas ?

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        Maybe the VNC or WebGL backend could be of interest here.

        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 Reply Quote 1
        • H
          Harry123 last edited by

          @SGaist said in Remote graphics over network:

          Maybe the VNC or WebGL backend could be of interest here.

          I have checked out both of them already and they don't fit the bill. VNC requires a desktop which Windows containers don't have, and WebGL is browser-side - it could be used but would require a development effort and the result would still be limited to the browser as canvas and will not have a native look.

          It seems to me that Qt could implement the graphical display part, server to client, either by switching all widget surfaces to QPixmaps or by an adaptation of the double-buffer mechanism. The Qt architecture should be of great help here.

          For the event-passing part, client to server, there aren't that many events: mouse, keyboard, focus are the majority of useful ones.

          For the communication mechanism we could use TCP , same as is done in Linux X11.

          This project seems entirely feasible in Qt. Was something like that ever implemented, even partially? Or perhaps the developers could become interested in a new challenge?

          1 Reply Last reply Reply Quote 0
          • mrjj
            mrjj Lifetime Qt Champion last edited by

            Hi
            But is GDI even supported ?
            It sounds like its console only and hence a normal Qt program would have zero change of running. ?

            1 Reply Last reply Reply Quote 1
            • J
              JohnSmithFromBritain last edited by

              My dearest Harry, I must ask, what are the benefits of using a stripped-down, no-GUI Windows Docker image versus just using a Linux+X11 Docker image where Qt apps would already presumably work? I could surely see such a Windows Docker image being very useful for running Windows console apps or Kestrel ASP.NET web apps. But is there a business reason, for example, that prevents a Linux Docker image from being used instead of these apparently very limited Windows Docker images?

              1 Reply Last reply Reply Quote 1
              • H
                Harry123 last edited by Harry123

                @mrjj :

                If the Qt program transferred its screen buffer or QPixmap to the GUI client, the client will display it. This would be as good as GDI.

                @JohnSmithFromBritain :

                The benefit would be to offer Windows GUI programs a migration path to Docker, where currently there is none. There are innumerable Windows programs that will never be ported to Linux. A Docker image is a magnificent way of deploying products and their dependencies with no installation required. In the future, Linux and Windows containers could surely be mixed, and Qt could be one of these future solutions.

                1 Reply Last reply Reply Quote 0
                • SGaist
                  SGaist Lifetime Qt Champion last edited by

                  QPixmap is for representing something to the screen which requires access to the graphic stack. Something that is likely not available from your description.

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

                  H 1 Reply Last reply Reply Quote 0
                  • H
                    Harry123 @SGaist last edited by Harry123

                    @SGaist

                    The idea would be to present it on a remote graphic screen. After all, the QPixmap contains pixels, and these can be presented on any graphical surface. It's only necessary to transfer the pixels over the network to where they can be processed, so to do nothing else in the generating server, as if the non-existent display was done.

                    The pixels would be generated by Qt but processed by the graphical client. That client itself does not need to be programmed using the Qt libraries, this being an overkill, but can be a small native program.

                    This way Qt does not need to be installed on the client computer but only in the Docker container. The idea here is to deploy the user program with its dependencies, which includes Qt, all as one unit that requires only Docker to execute. The user program can then be executed without installing nothing at all on the client computer, by one Docker command-line.

                    This is deployment simplified to the limit. I believe that in the near future it will replace the actual forms of deployment which require painfully installing and correctly configuring packages required by programs. Programs will this way come prepackaged as images with their dependencies and ready for instant execution.

                    This is a very primitive design of the architecture I advocate as regarding graphics:

                    Docker container
                    ------------------
                    | User program   |
                    | Qt libraries   |
                    -----------------
                        |
                        v
                      Pixels
                        |
                        |  (network)
                        v
                    --------------------
                    | Graphical client |
                    --------------------
                        |
                        v
                    Client screen
                    
                    1 Reply Last reply Reply Quote 0
                    • hskoglund
                      hskoglund last edited by

                      Hi, I had a similar problem: supporting legacy16-bit Windows GUI programs while switching to 64-bit Linux, I installed Wine and the .exe files start just fine.

                      H 1 Reply Last reply Reply Quote 1
                      • H
                        Harry123 @hskoglund last edited by Harry123

                        @hskoglund

                        This question is not about making a Windows program work on Linux (and in any case not all Windows programs work correctly on Wine and not all dependencies are portable).

                        The question is about making Windows programs work on Docker in the context of Docker images built upon a Windows operating system.

                        I believe that in the coming decade Docker will cause a complete redesign of the architecture of operating systems and how products are deployed. The problem is that not many people are aware of the magnitude of the change. Even Microsoft, which started with pushing Hyper-V as a contender to Docker, has now joined it with great enthusiasm.

                        1 Reply Last reply Reply Quote 0
                        • mrjj
                          mrjj Lifetime Qt Champion last edited by

                          Hi
                          if you have access to a win docker. have you tried a QPixmap + CoreApp ?
                          Could be fun to know if that even works.
                          As far as i understand running GUI apps on win dockers is a no go until MS fixes it.

                          H 1 Reply Last reply Reply Quote 0
                          • H
                            Harry123 @mrjj last edited by

                            @mrjj

                            I don't think I have enough Qt knowledge for this project. I didn't even know about QCoreApplication.
                            But as you say, this can be a fun project for a Qt developer, which will in addition help in motivating Windows products to migrate to Qt.

                            mrjj 1 Reply Last reply Reply Quote 0
                            • mrjj
                              mrjj Lifetime Qt Champion @Harry123 last edited by

                              @Harry123

                              Well, it seems there is no gfx stack included making it
                              huge task to do it and most likely will be impossible until MS makes it possible.
                              That is why i wanted to test if pixmap works. :)

                              H 1 Reply Last reply Reply Quote 0
                              • SGaist
                                SGaist Lifetime Qt Champion last edited by

                                QPixmap requires a QGuiApplication at least.

                                I'm not sure I follow your argument against the VNC backend.

                                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 Reply Quote 1
                                • H
                                  Harry123 @mrjj last edited by

                                  @mrjj

                                  Perhaps I'm looking at it too simplistically, but it seems to me that a graphical shell is not required to generate pure pixels in the program's memory. Qt has most of the required software, and if it may rely for some graphical operations on the operating system, existing open-source libraries can surely substitute.
                                  Whatever graphical information Qt may require, such as screen size and resolution, can be communicated by the graphical client from its own environment.
                                  Certainly some adjustments may be required in the core libraries of Qt, which is why I believe a more knowledgeable developer than myself is required.

                                  @SGaist

                                  VNC presents the desktop, while a Docker Windows container does not have a desktop. It may only have consoles, either Cmd or PowerShell. You may liken the Windows Server under Docker to a Linux server without X.

                                  1 Reply Last reply Reply Quote 0
                                  • SGaist
                                    SGaist Lifetime Qt Champion last edited by

                                    I didn't talk about running a VNC server in a Windows docker.

                                    I am talking about the Qt VNC backend which lets you connect a VNC client to your application to visualise its content.

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

                                    H 1 Reply Last reply Reply Quote 1
                                    • H
                                      Harry123 @SGaist last edited by

                                      @SGaist

                                      I don't understand - if the app is running in the Docker container, there's no graphical surface to visualize, or at least not one created by Windows. I don't think that VNC creates its own canvas, or otherwise it could support multiple sessions, while currently it only mirrors the desktop created by Windows.

                                      1 Reply Last reply Reply Quote 0
                                      • SGaist
                                        SGaist Lifetime Qt Champion last edited by SGaist

                                        As I already wrote: not the VNC application. VNC doesn't require a physical display.

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

                                        H 1 Reply Last reply Reply Quote 1
                                        • H
                                          Harry123 @SGaist last edited by Harry123

                                          @SGaist

                                          I wasn't aware of VNC for headless servers, so I did some research.
                                          For generic VNC, it seems like all the success stories were on Linux, and in addition required at least a display adapter and its installed driver, even if having no monitor.

                                          For Qt, I have found The VNC Protocol and Qt for Embedded Linux which isn't helpful and anyway for Qt 4.8.
                                          I have found references to the QVNCServer class, but none with doc later than Qt 4.8 and no file by that name in the sources of Qt 5.
                                          But even if QVNCServer is no longer supported, this means that the project is easier than I thought.

                                          Could you point me to any article for using Qt VNC on a Windows totally headless server using Qt of any version ?

                                          1 Reply Last reply Reply Quote 0
                                          • H
                                            Harry123 last edited by

                                            I have advanced some more and found VNC in Qt 5.9, but must say that there is almost no documentation and no samples.

                                            Can anyone help ?

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post