Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

isVisible doesn't work if I don't use X11BypassWindowManagerHint flag



  • Hi,

    So I figured out the other issue about not being able to call setWindowsFlag or setWindowOpacity. The window was disappearing, but now I turned on improved window handling and OpenGL 3.1 for the driver. So it works.

    But now another issue I face is this:

    Original code:

    networkEditor.setWindowFlags(networkEditor.windowFlags() | QtCore.Qt.Tool | QtCore.Qt.X11BypassWindowManagerHint)
                networkEditor.setWindowOpacity(getSessionVariable("overlayNetworkEditorOpacity"))
    
    networkEditor.showFullScreen()
    
    if networkEditor.isVisible():
            networkEditor.hide()
        else:
            networkEditor.show()
    

    As you can see, I am using X11BypassWindowManagerHint flag. I had to use this so that linux doesn't bother my window, meaning, I move the window in negative coordinates to hide it. For some reason just calling hide wasn't working or something. I have to dig deeper to find out again.

    But the above code works great on Windows, if you run the same code, it toggles the visibility of the window, which is what I want. Basically show the window and hide the window.

    Is there a better way to do this?

    Actually this code works well on both windows and linux, the only issue is, on linux the window stays on top of everything. It doesn't go down when I minimize the main parent window (hosting app).

    This is a problem of course. On windows it doesn't do this.

    I even removed "always on top" flag but it didn't do anything. It didnt have this flag anyway.

    So then I thought ok then remove the X11BypassWindowManagerHint flag, but then the window never showed up again. I looked at it the reference was still there in memory. Called .show() on it, and it showed up.

    networkEditor.setWindowFlags(networkEditor.windowFlags() | QtCore.Qt.Tool | QtCore.Qt.FramelessWindowHint)
    

    Then I found out:

    networkEditor.isVisible()
    

    always returns True, so that's why the issue was the show was never got called.

    Am I on the right path? How can I fix this? I feel like X11 flags makes it a bit more stable but the always on top is an issue.

    Thanks in advance.



  • I also tried this no luck:

    networkEditor.setWindowFlags(networkEditor.windowFlags() | QtCore.Qt.X11BypassWindowManagerHint)
    networkEditor.move(posx, posy)
    networkEditor.setWindowFlags(networkEditor.windowFlags() & ~QtCore.Qt.X11BypassWindowManagerHint)
    

    This topic is relevant:
    https://forum.qt.io/topic/5375/qt-4-7-0-ubuntu-10-10-cannot-move-application-window-out-of-desktop-bounds/4


Log in to reply