开发者

Suppress PyQt event temporarily?

开发者 https://www.devze.com 2023-04-02 16:11 出处:网络
I\'m populating a branch of a QTreeWidget and then setting the expanded attribute on the parent of the branch to true. The itemExp开发者_StackOverflow社区anded signal fires in response, which is not w

I'm populating a branch of a QTreeWidget and then setting the expanded attribute on the parent of the branch to true. The itemExp开发者_StackOverflow社区anded signal fires in response, which is not what I want. Is there a temporary way to suppress or absorb signals during a segment of code?


You can set blocking of signals using QObject::blockSignals.
http://doc.qt.nokia.com/stable/qobject.html#blockSignals

bool QObject::blockSignals ( bool block )
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). If block is false, no such blocking will occur. The return value is the previous value of signalsBlocked(). Note that the destroyed() signal will be emitted even if the signals for this object have been blocked. See also signalsBlocked().

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号