Skip to content
Advertisement

How to deactivate a QVideoProbe?

According to the docs “If source is zero, this probe will be deactivated”

But calling setSource(0) gives the following exception:

JavaScript

Im running my code on raspberry pi 4 with Rpi Os Bullseye 64bit and PySide2 version 5.15.2.

Example code:

JavaScript

Advertisement

Answer

The source object can be cleared like this:

JavaScript

In C++, passing zero to a pointer argument means the function will recieve a null pointer. Since this can’t be done explicitly in Python, PySide/PyQt allow None to be passed instead.

Generally speaking, it’s always advisable to consult the Qt Docs in cases like this. The PySide/PyQt docs are a work in progress and are mostly auto-generated from the Qt Docs. This can often result in somewhat garbled or misleading descriptions that don’t accurately reflect how the given API works in practice.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement