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. Got VNC platform plugin working on Qt 5

Got VNC platform plugin working on Qt 5

Scheduled Pinned Locked Moved General and Desktop
vncqt 5
11 Posts 6 Posters 18.2k 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.
  • G Offline
    G Offline
    ganeshv
    wrote on 6 Aug 2015, 12:16 last edited by
    #1

    Hello,

    I took the old VNC plugin code from Qt 4.x and massaged it into a Qt 5 platform plugin. You can export QT_QPA_PLATFORM=vnc, have your Qt desktop application run headless, and connect to it using a VNC client.

    The code is here. It runs on Mac OS Mountain Lion, should work on Linux. Just got it working, so it's not tested very much.

    Thinking of adding websocket support, which will let you connect to "headless" Qt apps using a browser-based VNC viewer.

    Feedback welcome.

    Ganesh

    1 Reply Last reply
    1
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 6 Aug 2015, 22:00 last edited by
      #2

      Hi and welcome to devnet,

      What about contributing that QPA to the Qt project ? That way everybody using Qt would easily have access to it

      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
      1
      • G Offline
        G Offline
        ganeshv
        wrote on 7 Aug 2015, 05:08 last edited by
        #3

        I plan to do that, once I have some more testing done.

        A 1 Reply Last reply 27 Sept 2016, 07:12
        0
        • G Offline
          G Offline
          ganeshv
          wrote on 16 Aug 2015, 22:24 last edited by
          #4

          Websocket support is now working. You can start an app with

          qtapp -platform vnc:mode=websocket
          

          Navigate to http://localhost:5900 and you will be automatically redirected to an HTML5 VNC client.

          More in the README

          1 Reply Last reply
          0
          • J Offline
            J Offline
            Julien C.
            wrote on 19 Oct 2015, 11:34 last edited by
            #5

            That's great to have a QPA VNC plugin support.
            I've just built your plugin on my i.MX6 based platform over Qt5.5.0 and test it but unfortunately running failed

            VNC Websockets

            # /usr/lib/qt/examples/qpa/windows/windows -platform "vnc:size=800x600:addr=0.0.0.0:mode=websocket"
            QVNCServer created on "0.0.0.0" port 5900 mode websocket
            QVNCServer: no password configured!
            Client protocol version RFB 003.003
            
            Want format: 32 24 0 1 8 8 8 16 8 0
            QVNCServer::setEncodings: 1
            QVNCServer::setEncodings: 7
            QVNCServer::setEncodings: -260
            QVNCServer::setEncodings: 5
            QVNCServer::setEncodings: using hextile
            QVNCServer::setEncodings: 2
            QVNCServer::setEncodings: 0
            QVNCServer::setEncodings: -223
            QVNCServer::setEncodings: -239
            QVNCServer::setEncodings: -26
            QVNCServer::setEncodings: -247
            QVNCServer::setEncodings: -224
            QVNCServer::setEncodings: -309
            QVNCServer::setEncodings: -308
            Segmentation fault
            

            VNC RAW

            # /usr/lib/qt/examples/qpa/windows/windows -platform "vnc:size=800x600:addr=0.0.role = 1 tID = 00.0:mode=raw"
            QVNCServer created on "0.0.0.0" port 5900 mode raw
            QVNCServer: no password configured!
            Client protocol version RFB 003.003
            
            Want format: 8 8 0 1 3 3 2 0 3 6
            QVNCServer::setEncodings: 7
            QVNCServer::setEncodings: 16
            QVNCServer::setEncodings: 9
            QVNCServer::setEncodings: -65527
            QVNCServer::setEncodings: 1
            QVNCServer::setEncodings: 5
            QVNCServer::setEncodings: using hextile
            QVNCServer::setEncodings: 6
            QVNCServer::setEncodings: 4
            QVNCServer::setEncodings: 2
            QVNCServer::setEncodings: 0
            QVNCServer::setEncodings: -247
            QVNCServer::setEncodings: -32
            QVNCServer::setEncodings: -240
            QVNCServer::setEncodings: -239
            QVNCServer::setEncodings: -232
            QVNCServer::setEncodings: -131072
            QVNCServer::setEncodings: -223
            QVNCServer::setEncodings: -224
            QVNCServer::setEncodings: -131071
            QVNCServer::setEncodings: -131070
            QVNCServer::setEncodings: -131069
            Segmentation fault
            
            1 Reply Last reply
            0
            • A Offline
              A Offline
              Aster5
              wrote on 27 May 2016, 11:23 last edited by
              #6

              Thats absolutely very good news, that we have vnc plugin for QT5.

              Although examples work fine as intended, When I configure and build my Qt Application with this source code, it gives error as:-

              "This plugin does not support createPlatformOpenGLContext!
              Failed to create OpenGL context for format QSurfaceFormat(version 2.0, options QFlags(), depthBufferSize 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize 8, samples -1, swapBehavior 2, swapInterval 1, profile 0) "

              System Details are as below:-
              OS: Ubuntu 14.04 LTS 32-bit
              Compiler: gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4
              mkspecs :- linux-g++

              when checked the configure output it reads as :-
              opengl-desktop
              vnc-yes
              egl-yes

              and even the libgles1-mesa and libgles1-mesa-dev are also installed.
              please suggest what could have been the problem.

              1 Reply Last reply
              1
              • G ganeshv
                7 Aug 2015, 05:08

                I plan to do that, once I have some more testing done.

                A Offline
                A Offline
                Aster5
                wrote on 27 Sept 2016, 07:12 last edited by
                #7

                @ganeshv

                Hi Ganesh,

                Any update on contributing the QPA to the Qt Project?

                BR,
                Aster

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 27 Sept 2016, 07:22 last edited by
                  #8

                  @Aster5 IIRC, there's a VNC plugin in the dev branch of the qtbase module.

                  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
                  1
                  • J Offline
                    J Offline
                    Julien C.
                    wrote on 10 Jul 2017, 14:32 last edited by
                    #9

                    @ganeshv

                    Hi ganesh,

                    Do you plan to bump your version of websocket based VNC on top of official Qt VNC plugin? It would be great because it's a great feature to get rid of any specific software to access embedded screenless device.

                    Regards,

                    Julien

                    R 1 Reply Last reply 12 Jun 2020, 11:59
                    0
                    • J Julien C.
                      10 Jul 2017, 14:32

                      @ganeshv

                      Hi ganesh,

                      Do you plan to bump your version of websocket based VNC on top of official Qt VNC plugin? It would be great because it's a great feature to get rid of any specific software to access embedded screenless device.

                      Regards,

                      Julien

                      R Offline
                      R Offline
                      RJV B
                      wrote on 12 Jun 2020, 11:59 last edited by
                      #10

                      @Julien-C said in Got VNC platform plugin working on Qt 5:

                      @ganeshv

                      Hi ganesh,

                      Do you plan to bump your version of websocket based VNC on top of official Qt VNC plugin? It would be great because it's a great feature to get rid of any specific software to access embedded screenless device.

                      +++

                      And the README also states that

                      display=<num> VNC display number. Server listens to port 5900 + <num>
                       Default: display=0
                      

                      That's a very useful feature on hosts that also run a VNC server (e.g. any Mac with screen sharing turned on) and thus already have port 5900 in use. Or simply if you want to be able to run multiple applications over VNC.

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        MatthiasU
                        wrote on 24 Feb 2025, 12:24 last edited by
                        #11

                        For those who find this via web search, the port can be set via a … drum roll … port=INTEGER parameter, as in

                        #!/bin/sh
                        export QT_QPA_PLATFORM=vnc:size=480x300:addr=127.0.0.1:port=$(expr 5900 + ${SCREEN:-1})
                        export QT_PLUGIN_PATH=/usr/lib/qt/plugins
                        
                        here="$(dirname "$0")"
                        exec "${here}"/gui.real
                        
                        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