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

Issue loading UI with a fresh template



  • Greetings!
    I'm a beginner both in Python and Qt, but I have some programming experience

    So here's the issue and how to replicate it:

    1. Start a project using this template: "Qt for Python - Window (UI file)"
    2. Select "QMainWindow" as base class
    3. Add any object into the UI through qt designer
    4. Save and run the program

    and all I see is an empty window, and the terminal does not show any error related to the UI
    Please notice that I didn't touch any of the automatically generated code

    Here's what the terminal says:
    17:23:03: Starting /usr/bin/python -u /home/enf/Projects/HealthCalcs/main.py...
    (now i close the window)
    17:23:11: /usr/bin/python exited with code 0

    This problem does not occur if I use "QWidget" as a base class

    I also happen to have this problem
    "Qt WebEngine seems to be initialized from a plugin. Please set Qt::AA_ShareOpenGLContexts using CoreApplication::setAttribute before constructing QGuiApplication."

    which I solved by pasting this line of code in my main function
    QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_ShareOpenGLContexts)

    Am I doing something wrong?

    Here's some extra information that might be useful:

    • OS Linux Manjaro KDE x64
    • qt-creator 4.12.4-1
    • Python 3.8.3

Log in to reply