I run into the same issue. Except I am using Pyside2. Is there any way to fix this issue? Calling update hides the window. So after setWindowFlags function, I have to call show function but like OP it flickers. Not sure why this sort of design is implemented. Can this be remedied in a future version or is there a workaround? My code is like this:
def setPassThroughMode(window, enable):
if enable:
# Set the window to be transparent for input
window.setWindowFlags(QtCore.Qt.Tool | QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowTransparentForInput)
else:
# Restore the normal floating window behavior
window.setWindowFlags(QtCore.Qt.Tool | QtCore.Qt.FramelessWindowHint)
window.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents, enable)
window.setAttribute(QtCore.Qt.WA_NoMousePropagation, enable)
# Ensure changes take effect
window.show() # Reapply visibility to update flags
def togglePassThroughMode(window):
# Check if the window is valid
if not shiboken2.isValid(window):
return
# Check if the window is in pass-through mode
isPassThrough = isPassThroughEnabled(window)
# Toggle the state using setPassThroughMode
setPassThroughMode(window, not isPassThrough)
# To turn it off, you have to call the function twice
if isPassThrough:
setPassThroughMode(window, not isPassThrough)
I have to call it twice to turn these flags off also, not sure why that is.