QT如何显示,请等待对话框,而插座正在等待响应
Qt how to display please wait dialog whilst socket is waiting for response?
我的功能发出了HTTP请求,服务器可能需要一些时间才能响应。在等待时间我想显示一个向用户等待对话。
我已经尝试创建请等待对话框,然后将HTTP请求发送到服务器。请立即返回,请等待对话框,没有错误,也没有显示任何内容,然后提出HTTP请求,但请否请显示对话框。
如果我不执行HTTP请求并允许执行继续进行对话框。
我认为解决方案可能是在新线程中创建请等待对话框?
我的班级,clsalert源自构造函数中的clsdialog:
clsAlert::clsAlert(QString strText, QWidget* pParent, bool blnAutoCleanup) : QDialog(pParent), ui(new Ui::clsAlert) {
ui->setupAlert(this);
ui->lblText->setText(strText);
... set-up geometry ...
show();
}
用法示例:
clsAlert* pPW = new clsAlert(clsAlert::mscszPleaseWait,mpParent);
int intServer = intCreateSocket(szDestURL, pOutbio);
... a lot more source ...
pPW->cleanup();
最后,我在我的情况下通过添加一个呼叫来解决此问题:
QCoreApplication::processEvents();
我致电后立即:
show();
相关文章:
- 如何在Qbutton的帮助下更改Q对话框的宽度
- 当对话框被接受时,如何用参数调用槽
- WinAPI 在单击第一个对话框上的按钮控件并销毁第一个对话框后创建第二个对话框
- 如何多次询问来自QML对话框的输入?
- 选择文件对话框错误
- 自定义对话框(源自QDialog)不会关闭(Android)
- 如何在 MFC 对话框中使用 OnDraw
- 在C++中创建文件夹选取器对话框的最简单方法是什么?
- 从资源视图访问对话框时出现问题
- 如何检测窗口当前是否正在运行模式对话框?
- "最小化"按钮不会出现在 MFC 对话框中
- 如何获取QNetworkConfiguration UserChoice对话框?
- 表单显示对话框函数错误,并且不执行下面的语句
- 如何在 VC6 中的对话框中将图标设置为按钮
- C++/Win32 构造函数不使用从对话框获取的字符串初始化变量
- 在 Win32 应用中,如果未选择文件夹并且用户单击"确定",则文件夹选择对话框将关闭
- 在主窗口之前显示登录对话框并隐藏主窗口按钮
- 找不到没有具有类名 #32770 的窗口名称的父窗口的子窗口(对话框)
- 如何在主窗口标签的对话框中显示QLineEdit的输入
- QT如何显示,请等待对话框,而插座正在等待响应