Problems with H19-20 window (maximize, full-screen)

   8525   20   1
User Avatar
Member
4982 posts
Joined: 2月 2012
Offline
Just wanted to share a fullscreen fix I came up with while working on my Houdini Supercharged extension with the overlay network editor. I needed something that works cleanly on all setups — Qt5, Qt6, Intel GPUs, multi-monitor — without the flickering or blank screen some people get when going fullscreen.

The old trick of resizing the window to be slightly bigger than the screen (+1 pixel) works in Qt5 but completely breaks in Qt6, where it clamps the size to screen bounds. Instead of fighting that, I found a cleaner way: just add a 1px invisible margin to the contents. That's enough to stop the compositor from treating it as a "true fullscreen" window, which is what usually causes the flicker or blanking.

I've tested it on both Qt versions and haven’t had any issues since switching to this method. Code is below in case it helps anyone dealing with the same problem.

def fullscreenSession():
    window = hou.qt.mainWindow()

    def customShowFullScreen():
        screen = window.screen().geometry()

        if not hasattr(window, "_orig_geom"):
            window._orig_geom = window.geometry()

        window.hide()
        window.setWindowFlags(QtCore.Qt.FramelessWindowHint)

        window.show()
        QtWidgets.QApplication.processEvents()

        window.move(screen.x(), screen.y())
        window.resize(screen.width(), screen.height())

        # Cleaner alternative to +1 pixel trick
        window.setContentsMargins(0, 0, 1, 1)
        window.setFixedSize(screen.width(), screen.height())

        QtWidgets.QApplication.processEvents()
        window.raise_()
        window.activateWindow()
        window.repaint()

    def customExitFullScreen():
        ORIGINAL_WINDOW_FLAGS = QtCore.Qt.WindowType(167833601)

        window.hide()
        window.setWindowFlags(ORIGINAL_WINDOW_FLAGS)

        if hasattr(window, "_orig_geom"):
            window.setGeometry(window._orig_geom)
            del window._orig_geom

        window.setMinimumSize(0, 0)
        window.setMaximumSize(16777215, 16777215)

        window.show()
        QtWidgets.QApplication.processEvents()
        window.raise_()
        window.activateWindow()

    if window.windowFlags() & QtCore.Qt.FramelessWindowHint:
        customExitFullScreen()
        window.showMaximized()
        hou.ui.setHideAllMinimizedStowbars(False)
    else:
        for pane in hou.ui.panes():
            pane.setShowPaneTabs(False)

        customShowFullScreen()
        hou.ui.setHideAllMinimizedStowbars(True)
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
  • Quick Links