C
QVncServer Class
The QVncServer is a QTcpServer which supports the RFB® protocol. More...
Header: | #include <QVncServer> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS VncServer) target_link_libraries(mytarget PRIVATE Qt6::VncServer) |
qmake: | QT += vncserver |
Properties
- isConnected : const bool
- password : QByteArray
Public Functions
QVncServer(const QSize &screenSize, QImage::Format screenFormat, quint16 port = DefaultPort) | |
virtual | ~QVncServer() override |
bool | isConnected() const |
const QByteArray & | password() const |
void | provideImage(const QImage &image, bool flippedVertically = false) |
QImage::Format | screenFormat() const |
QRect | screenGeometry() const |
QImage | screenImage(bool *isFlipped = nullptr) const |
void | setCursor(QCursor *cursor) |
void | setPassword(const QByteArray &newPassword) |
Signals
void | isConnectedChanged(bool connected) |
void | passwordChanged() |
Detailed Description
The QVncServer can be used to create a TCP server which accepts connections from VNC®-compatible clients.
Property Documentation
[read-only]
isConnected : const bool
This property is set to true if any client is connected to the server, and false if not.
Access functions:
bool | isConnected() const |
Notifier signal:
void | isConnectedChanged(bool connected) |
password : QByteArray
This property holds the password for the VNC®-compatible server. By default, the property is the empty string. If left empty, no authentication will be enabled for the server. If set, it will enable DEC authentication.
Note: DEC authentication is considered weak protection, and the connection itself is not encrypted. This protects mainly against accidental intrusion, but not against targeted attacks.
Access functions:
const QByteArray & | password() const |
void | setPassword(const QByteArray &newPassword) |
Notifier signal:
void | passwordChanged() |
Member Function Documentation
[explicit]
QVncServer::QVncServer(const QSize &screenSize, QImage::Format screenFormat, quint16 port = DefaultPort)
Constructs a QVncSserver with the given screenSize and screenFormat. This will open a TCP server listening for RFB® connections on port.
[override virtual]
QVncServer::~QVncServer()
Destroys the QVncServer. This will disconnect all clients.
void QVncServer::provideImage(const QImage &image, bool flippedVertically = false)
Sets the current image provided to clients. For images where the vertical origin is at the bottom, pass true for flippedVertically, otherwise false.
Note: If the size or format of the image is different from the current size or format, the server's parameters will be updated. This requires support in the connected clients for updating image parameters while they are connected.
See also screenImage().
QImage::Format QVncServer::screenFormat() const
Returns the format passed to the constructor.
QRect QVncServer::screenGeometry() const
Returns the a rectangle spanning from (0, 0) with the dimensions passed to the constructor.
QImage QVncServer::screenImage(bool *isFlipped = nullptr) const
Returns the current image shared by the server to clients. If isFlipped is not null, its contents will be set to true if the current image's origin is at the bottom, and false if it is at the top.
Note: This function is thread-safe.
See also provideImage().
void QVncServer::setCursor(QCursor *cursor)
Provides a cursor for clients supporting this.
Available under certain Qt licenses.
Find out more.