Guest User

Untitled

a guest
Apr 3rd, 2015
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. #include <QApplication>
  2. #include <QDialog>
  3. #include <QOpenGLWidget>
  4. #include <QLayout>
  5. #include <QTimer>
  6.  
  7. class GLDialog : public QDialog
  8. {
  9. public:
  10. GLDialog()
  11. {
  12. QOpenGLWidget *glw = new QOpenGLWidget;
  13. QVBoxLayout *layout = new QVBoxLayout;
  14. layout->addWidget(glw);
  15. setLayout(layout);
  16. setGeometry(64, 64, 1024, 768);
  17. }
  18. };
  19.  
  20. int main(int argc, char *argv[])
  21. {
  22. QApplication a(argc, argv);
  23.  
  24. quint64 count = 0;
  25. QTimer timer;
  26. timer.setSingleShot(false);
  27. timer.setInterval(100);
  28.  
  29. QDialog makeTheAppNotQuit(NULL, Qt::Window);
  30. makeTheAppNotQuit.show();
  31.  
  32. QObject::connect(&timer, &QTimer::timeout, [&timer, &count]
  33. {
  34. count++;
  35. if(count % 50 == 0) timer.setInterval(5000); // Give us some time to take a look at the memory usage
  36. else timer.setInterval(100);
  37.  
  38. GLDialog *dlg = new GLDialog;
  39. dlg->show();
  40. delete dlg;
  41. });
  42.  
  43. timer.start();
  44.  
  45. return a.exec();
  46. }
Advertisement
Add Comment
Please, Sign In to add comment