Do you want to know how your customers use your applications and devices? Try Qt Insight Beta.
最新版Qt 6.3已正式发布。 了解更多。
最新バージョンQt 6.3がご利用いただけます。 詳細はこちら
Contact Us

Commercial add-on: Qt VNC Server

"VNC" (or Virtual Network Computing) compatibility has a long history in Qt, and we are now improving this story with a commercial add-on which is compatible with Qt 6.4.

History

I did an archeological dig in Qt's history, and the first mention of VNC support I could find was in the very early port to embedded Linux (Qt 2.2 most likely) in a change called "VNC remote framebuffer support" from July 5th, 2000. Technically speaking, though, VNC is a brand name, and the protocol supported is called "RFB" (Remote FrameBuffer). Clients and servers that speak this protocol are typically referred to as "VNC-compatible".

This original support evolved over time into its current manifestation, which came in one of the Qt 4 feature releases as part of the so-called "Lighthouse project", later re-branded to QPA (or Qt Platform Abstraction).

So the existing support for VNC in Qt 4, 5 and 6 is a platform plugin, where you can run your applications in headless mode and render to remote VNC-compatible clients when they connect. Any Qt GUI-based application can be run in this mode, by passing "-platform vnc" as a command line option, or by setting QT_QPA_PLATFORM=vnc in the environment (note: this plugin is only built on Linux platforms at the moment).

This is pretty elegant and works smoothly to this day, but it has one downside: The only way you can render to a local display simultaneously as a remote display, is by running a VNC-compatible client locally alongside the server and connecting it to localhost. Due to this, we've had several customers request that we expand the capabilities to include mirroring to a local display. Typically, their use case is an embedded device - often backed by Qt Wayland Compositor - where users want to broadcast the display to a remote user on demand.

For instance, the remote user could be a representative from support who needs to see exactly what the end user is seeing on screen in order to help them efficiently. The application should primarily be running unencumbered, but on request it should be able to share its contents with a remote user, as well as accept remote input (optionally). The VNC QPA plugin in Qt does not cover this use case, since the application would have to be closed and restarted in order for any remote connection to be possible, and the end user would not be able to see anything on their screen as long as the system is running in this mode.

So we set out to provide a solution to this and came up with the Qt VNC Server module. This will be available to commercial customers as a technology preview which is compatible with Qt 6.4. The documentation snapshot is available here.

Qt VNC Server

Our main use case when going into this was to support remote desktop on Qt Wayland Compositor-based display servers, but we quickly realized that it did not make sense for us to limit support to Wayland.

A Qt Wayland Compositor is typically just a Qt Quick application which composes graphics buffers from different clients, so any solution which allows you to share the content of a Qt Quick application will also work for a compositor. We also knew that some customers had multiple displays in their systems, and might want to limit remote users to seeing just one of these displays over the RFB connection.

So the solution we ended up with allows you to share any Qt Quick application - or any part of it - with a VNC-compatible client. And like with Qt Quick in general, we have tried to make the solution as simple to use as possible, yet still powerful enough to cover many use cases.

In order to use Qt VNC Server in your product, you simply import the QtVncServer module and create a VncItem as the root of the subtree you wish to share remotely. When there is no active connection, this will behave just as an empty Item, and will not cause any noticeable overhead to the application.

When a user connects, it will use the same mechanisms as ShaderEffectSource to capture the contents of the subtree, sharing this with remote clients. It will additionally accept input from the clients, unless this is explicitly disabled.

One of the examples in Qt VNC Server shows how this works with Qt Wayland Compositor.

remotedesktop-example

Here you see three Qt applications running inside a Qt Wayland Compositor, and the entire desktop is being shared over VNC. A remote user has been typing into the Wiggly app, remote-controlling the desktop. (This may be one of the main use cases, but it's worth mentioning that the Qt VNC Server module itself is cross-platform and has no dependencies on Wayland.)

Additional features

The existing VNC plugin in Qt remains available and is not going anywhere, but Qt VNC Server hopefully adds value to users who are building their own platforms, where there might not be a remote desktop solution available by default.

In addition to the basic support for the RFB protocol that matches the support in the QPA plugin, Qt VNC Server also implements Hextile compression and Zlib compression (when libz is available). It supports detecting damage regions to avoid sending too much data over the network connection. And, finally, it supports password protection using DEC Authentication, through the libtomcrypt library (if this is available).

Tech preview

Qt VNC Server is considered a tech preview at the moment. This means we are looking for feedback from prospective users: Are there additional features needed? Does the API work as well as we hope, or should we make adjustments? Etc.

It also means that there are no compatibility guarantees with future releases of the module, but the API is fairly small, so keeping up with changes should not be too impractical.

If you are a Qt commercial customer, you can download the Qt VNC Server via the Qt Maintenance tool. Give it a test run with your app and let us know what you think. Suggestions and bugs can be reported via Qt Support as usual.

 

 

 


Blog Topics:

Comments