QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
ScreenToolsController.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QObject>
4#include <QtQmlIntegration/QtQmlIntegration>
5
8class ScreenToolsController : public QObject
9{
10 Q_OBJECT
11 QML_ELEMENT
12 QML_SINGLETON
13 Q_PROPERTY(bool isAndroid READ isAndroid CONSTANT)
14 Q_PROPERTY(bool isiOS READ isiOS CONSTANT)
15 Q_PROPERTY(bool isMobile READ isMobile CONSTANT)
16 Q_PROPERTY(bool fakeMobile READ fakeMobile CONSTANT)
17 Q_PROPERTY(bool isDebug READ isDebug CONSTANT)
18 Q_PROPERTY(bool isMacOS READ isMacOS CONSTANT)
19 Q_PROPERTY(bool isLinux READ isLinux CONSTANT)
20 Q_PROPERTY(bool isWindows READ isWindows CONSTANT)
21 Q_PROPERTY(bool isSerialAvailable READ isSerialAvailable CONSTANT)
22 Q_PROPERTY(bool hasTouch READ hasTouch CONSTANT)
23 Q_PROPERTY(QString iOSDevice READ iOSDevice CONSTANT)
24 Q_PROPERTY(QString fixedFontFamily READ fixedFontFamily CONSTANT)
25 Q_PROPERTY(QString normalFontFamily READ normalFontFamily CONSTANT)
26
27public:
28 explicit ScreenToolsController(QObject *parent = nullptr);
30
32 Q_INVOKABLE static int mouseX();
33 Q_INVOKABLE static int mouseY();
34
35 // QFontMetrics::descent for default font
36 Q_INVOKABLE static double defaultFontDescent(int pointSize);
37
38#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
39 static bool isMobile() { return true; }
40 static bool fakeMobile() { return false; }
41#else
42 static bool isMobile() { return fakeMobile(); }
43 static bool fakeMobile();
44#endif
45
46#if defined (Q_OS_ANDROID)
47 static bool isAndroid() { return true; }
48 static bool isiOS() { return false; }
49 static bool isLinux() { return false; }
50 static bool isMacOS() { return false; }
51 static bool isWindows() { return false; }
52#elif defined(Q_OS_IOS)
53 static bool isAndroid() { return false; }
54 static bool isiOS() { return true; }
55 static bool isLinux() { return false; }
56 static bool isMacOS() { return false; }
57 static bool isWindows() { return false; }
58#elif defined(Q_OS_MACOS)
59 static bool isAndroid() { return false; }
60 static bool isiOS() { return false; }
61 static bool isLinux() { return false; }
62 static bool isMacOS() { return true; }
63 static bool isWindows() { return false; }
64#elif defined(Q_OS_LINUX)
65 static bool isAndroid() { return false; }
66 static bool isiOS() { return false; }
67 static bool isLinux() { return true; }
68 static bool isMacOS() { return false; }
69 static bool isWindows() { return false; }
70#elif defined(Q_OS_WIN)
71 static bool isAndroid() { return false; }
72 static bool isiOS() { return false; }
73 static bool isLinux() { return false; }
74 static bool isMacOS() { return false; }
75 static bool isWindows() { return true; }
76#else
77 static bool isAndroid() { return false; }
78 static bool isiOS() { return false; }
79 static bool isLinux() { return false; }
80 static bool isMacOS() { return false; }
81 static bool isWindows() { return false; }
82#endif
83
84#if defined(QGC_NO_SERIAL_LINK)
85 static bool isSerialAvailable() { return false; }
86#else
87 static bool isSerialAvailable() { return true; }
88#endif
89
90#ifdef QT_DEBUG
91 static bool isDebug() { return true; }
92#else
93 static bool isDebug() { return false; }
94#endif
95
96 static bool hasTouch();
97 static QString iOSDevice();
98 static QString fixedFontFamily();
99 static QString normalFontFamily();
100};
This Qml control is used to return screen parameters.
static QString normalFontFamily()
static Q_INVOKABLE int mouseY()
static Q_INVOKABLE int mouseX()
Returns current mouse position.
static Q_INVOKABLE double defaultFontDescent(int pointSize)