When creating your framework's graphics device you need to pass the widget's platform handle to it. This is done so that the device can actually render to the right window. You obtain it the handle by calling the following function:
QWidget::winID.
The second thing is to update the logic at a certain frequency, probably 30hz. This can be done by using a timer that runs every 33ms. This timer also causes the widget to paint itself (by calling update) so that the framework can paint to the window (painting outside paintEvent is never a good idea).
I usually create a widget for that purpose:
class CustomWidget : public QWidget{ Q_OBJECT QTimer m_timer; YourFramework* m_framework; CustomWidget(QWidget* parent) : QWidget(parent) { QObject::connect(&m_timer, SIGNAL(timeout()), this, SLOT(updateFramework())); m_timer.start(33); m_framework = new YourFrame(winId()); } virtual ~CustomWidget() { delete m_framework. }private slots: void updateFramework() { m_framework->update(); update(); //< Posts a QPaintEvent in the main loop }protected: virtual void paintEvent(QPaintEvent* event) { m_framework->render(); event->accept(); }};
Usually you need to handle a QResizeEvent as well, to resize frame buffers and the like.