I need call QSslSocket into grpc method (https://www.grpc.io/docs/languages/cpp/):
Qt Code:
  1. class GreeterServiceImpl final : public Greeter::Service {
  2. Status SayHello(ServerContext* context, const HelloRequest* request, HelloReply* reply) override {
  3. mySslClient.setHostName(/*...*/);
  4. // ...
  5. return Status::OK;
  6. }
  7.  
  8. MySslClient mySslClient;
  9. };
To copy to clipboard, switch view to plain text mode 

MySslClient looks like that:
Qt Code:
  1. MySslClient::MySslClient(QObject *parent) :
  2. QObject(parent),
  3. mSocket(new QSslSocket(this))
  4. {
  5. QSslConfiguration config = mSocket->sslConfiguration();
  6. //...
To copy to clipboard, switch view to plain text mode 

As a result, I get an error
Qt Code:
  1. QObject: Cannot create children for a parent that is in a different thread.
  2. (Parent is QSslSocket(0x55f14d7adf60), parent's thread is QThread(0x55f14d7ad700), current thread is QThread(0x7fc3fc3faf60)
To copy to clipboard, switch view to plain text mode 

Can this problem be resolved?