C++ (Qt)for (int i = 0; i < N; i++ {NewThread *thread = new NewThread(this);connect(this, SIGNAL(StringSignal(QString &)), thread, SLOT(StringSlot(QString &)));}
C++ (Qt)void anySlot(){ QString test= "test"; emit StringSignal(test);}
C++ (Qt)emit StringSignal(test, threadN);
C++ (Qt)QList<QLineEdit*> lineEditList;
C++ (Qt)for (int i = 0; i < N; i++ {QLineEdit *lineEditDialog = new QLineEdit(dialog);lineEditList<< lineEditDialog;} for (int i = 0; i < N; i++ {NewThread *thread = new NewThread(this);connect(lineEditList[i], SIGNAL(returnPressed()), thread, SLOT(StringSlot()));}
C++ (Qt)class NewClientEvent: public QEvent{public: static const QEvent::Type ET_NewClientEvent = (QEvent::Type)2000; explicit NewClientEvent(): // ...};
C++ (Qt)bool WorkThread::event(QEvent *event){ if (event && event->type() == NewClientEvent::ET_NewClientEvent){ // ... return true; } return QThread::event(event);}
C++ (Qt)mThreadsList = new std::vector<WorkThread*>();mThreadsList->reserve(idealThreadsCount());for (int i=0; i<mThreadsList->capacity(); ++i){ WorkThread *thread = new WorkThread(mRequestsHandler, 0); thread->start(); mThreadsList->push_back(thread);}
C++ (Qt)QThread *thread = mThreadsPool->nextThread();if (! thread) return; NewClientEvent *event = new NewClientEvent(handle);QCoreApplication::postEvent(thread, event);