OGLplus (0.52.0) a C++ wrapper for OpenGL

qt5gl_main.hpp
1 /*
2  * .file example/oglplus/qt5gl_main.hpp
3  * Declares Qt5/GL-based program main function for running examples
4  *
5  * Copyright 2008-2014 Matus Chochlik. Distributed under the Boost
6  * Software License, Version 1.0. (See accompanying file
7  * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8  */
9 
10 #ifndef OGLPLUS_EXAMPLE_QT5GL_MAIN_HPP
11 #define OGLPLUS_EXAMPLE_QT5GL_MAIN_HPP
12 
13 #include <QWidget>
14 #include <QGLWidget>
15 #include <QTime>
16 
17 #include <memory>
18 
19 #include "example.hpp"
20 
21 QT_BEGIN_NAMESPACE
22 class QLabel;
23 class QStatusBar;
24 QT_END_NAMESPACE
25 
26 // The GL-widget used by the example window
27 class OGLplusExampleGLWidget
28  : public QGLWidget
29 {
30 private:
31  Q_OBJECT
32 
33  static QGLFormat getGLFormat(void);
34 
35  int argc;
36  char** argv;
37  const char* screenshot_path;
38 
39  QTime qt_clock;
41  std::shared_ptr<oglplus::Example> example;
42 protected:
43  void initializeGL(void);
44  void paintGL(void);
45  void resizeGL(int width, int height);
46  void mousePressEvent(QMouseEvent *event);
47  void mouseMoveEvent(QMouseEvent *event);
48 
49 signals:
50  void updatedGL(void);
51  void mouseMoved(int, int);
52  void timeUpdated(double, double);
53  void exampleFinished(void);
54 public slots:
55  void setWidth(int);
56  void setHeight(int);
57 public:
58  OGLplusExampleGLWidget(QWidget *parent, int, char**, const char*);
59  ~OGLplusExampleGLWidget(void);
60 
61  QSize minimumSizeHint(void) const;
62  QSize sizeHint(void) const;
63 };
64 
65 // The main example window
66 class OGLplusExampleWindow
67  : public QWidget
68 {
69 private:
70  Q_OBJECT
71 
72  OGLplusExampleGLWidget* gl_widget;
73 
74  QLabel* info_gl_vendor;
75  QLabel* info_gl_renderer;
76  QLabel* info_gl_version;
77 
78  QLabel* info_gl_width;
79  QLabel* info_gl_height;
80 
81  QLabel* info_mouse_x;
82  QLabel* info_mouse_y;
83 
84  QLabel* info_sim_time;
85  QLabel* info_real_time;
86 
87  QStatusBar* status_bar;
88 protected:
89  void keyPressEvent(QKeyEvent *event);
90 
91 public slots:
92  void updateGLInfo(void);
93  void updateMouseInfo(int, int);
94  void updateTimeInfo(double, double);
95 
96 public:
97  OGLplusExampleWindow(int, char**, const char*);
98 };
99 
100 #endif
Declares a common base class for examples.
Class measuring the simulation time of an Example.
Definition: example.hpp:135

Copyright © 2010-2014 Matúš Chochlík, University of Žilina, Žilina, Slovakia.
<matus.chochlik -at- fri.uniza.sk>
<chochlik -at -gmail.com>
Documentation generated on Mon Sep 22 2014 by Doxygen (version 1.8.6).