Browse Source

Figure out if device has touch control

QGC4.4
Gus Grubba 6 years ago
parent
commit
54a52c87d5
  1. 2
      src/QGCApplication.h
  2. 6
      src/QmlControls/ScreenToolsController.cc
  3. 7
      src/QmlControls/ScreenToolsController.h

2
src/QGCApplication.h

@ -79,7 +79,7 @@ public:
void showMessage(const QString& message); void showMessage(const QString& message);
/// @return true: Fake ui into showing mobile interface /// @return true: Fake ui into showing mobile interface
bool fakeMobile(void) { return _fakeMobile; } bool fakeMobile(void) const { return _fakeMobile; }
// Still working on getting rid of this and using dependency injection instead for everything // Still working on getting rid of this and using dependency injection instead for everything
QGCToolbox* toolbox(void) { return _toolbox; } QGCToolbox* toolbox(void) { return _toolbox; }

6
src/QmlControls/ScreenToolsController.cc

@ -26,6 +26,12 @@ ScreenToolsController::ScreenToolsController()
} }
bool
ScreenToolsController::hasTouch() const
{
return QTouchDevice::devices().count() > 0 || isMobile();
}
QString QString
ScreenToolsController::iOSDevice() const ScreenToolsController::iOSDevice() const
{ {

7
src/QmlControls/ScreenToolsController.h

@ -37,6 +37,7 @@ public:
Q_PROPERTY(bool isLinux READ isLinux CONSTANT) Q_PROPERTY(bool isLinux READ isLinux CONSTANT)
Q_PROPERTY(bool isWindows READ isWindows CONSTANT) Q_PROPERTY(bool isWindows READ isWindows CONSTANT)
Q_PROPERTY(bool isSerialAvailable READ isSerialAvailable CONSTANT) Q_PROPERTY(bool isSerialAvailable READ isSerialAvailable CONSTANT)
Q_PROPERTY(bool hasTouch READ hasTouch CONSTANT)
Q_PROPERTY(QString iOSDevice READ iOSDevice CONSTANT) Q_PROPERTY(QString iOSDevice READ iOSDevice CONSTANT)
Q_PROPERTY(QString fixedFontFamily READ fixedFontFamily CONSTANT) Q_PROPERTY(QString fixedFontFamily READ fixedFontFamily CONSTANT)
Q_PROPERTY(QString normalFontFamily READ normalFontFamily CONSTANT) Q_PROPERTY(QString normalFontFamily READ normalFontFamily CONSTANT)
@ -47,9 +48,9 @@ public:
Q_INVOKABLE int mouseY(void) { return QCursor::pos().y(); } Q_INVOKABLE int mouseY(void) { return QCursor::pos().y(); }
#if defined(__mobile__) #if defined(__mobile__)
bool isMobile () { return true; } bool isMobile () const { return true; }
#else #else
bool isMobile () { return qgcApp()->fakeMobile(); } bool isMobile () const { return qgcApp()->fakeMobile(); }
#endif #endif
#if defined (Q_OS_ANDROID) #if defined (Q_OS_ANDROID)
@ -102,6 +103,8 @@ public:
bool isDebug () { return false; } bool isDebug () { return false; }
#endif #endif
bool hasTouch() const;
QString iOSDevice () const; QString iOSDevice () const;
QString fixedFontFamily () const; QString fixedFontFamily () const;
QString normalFontFamily () const; QString normalFontFamily () const;

Loading…
Cancel
Save