C++ 级联信号不工作
我在QML文件中声明了一个工作表,其id为“splashscreen” 当我的应用程序执行计算密集型任务时,我会发出working()信号 我将此代码附加到QML文件的主要元素:C++ 级联信号不工作,c++,qt,qml,blackberry-cascades,C++,Qt,Qml,Blackberry Cascades,我在QML文件中声明了一个工作表,其id为“splashscreen” 当我的应用程序执行计算密集型任务时,我会发出working()信号 我将此代码附加到QML文件的主要元素: onCreationCompleted: { _encryptedattachment.finished.connect(splashscreen.close); _encryptedattachment.working.connect(splashscreen.open); console.l
onCreationCompleted: {
_encryptedattachment.finished.connect(splashscreen.close);
_encryptedattachment.working.connect(splashscreen.open);
console.log("connected");
}
如果我通过调用需要解密的文件打开应用程序
_encryptedattachment.working.connect(splashscreen.open);
即使触发了事件,也不会打开splashscreen(我在调试器中检查代码
emit working()
被执行
编辑:
我将重新创建的代码更改为:
onCreationCompleted: {
splashscreen.open();
_encryptedattachment.working.connect(showSplash);
_encryptedattachment.finished.connect(hideSplash);
console.log("connected");
}
function showSplash() {
console.log("open splashscreen");
splashscreen.open();
}
function hideSplash() {
console.log("close splashscreen");
splashscreen.close();
}
并且这两个日志都出现在控制台中。调用
qsplashsscreen::show()
后,必须调用QApplication::processEvents()
以便eventloop将其绘制在屏幕上。记住调用QApplication::processEvents()
每次启动屏幕更新后。1.您确定\u encryptedattachment.working.connect(showSplash)已加密吗;
返回true?是否确定未调用showSplash?如果调用showSplash,在QSplashScreen实例上调用show后是否调用QApplication::processEvents
?QApplication::processEvents解决了问题。谢谢。如果您将其添加为答案,我将接受它。