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