Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <QApplication>
- #include <QDialog>
- #include <QOpenGLWidget>
- #include <QLayout>
- #include <QTimer>
- class GLDialog : public QDialog
- {
- public:
- GLDialog()
- {
- QOpenGLWidget *glw = new QOpenGLWidget;
- QVBoxLayout *layout = new QVBoxLayout;
- layout->addWidget(glw);
- setLayout(layout);
- setGeometry(64, 64, 1024, 768);
- }
- };
- int main(int argc, char *argv[])
- {
- QApplication a(argc, argv);
- quint64 count = 0;
- QTimer timer;
- timer.setSingleShot(false);
- timer.setInterval(100);
- QDialog makeTheAppNotQuit(NULL, Qt::Window);
- makeTheAppNotQuit.show();
- QObject::connect(&timer, &QTimer::timeout, [&timer, &count]
- {
- count++;
- if(count % 50 == 0) timer.setInterval(5000); // Give us some time to take a look at the memory usage
- else timer.setInterval(100);
- GLDialog *dlg = new GLDialog;
- dlg->show();
- delete dlg;
- });
- timer.start();
- return a.exec();
- }
Advertisement
Add Comment
Please, Sign In to add comment