QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
ScreenToolsController.cc
Go to the documentation of this file.
2#include "QGCApplication.h"
4#include "SettingsManager.h"
5#include "AppSettings.h"
6
7#include <QtGui/QCursor>
8#include <QtGui/QFontDatabase>
9#include <QtGui/QFontMetrics>
10#include <QtGui/QInputDevice>
11
12#if defined(Q_OS_IOS)
13#include <sys/utsname.h>
14#endif
15
16QGC_LOGGING_CATEGORY(ScreenToolsControllerLog, "QMLControls.ScreenToolsController")
17
19 : QObject(parent)
20{
21 // qCDebug(ScreenToolsControllerLog) << Q_FUNC_INFO << this;
22}
23
25{
26 // qCDebug(ScreenToolsControllerLog) << Q_FUNC_INFO << this;
27}
28
30{
31 return QCursor::pos().x();
32}
33
35{
36 return QCursor::pos().y();
37}
38
40{
41 for (const auto &inputDevice: QInputDevice::devices()) {
42 if (inputDevice->type() == QInputDevice::DeviceType::TouchScreen) {
43 return true;
44 }
45 }
46 return false;
47}
48
50{
51#if defined(Q_OS_IOS)
52 struct utsname systemInfo;
53 uname(&systemInfo);
54 return QString(systemInfo.machine);
55#else
56 return QString();
57#endif
58}
59
61{
62 return QFontDatabase::systemFont(QFontDatabase::FixedFont).family();
63}
64
66{
67 //-- See App.SettinsGroup.json for index
68 const int langID = SettingsManager::instance()->appSettings()->qLocaleLanguage()->rawValue().toInt();
69 if (langID == QLocale::Korean) {
70 return QStringLiteral("NanumGothic");
71 }
72
73 return QStringLiteral("Open Sans");
74}
75
77{
78 return QFontMetrics(QFont(normalFontFamily(), pointSize)).descent();
79}
80
81#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
83{
84 return qgcApp()->fakeMobile();
85}
86#endif
#define qgcApp()
#define QGC_LOGGING_CATEGORY(name, categoryStr)
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)
static SettingsManager * instance()
AppSettings * appSettings() const