问题描述
|
我有一个
ClientSocket
类别,在某种对话状态下是TcpSocket
,我需要询问用户输入通信密码。所以我创建了一个对话框DG::ChallangeDialog
。在ѭ2的时间内
ui->setupUi(this);
QPushButton* okButton = ui->buttonBox->button(QDialogButtonBox::Ok);
if(okButton != 0x0){
okButton->setText(\"Challange\");
}
QObject::connect(this,SIGNAL(accepted()),this,SLOT(acceptedSlot()));
acceptedSlot
再次发出信号challanged(QString)
void ChallangeDialog::acceptedSlot(){
QString text = ui->passBox->text();
emit challanged(text);
}
在ClientSocket
中
case Hallo:{
if(m->message().startsWith(\"welcome\")){
DG::ChallangeDialog* dlg = new DG::ChallangeDialog;
dlg->setModal(true);
connect(dlg,SIGNAL(challanged(QString)),SLOT(challanged(QString)));
dlg->exec();
/*
DG::MessagePacket* res = new DG::MessagePacket((int)Hallo);
res->setMessage(\"challange\");
send(res);
state = Challange;
*/
}
}break;
在“ 10”插槽中,我通过套接字发送消息挑战(文本)并存储密码。
并且我希望对话框隐藏在那里并且正常的套接字对话将继续。在接受或拒绝对话框后,主应用程序退出(退出该程序不会崩溃)。为什么呢
我的应用程序没有其他小部件。我只是像QCoreApplication一样工作。但是我仍然使用QApplication,因为我有一些GUI需求。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)