让我的QObject连接到tcp启动时遇到问题.. 任何建议请和你的时间相比
似乎开始永远不会被称为......
mainwindow.cpp
void MainWindow::on_pushButton_3_clicked()
{
LoginServer tcpServer;
QObject::connect(&tcpServer, SIGNAL(tcpServer::stopped()), this, SLOT(tcpServer::start(port)));
}
loginserver.h
signals:
void stopped();
public slots:
void start(quint16 port);
void stop();
private slots:
void threadStarted();
void threadFinished();
protected:
void incomingConnection(qintptr) Q_DECL_OVERRIDE;
private:
QAtomicInt activeSessions;
QSemaphore threadWaitSemaphore;
Loginserver.cpp
void LoginServer::start(quint16 port)
{
// Start the Login server
// QHostAddress::Any
//QHostAddress::LocalHost
if (!listen(QHostAddress::Any, port))
{
QString Login_Server_Error = QStringLiteral("Couldn't start the login server");
ui->textBrowser->append(Login_Server_Error);
return;
}
else
{
QString Login_Server_Connection = QStringLiteral("Login Server Started on port: %1").arg(port);
ui->textBrowser->append(Login_Server_Connection);
}
}