Qt Network can negotiate SOCKS5 for a TCP socket directly. In an existing Qt application, configure the socket before connecting:

QNetworkProxy proxy(
    QNetworkProxy::Socks5Proxy,
    "proxy.example.net",
    1080
);

socket.setProxy(proxy);
socket.connectToHost("service.example.net", 12345);

socket is an existing QTcpSocket. The example destination and port stand for the application's TCP service. Qt first reaches the proxy, then asks it to connect to that destination. For a publicly reachable TCP service where a public intermediary is allowed, the SOCKS5 proxy list supplies candidates for this no-proxy-account example. Confirm that the candidate permits the service’s actual host and port.

The normal asynchronous socket signals still apply: wait for connected() before exchanging application data, and handle errorOccurred(). Keep the socket object alive while the connection is in use. For blocking code, use Qt's documented wait methods with a deliberate timeout instead.

This requires Qt Network, not a widgets-based GUI. The explicit setting belongs to this socket. Other sockets can retain their application defaults or select another proxy. To make this particular socket direct, set its proxy type to QNetworkProxy::NoProxy before connecting.

Erthyglow kevrennek