Got VNC platform plugin working on Qt 5



  • 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


  • Lifetime Qt Champion

    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



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



  • 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



  • 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


  • 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.



  • @ganeshv

    Hi Ganesh,

    Any update on contributing the QPA to the Qt Project?

    BR,
    Aster


  • Lifetime Qt Champion

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



  • @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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.