gpt4 book ai didi

qt - 在 QObject 上调用的插槽顺序

转载 作者:行者123 更新时间:2023-12-03 08:46:28 25 4
gpt4 key购买 nike

我有一个 QObject,它有多个插槽连接到它的一个信号。发出信号时,是否有调用每个插槽的顺序?

最佳答案

在 Qt v4.5 及更早版本中:否,顺序未定义,如 the documentation here 中所示:

If several slots are connected to one signal, the slots will be executed one after the other, in an arbitrary order, when the signal is emitted.



编辑:从 4.6 版开始,这不再是正确的。现在插槽将按照它们连接的顺序运行。 the current documentation的相关段落:

If several slots are connected to one signal, the slots will be executed one after the other, in the order they have been connected, when the signal is emitted

关于qt - 在 QObject 上调用的插槽顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1246933/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com