Skip to content
Snippets Groups Projects

VNC Server

Provides a VNCItem for Qt Quick applications which can be used to share all its contents over a VNC connection. When no connection is made, the VNCItem remains inactive and does not affect application performance or execution. When one or more client connects, the item will read back its rendered content when the client requests, meaning some overhead during the render step.

It supports the following encodings: Raw, Hextile, Zlib.

It also supports DEC Authentication (this feature requires libtomcrypt and will be automatically enabled if available. Install with e.g. apt install libtomcrypt-dev)

How to build

Qt VNC Server can be built as a regular Qt module. For Qt 6, run qt-cmake-private && ninja. For Qt 5 run qmake && make -j8.

Important note: In order to build against Qt 5.15, the following enabler is required for Qt Declarative: https://codereview.qt-project.org/c/qt/tqtc-qtdeclarative/+/399712

How to use

Create a VNCItem in the Qt Quick application and make it the parent of the part of the application content that you want to share. For instance, in order to share all the application content, you can make VNCItem the root item of the application.

See tests/manual/qml for a few examples of use. The minimal-compositor-qt5.qml / minimal-compositor.qml are examples of a Qt Wayland Compositor which shares its entire screen over VNC.

Note: Use qmlscene in order to run the minimal-compositor tests.

Setting the password property of the VNCItem will enable DEC authentication. Note that DEC authentication is considered weak protection, and that the connection itself is not encrypted. This protects mainly against accidental intrusion, but not against targeted attacks.

How to debug

Qt VNC Server is work-in-progress, and issues may occur. The following environment variables may be useful when debugging problems.

  • QT_VNCSERVER_PREFERRED_ENCODING: Set this to the server's preferred encodings. This can be a semicolon-separated list, and the first entry which is supported by the client will be used. If the client supports none of the encodings, Raw will be used. By default, the server will respect the client's preference. Possible values: raw, zlib, hextile.

  • QT_VNC_NO_DIRTYMAP: Disables detection of dirty regions and always sends entire item area to clients. This reduces load on CPU but usually requires more bandwidth.

  • QT_LOGGING_RULES: To enable logging for certain aspects of the server operation, Qt VNC Server supports qt.vncserver.fps, qt.vncserver.time and the general qt.vncserver logging categories.