QFileDialog导致我的应用程序响应速度变慢
QFileDialog causes my application to become less responsive
首先,就上下文而言,我将来自QAction的triggered
的信号连接到this
中称为fileOpen
的插槽,其他类似的连接在我的主窗口类中的方法中完成,如下所示:
void MainWindow::createActions()
{
m_fileNew = new QAction("&New", this);
m_fileOpen = new QAction("&Open", this);
m_fileExit = new QAction("E&xit", this);
connect(m_fileNew, SIGNAL(triggered(bool)), this, SLOT(fileNew()));
connect(m_fileOpen, SIGNAL(triggered(bool)), this, SLOT(fileOpen()));
connect(m_fileExit, SIGNAL(triggered(bool)), this, SLOT(fileExit()));
}
为了显示文件对话框,在MainWindow::fileOpen
中使用了静态方法QFileDialog::getOpenFileName
:
void MainWindow::fileOpen()
{
QString filename = QFileDialog::getOpenFileName(this, tr("Open Audio File"),
"", tr("WAVE Files (*.wav);;All Files (*.*)"));
if (filename != QString::null) {
m_fileName = filename;
}
}
m_fileOpen
和fileOpen
之间的信号槽连接工作并显示文件对话框,但关闭对话框后,窗口在调整大小时需要更长的时间来重新绘制。
为什么会发生这种情况,我该如何解决它?
我所要做的就是在发布模式下构建我的Qt应用程序,这意味着从qmake调用中删除"CONFIG+=debug"参数。
在发布模式下,性能下降消失了,这很好,尽管我不明白Qt库的调试版本和发布版本之间的差异允许这种情况发生。
相关文章:
- 应用程序在打开的简历中捕获视频后没有响应
- Windows 7 应用程序在未聚焦时运行速度较慢
- Qt应用程序不响应鼠标和键盘事件
- QWebView 用于在桌面应用程序中运行 javascript (D3) - 当 HTML 更改时重新加载速度很慢
- 当后端响应需要很长时间时,WXWIDGET应用程序会挂起
- 有没有一种方法可以测量桌面应用程序 UI 响应时间
- 在 UWP 应用程序中,future.wait() 在尝试同步来自异步方法的响应时继续等待
- 如何在不冻结线程/应用程序的情况下减慢方法执行速度
- X11应用程序在Ubuntu中未响应
- Qt:QVideoWidget 不显示并禁用应用程序中的所有按钮,或者极大地减慢应用程序的速度
- 应用程序使用QMAP存储对象时停止响应
- 处理Windows消息,以便我的应用程序正确响应
- 在不减慢主应用程序速度的情况下在后端运行成员函数的技巧是什么
- Linux:应用程序响应能力和select()
- 基于libpcap的应用程序是否会影响网络速度/性能
- C++线程化的应用程序比非线程化的运行速度慢
- 应用程序的响应时间与给定时间段内输入触发器的数量不经意地相关
- UI 在应用程序 UI 外部没有响应
- QFileDialog导致我的应用程序响应速度变慢
- 如何纠正无响应的应用程序?