I create some class like this:
class TcpClient: public QObject
{
    public TcpClient(){}
    QSocket *socket;
    QMutex mutex;
    void write()
    {
        QMutexLocker locker(&mutex);
        socket->write();
    }
}
class SubQthread :public QThread
{
    public:
    SubQthread(TcpClient *tcp)
    {
        //
        m_tcp = tcp;
    }
    private:
    TcpClient *m_tcp;
    protected:
    void run()
    {
        m_tcp->write();
    }
}
class Widget:public QWidget
{
    public:
    Widget()
    {
        client =  new TcpClient(this);
    }
    private:
    TcpClient *client;
}
When I create multiple sub-QThreads, I pass the pointer TcpClient* to QThread. Is this a good idea? On the condition that i can ensure TcpClient* will be deleted after the app finished.
 
     
     
    