Qt World Summit: Register Today!


Display issue with Qt application windows over SSH/X11



  • I'm attempting to use PyQt apps on a remote Linux server by SSH and X11 forwarding.

    The application window is all black and unusable. Only the window's title bar exists to close it.
    I believe it has to do with Qt and OpenGL over ssh/X11.

    Using Windows 10, PuTTY, VcXsrv, and the PyQt apps are on a Linux OpenSUSE 42.3 host (nVidia drivers).
    The apps work fine locally. More details follow:
    I can display glxgears over ssh/x11 - not optimal, but at least displays.

    1. Display issues with Spyder 3.2.8 & 3.3.0 with Qt/PyQt (5.9.4/5.9.2)

    The PuTTY terminal displays following:

    % spyder
    QQuickWidget: Failed to make context current
    QQuickWidget::resizeEvent() no OpenGL context
    QQuickWidget: Failed to make context current
    QQuickWidget: Failed to make context current
    QQuickWidget::resizeEvent() no OpenGL context
    QQuickWidget: Failed to make context current
    QQuickWidget: Attempted to render scene with no context
    QQuickWidget: Attempted to render scene with no context
    composeAndFlush: makeCurrent() failed
    

    2. Display issues with PyQt5 opengl examples from: https://github.com/baoboa/pyqt5

    QOpenGLWidget: Failed to make context current
    QPainter::begin: Paint device returned engine == 0, type: 1
    QPainter::setRenderHint: Painter must be active to set rendering hints
    QPainter::translate: Painter not active
    QPainter::save: Painter not active
    QPainter::setBrush: Painter not active
    QPainter::setPen: Painter not active
    ...
    QPainter::restore: Unbalanced save/restore
    QPainter::setPen: Painter not active
    QPainter::setFont: Painter not active
    QPainter::end: Painter not active, aborted
    composeAndFlush: makeCurrent() failed
    composeAndFlush: makeCurrent() failed
    QPainter::begin: Paint device returned engine == 0, type: 1
    QPainter::setRenderHint: Painter must be active to set rendering hints
    

    Any recommendations to try for #1 & #2?

    • I tried pyqt 5.11.2 but with same results.
    • environment variable settings?

    3. qt5/pyqt5 performance degradation over ssh/x11
    This maybe a separate topic all together, but I will likely notice performance degradation over ssh/x11
    if it occurs. Based on previous posts I suspect it will.

    Any idea if these changes will be in later versions of qt/pyqt? (To help with ssh/X11 performance)

    Can anyone comments on these apps rather than the standard ssh w/x11 forwarding? (despite this ssh/x11 working fine for years for several Qt applications)

    Thank you!


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    That's a topic you should rather bring to the interest mailing list. You'll find there Qt's developers/maintainers. This forum is more user oriented.





  • This is the first place where Google gets me, when I was trying to find a solution for the issue I had, which was:

    Qt: QOpenGLWidget: Failed to make context current
    composeAndFlush: makeCurrent() failed

    when I used a Qt application over WSL2 with X11 forwarding to my Windows host with VcXsrv.

    I understand this topic/question is old, but It would save me Googling time if someone described here a similar problem as I had.
    What I did wrong in my case was setting LIBGL_ALWAYS_INDIRECT env variable (it was set to 1).
    As suggested in this Stackoverflow post - unset it, and unset the "Native opengl" checkbox in VcXsrv XLaunch UI, and that fixes the runtime:

    export LIBGL_ALWAYS_INDIRECT=
    

    I'm on latest Windows 11 Preview with VcXsrv 1.20.9 + Ubuntu 20.04 over WSL2 with Qt 5.15.2.
    My Qt Application also sets:

    QGuiApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
    QGuiApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
    

Log in to reply