Important: Please read the Qt Code of Conduct -

QGLWidget - how to draw from another class or passing data to QGLWidget

  • Hello,

    i have implemented something similar to the simle GL-example .
    I have another class, that contains some data which gets calculated somewhere else (list of pairs of points that shall be painted as lines)
    How can i draw from this other class or pass the data to the GLWidgetClass to be used in the draw() methode?

  • Qt Champions 2019

    @gde23 You can emit a signal in this class as soon as new data is available. Then connect a slot in your QGLWidget to this signal. The signal can pass the data to draw as parameter.

  • I solved it by adding a list to the GL object containing all the pointers to the objects to draw (i already hat this list), but thanks anyway.

Log in to reply