Important: Please read the Qt Code of Conduct -

OpenGL under QML does not work with dynamic object creation

  • Good morning,

    I'm trying to get the OpenGL under QML example to work with dynamic object creation with no luck.

    The setup:

    I've partitioned the app window into a status bar and a display area. The display area will be used to render output from various Qt plugins. I've tried using the QML Loader object and Qt.createComponent() to dynamically load the objects from the plugins as needed.

    The problem:

    I've duplicated the opengl rendering with qml example. If I load it into the display area directly it works perfectly. If I load it into the display area using a Loader it displays nothing. I've logged debugging messages and it's definitely running. I've debugged the app using GDebugger and it appears to be sending OpenGL calls.

    Any ideas?

    I was careful to use the correct signal/slot property when connecting the rendering up;

    @connect( win, SIGNAL( beforeRendering() ), this, SLOT( paint() ), Qt::DirectConnection )

  • This issue turned out not to be the OpenGL control. In my QML I was loading the control as a child of a 'COLUMN' item. If you don't get the properties of the child controls correct the column will render the item but not display it. It may be rendering it out of the valid area and it's clipped off. I changed my QML to remove the column item and use anchors to place items in the positions I wanted.

Log in to reply