Main MRPT website > C++ reference for MRPT 1.9.9
CQtGlCanvasBase.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #pragma once
11 #include <mrpt/gui/CGlCanvasBase.h>
12 
13 #include <mrpt/config.h>
14 #if MRPT_HAS_Qt5
15 
16 #include <QtGlobal>
17 #if QT_VERSION < QT_VERSION_CHECK(5, 4, 0)
18 #include <QGLWidget>
19 #define QOpenGLWidget QGLWidget
20 #else
21 #include <QOpenGLWidget>
22 #endif
23 
24 namespace mrpt
25 {
26 namespace gui
27 {
28 class CQtGlCanvasBase : public QOpenGLWidget, public mrpt::gui::CGlCanvasBase
29 {
30  public:
31  CQtGlCanvasBase(QWidget* parent = nullptr);
32  virtual ~CQtGlCanvasBase() = default;
33 
34  virtual void initializeGL() override;
35  virtual void paintGL() override;
36  virtual void resizeGL(int width, int height) override;
37 
38  mrpt::opengl::COpenGLViewport::Ptr mainViewport() const;
39 
40  /** Returns the zoom distance of the camera
41  * See also setZoomDistance(float), getZoomDistance()*/
42  float getCameraZoomDistance() const;
43 
44  protected:
45  virtual void mousePressEvent(QMouseEvent* event) override;
46  virtual void mouseMoveEvent(QMouseEvent* event) override;
47  virtual void mouseReleaseEvent(QMouseEvent* event) override;
48  virtual void wheelEvent(QWheelEvent* event) override;
49 
50  virtual void swapBuffers() override {}
51  virtual void preRender() override {}
52  virtual void postRender() override {}
53  virtual void renderError(const std::string& err_msg) override;
54 
55  virtual void updateCamerasParams();
56  virtual void insertToMap(const opengl::CRenderizable::Ptr& newObject);
57  virtual void removeFromMap(const opengl::CRenderizable::Ptr& newObject);
58 
59  bool isPressLMouseButton() const;
60  bool isPressRMouseButton() const;
61  /** m_isPressLMouseButton and m_isPressRMouseButton are saved in
62  * mousePressEvent for mouseMoveEvent as true
63  * This function sets it as false */
64  void unpressMouseButtons();
65 
66  private:
67  bool m_isPressLMouseButton;
68  bool m_isPressRMouseButton;
69 
71 
72 }; // end of class
73 
74 } // end namespace
75 } // end namespace
76 
77 #endif // MRPT_HAS_Qt5
mrpt::gui::CGlCanvasBase
This base class implements a working with opengl::Camera and a OpenGL canvas, and it's used in gui::C...
Definition: CGlCanvasBase.h:28
mrpt::opengl::CRenderizable::Ptr
std::shared_ptr< CRenderizable > Ptr
Definition: CRenderizable.h:45
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
CGlCanvasBase.h
height
GLenum GLsizei GLsizei height
Definition: glext.h:3554
width
GLenum GLsizei width
Definition: glext.h:3531
string
GLsizei const GLchar ** string
Definition: glext.h:4101
mrpt::opengl::COpenGLViewport::Ptr
std::shared_ptr< COpenGLViewport > Ptr
Definition: COpenGLViewport.h:63



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST