MapLibre Native for Qt
Loading...
Searching...
No Matches
gl_widget.hpp
1// Copyright (C) 2023 MapLibre contributors
2
3// SPDX-License-Identifier: BSD-2-Clause
4
5#ifndef QMAPLIBRE_GL_WIDGET_H
6#define QMAPLIBRE_GL_WIDGET_H
7
8#include <QMapLibreWidgets/Export>
9
10#include <QMapLibre/Map>
11#include <QMapLibre/Settings>
12
13#include <QOpenGLWidget>
14
15#include <memory>
16
17QT_BEGIN_NAMESPACE
18
19class QKeyEvent;
20class QMouseEvent;
21class QWheelEvent;
22
23QT_END_NAMESPACE
24
25namespace QMapLibre {
26
27class GLWidgetPrivate;
28
29class Q_MAPLIBRE_WIDGETS_EXPORT GLWidget : public QOpenGLWidget {
30 Q_OBJECT
31
32public:
33 explicit GLWidget(const Settings &);
34 ~GLWidget() override;
35
36 Map *map();
37
38signals:
43
44protected:
45 // QWidget implementation.
46 void mousePressEvent(QMouseEvent *event) override;
47 void mouseReleaseEvent(QMouseEvent *event) override;
48 void mouseMoveEvent(QMouseEvent *event) override;
49 void wheelEvent(QWheelEvent *event) override;
50
51 // Q{,Open}GLWidget implementation.
52 void initializeGL() override;
53 void paintGL() override;
54
55private:
56 Q_DISABLE_COPY(GLWidget)
57
58 std::unique_ptr<GLWidgetPrivate> d_ptr;
59};
60
61} // namespace QMapLibre
62
63#endif // QMAPLIBRE_GL_WIDGET_H
A simple OpenGL widget that displays a QMapLibre::Map.
Definition gl_widget.hpp:29
void onMouseMoveEvent(QMapLibre::Coordinate coordinate)
Emitted when the user moves the mouse.
void onMouseDoubleClickEvent(QMapLibre::Coordinate coordinate)
Emitted when the user double-clicks the mouse.
void onMouseReleaseEvent(QMapLibre::Coordinate coordinate)
Emitted when the user releases the mouse.
void onMousePressEvent(QMapLibre::Coordinate coordinate)
Emitted when the user presses the mouse.
The Map class is a Qt wrapper for the MapLibre Native engine.
Definition map.hpp:28
The Settings class stores the initial configuration for Map.
Definition settings.hpp:27
Definition geojson.cpp:10
QPair< double, double > Coordinate
Coordinate helper type.
Definition types.hpp:20