QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
qgs3dgamepadcontroller.h
Go to the documentation of this file.
1/***************************************************************************
2 qgs3dgamepadcontroller.h
3 ---------------------
4 begin : March 2023
5 copyright : (C) 2023 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGS3DGAMEPADCONTROLLER_H
17#define QGS3DGAMEPADCONTROLLER_H
18
19#include "qgis_sip.h"
20#include "qgsconfig.h"
21
22SIP_IF_MODULE( HAVE_QTGAMEPAD )
23
24#ifdef HAVE_QTGAMEPAD
25
26#include "qgis_gui.h"
27#include "qgis.h"
28#include "qgs3dmapcontroller.h"
29
30#include <QPointer>
31
32#ifdef SIP_RUN
33// this is needed for the "convert to subclass" code below to compile
34//%ModuleHeaderCode
36//%End
37#endif
38
39class QGamepad;
40
41
49class GUI_EXPORT QgsGamepad3DMapController : public QgsAbstract3DMapController
50{
51 Q_OBJECT
52
53#ifdef SIP_RUN
55 if ( qobject_cast<QgsGamepad3DMapController *>( sipCpp ) )
56
57 sipType = sipType_QgsGamepad3DMapController;
58 else
59 sipType = nullptr;
61#endif
62
63 public:
67 QgsGamepad3DMapController( int gamepadDeviceId, QObject *parent SIP_TRANSFERTHIS = nullptr );
68
69 QgsGamepad3DMapController *clone() const override SIP_FACTORY;
70 QString deviceId() const override;
71
72 // proxy QGamepad signals and properties here, as QGamepad isn't accessible from Python.
73 // Ideally we would share these with QgsGamepad3DMapController, but that would create a diamond
74 // inheritance
75
79 bool isConnected() const;
80
84 QString name() const;
85
89 double axisLeftX() const;
90
94 double axisLeftY() const;
95
99 double axisRightX() const;
100
104 double axisRightY() const;
105
109 bool buttonA() const;
110
114 bool buttonB() const;
115
119 bool buttonX() const;
120
124 bool buttonY() const;
125
129 bool buttonL1() const;
130
134 bool buttonR1() const;
135
139 double buttonL2() const;
140
144 double buttonR2() const;
145
151 bool buttonSelect() const;
152
158 bool buttonStart() const;
159
165 bool buttonL3() const;
166
172 bool buttonR3() const;
173
177 bool buttonUp() const;
178
182 bool buttonDown() const;
183
187 bool buttonLeft() const;
188
192 bool buttonRight() const;
193
197 bool buttonCenter() const;
198
204 bool buttonGuide() const;
205
206
207 signals:
208
209
213 void connectedChanged( bool value );
214
220 void axisLeftXChanged( double value );
221
227 void axisLeftYChanged( double value );
228
234 void axisRightXChanged( double value );
235
241 void axisRightYChanged( double value );
242
248 void buttonAChanged( bool value );
249
255 void buttonBChanged( bool value );
256
262 void buttonXChanged( bool value );
263
269 void buttonYChanged( bool value );
270
276 void buttonL1Changed( bool value );
277
283 void buttonR1Changed( bool value );
284
290 void buttonL2Changed( double value );
291
297 void buttonR2Changed( double value );
298
304 void buttonSelectChanged( bool value );
305
311 void buttonStartChanged( bool value );
312
318 void buttonL3Changed( bool value );
319
325 void buttonR3Changed( bool value );
326
332 void buttonUpChanged( bool value );
333
339 void buttonDownChanged( bool value );
340
346 void buttonLeftChanged( bool value );
347
353 void buttonRightChanged( bool value );
354
360 void buttonCenterChanged( bool value );
361
367 void buttonGuideChanged( bool value );
368
369 private:
370 int mGamepadDeviceId = -1;
371 QPointer<QGamepad> mGamepad;
372};
373
374
375#endif
376
377#endif // QGS3DGAMEPADCONTROLLER_H
Abstract base class for all 3D map controllers.
virtual QgsAbstractInputController * clone() const =0
Returns a new copy of the controller.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition qgis_sip.h:191
#define SIP_IF_MODULE(condition)
Definition qgis_sip.h:28
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_FACTORY
Definition qgis_sip.h:76
#define SIP_END
Definition qgis_sip.h:208