diff --git a/QGCApplication.pro b/QGCApplication.pro index 27b68f301321b812469dbad38b01dfe34ae9f500..f7a22ebcc82815fe9d61b7919d89866572614bc8 100644 --- a/QGCApplication.pro +++ b/QGCApplication.pro @@ -267,7 +267,7 @@ HEADERS += \ src/QGCTemporaryFile.h \ src/QmlControls/MavManager.h \ src/QmlControls/ParameterEditorController.h \ - src/QmlControls/ScreenTools.h \ + src/QmlControls/ScreenToolsController.h \ src/uas/QGCMAVLinkUASFactory.h \ src/uas/FileManager.h \ src/uas/UAS.h \ @@ -398,7 +398,7 @@ SOURCES += \ src/QGCTemporaryFile.cc \ src/QmlControls/MavManager.cc \ src/QmlControls/ParameterEditorController.cc \ - src/QmlControls/ScreenTools.cc \ + src/QmlControls/ScreenToolsController.cc \ src/uas/QGCMAVLinkUASFactory.cc \ src/uas/FileManager.cc \ src/uas/UAS.cc \ diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index 13c465a06380aae4789a5b33b36fbc0d85e5f08f..0386ebee848fd84e5c0408c3e358c54573182a1b 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -15,7 +15,7 @@ src/FactSystem/FactControls/FactCheckBox.qml src/FactSystem/FactControls/FactComboBox.qml - src/QmlControls/qmldir + src/QmlControls/QGroundControl.Controls.qmldir src/QmlControls/QGCButton.qml src/QmlControls/QGCRadioButton.qml src/QmlControls/QGCCheckBox.qml @@ -26,6 +26,10 @@ src/QmlControls/QGCToolBarButton.qml src/QmlControls/QGCMovableItem.qml + src/QmlControls/QGroundControl.ScreenTools.qmldir + src/QmlControls/ScreenTools.qml + src/QmlControls/ScreenToolsFontQuery.qml + src/QmlControls/SubMenuButton.qml src/QmlControls/IndicatorButton.qml src/QmlControls/VehicleRotationCal.qml diff --git a/src/AutoPilotPlugins/PX4/FlightModesComponent.qml b/src/AutoPilotPlugins/PX4/FlightModesComponent.qml index e0e4909b877ac5c488a91f72c21902ad68887ed7..62cf5023a422e0b51f39b22d049c6a8aceaf1beb 100644 --- a/src/AutoPilotPlugins/PX4/FlightModesComponent.qml +++ b/src/AutoPilotPlugins/PX4/FlightModesComponent.qml @@ -972,8 +972,8 @@ Item { spacing: 20 QGCLabel { - text: "FLIGHT MODES CONFIG" - font.pixelSize: ScreenTools.font20; + text: "FLIGHT MODES CONFIG" + font.pixelSize: ScreenTools.largeFontPixelSize } QGCLabel { diff --git a/src/AutoPilotPlugins/PX4/PowerComponent.qml b/src/AutoPilotPlugins/PX4/PowerComponent.qml index 12f1279379a192b71a831e9e1a912d0e44076ac7..5631b1fd9e5da57bba7e876720103233d7439218 100644 --- a/src/AutoPilotPlugins/PX4/PowerComponent.qml +++ b/src/AutoPilotPlugins/PX4/PowerComponent.qml @@ -179,7 +179,7 @@ QGCView { antialiasing: true Connections { target: ScreenTools - onRepaintRequestedChanged: { + onRepaintRequested: { arrows.requestPaint(); } } @@ -269,7 +269,7 @@ QGCView { width: (parent.width / 2) - 5 QGCLabel { text: "Propeller Function" - font.pixelSize: ScreenTools.font20; + font.pixelSize: ScreenTools.mediumFontPixelSize } Rectangle { width: parent.width @@ -282,7 +282,7 @@ QGCView { width: (parent.width / 2) - 5 QGCLabel { text: "Magnetometer Distortion" - font.pixelSize: ScreenTools.font20; + font.pixelSize: ScreenTools.mediumFontPixelSize } Rectangle { width: parent.width @@ -300,9 +300,9 @@ QGCView { text: "Show Advanced Settings" } QGCLabel { - text: "Advanced Power Settings" - font.pixelSize: ScreenTools.font20; - visible: showAdvanced.checked + text: "Advanced Power Settings" + font.pixelSize: ScreenTools.mediumFontPixelSize + visible: showAdvanced.checked } Rectangle { width: parent.width diff --git a/src/AutoPilotPlugins/PX4/SensorsComponent.qml b/src/AutoPilotPlugins/PX4/SensorsComponent.qml index 3b3dccac13da4d691d27a5568f9746f600c71932..9db31196a81ef4e68a1ed323aa2dc002389b4115 100644 --- a/src/AutoPilotPlugins/PX4/SensorsComponent.qml +++ b/src/AutoPilotPlugins/PX4/SensorsComponent.qml @@ -405,16 +405,16 @@ QGCView { color: qgcPal.windowShade QGCLabel { - id: orientationCalAreaHelpText - width: parent.width - wrapMode: Text.WordWrap - font.pixelSize: ScreenTools.font22; - anchors.top: orientationCalArea.top - anchors.left: orientationCalArea.left - anchors.topMargin: 15 - anchors.leftMargin: 15 - anchors.rightMargin: 15 - anchors.bottomMargin: 15 + id: orientationCalAreaHelpText + width: parent.width + wrapMode: Text.WordWrap + font.pixelSize: ScreenTools.mediumFontPixelSize + anchors.top: orientationCalArea.top + anchors.left: orientationCalArea.left + anchors.topMargin: 15 + anchors.leftMargin: 15 + anchors.rightMargin: 15 + anchors.bottomMargin: 15 } Flow { diff --git a/src/QGCApplication.cc b/src/QGCApplication.cc index e79ded5fc0f58e6d955e11e20f67a9cda6918811..b31af8540463028d490997925cd86e3ea47ac573 100644 --- a/src/QGCApplication.cc +++ b/src/QGCApplication.cc @@ -69,13 +69,13 @@ #include "SensorsComponentController.h" #include "PowerComponentController.h" #include "RadioComponentController.h" +#include "ScreenToolsController.h" #ifndef __mobile__ #include "FirmwareUpgradeController.h" #endif #include "AutoPilotPlugin.h" #include "VehicleComponent.h" -#include "ScreenTools.h" #include "MavManager.h" #ifdef QGC_RTLAB_ENABLED @@ -104,10 +104,10 @@ const char* QGCApplication::_lightStyleFile = ":/res/styles/style-light.css"; * This is called by the QtQuick engine for creating the singleton **/ -static QObject* screenToolsSingletonFactory(QQmlEngine*, QJSEngine*) +static QObject* screenToolsControllerSingletonFactory(QQmlEngine*, QJSEngine*) { - ScreenTools* screenTools = new ScreenTools; - return screenTools; + ScreenToolsController* screenToolsController = new ScreenToolsController; + return screenToolsController; } /** @@ -261,6 +261,33 @@ void QGCApplication::_initCommon(void) { QSettings settings; + // Register our Qml objects + + qmlRegisterType("QGroundControl.Palette", 1, 0, "QGCPalette"); + + qmlRegisterUncreatableType("QGroundControl.AutoPilotPlugin", 1, 0, "AutoPilotPlugin", "Can only reference, cannot create"); + qmlRegisterUncreatableType("QGroundControl.AutoPilotPlugin", 1, 0, "VehicleComponent", "Can only reference, cannot create"); + + qmlRegisterType("QGroundControl.Controllers", 1, 0, "ViewWidgetController"); + qmlRegisterType("QGroundControl.Controllers", 1, 0, "ParameterEditorController"); + qmlRegisterType("QGroundControl.Controllers", 1, 0, "CustomCommandWidgetController"); + qmlRegisterType("QGroundControl.Controllers", 1, 0, "FlightModesComponentController"); + qmlRegisterType("QGroundControl.Controllers", 1, 0, "AirframeComponentController"); + qmlRegisterType("QGroundControl.Controllers", 1, 0, "SensorsComponentController"); + qmlRegisterType("QGroundControl.Controllers", 1, 0, "PowerComponentController"); + qmlRegisterType("QGroundControl.Controllers", 1, 0, "RadioComponentController"); + qmlRegisterType("QGroundControl.Controllers", 1, 0, "ScreenToolsController"); + +#ifndef __mobile__ + qmlRegisterType("QGroundControl.Controllers", 1, 0, "FirmwareUpgradeController"); +#endif + + //-- Create QML Singleton Interfaces + qmlRegisterSingletonType("QGroundControl.ScreenToolsController", 1, 0, "ScreenToolsController", screenToolsControllerSingletonFactory); + qmlRegisterSingletonType("QGroundControl.MavManager", 1, 0, "MavManager", mavManagerSingletonFactory); + + //-- Register Waypoint Interface + qmlRegisterInterface("Waypoint"); // Show user an upgrade message if the settings version has been bumped up bool settingsUpgraded = false; if (settings.contains(_settingsVersionKey)) { @@ -314,42 +341,6 @@ void QGCApplication::_initCommon(void) } qDebug() << "Saved files location" << savedFilesLocation; settings.setValue(_savedFilesLocationKey, savedFilesLocation); - - // Load application font - QFontDatabase fontDatabase = QFontDatabase(); - const QString fontFileName = ":/res/fonts/vera.ttf"; ///< Font file is part of the QRC file and compiled into the app - //const QString fontFamilyName = "Bitstream Vera Sans"; - if(!QFile::exists(fontFileName)) printf("ERROR! font file: %s DOES NOT EXIST!\n", fontFileName.toStdString().c_str()); - fontDatabase.addApplicationFont(fontFileName); - // Avoid Using setFont(). In the Qt docu you can read the following: - // "Warning: Do not use this function in conjunction with Qt Style Sheets." - // setFont(fontDatabase.font(fontFamilyName, "Roman", 12)); - - // Register our Qml objects - - qmlRegisterType("QGroundControl.Palette", 1, 0, "QGCPalette"); - - qmlRegisterUncreatableType("QGroundControl.AutoPilotPlugin", 1, 0, "AutoPilotPlugin", "Can only reference, cannot create"); - qmlRegisterUncreatableType("QGroundControl.AutoPilotPlugin", 1, 0, "VehicleComponent", "Can only reference, cannot create"); - - qmlRegisterType("QGroundControl.Controllers", 1, 0, "ViewWidgetController"); - qmlRegisterType("QGroundControl.Controllers", 1, 0, "ParameterEditorController"); - qmlRegisterType("QGroundControl.Controllers", 1, 0, "CustomCommandWidgetController"); - qmlRegisterType("QGroundControl.Controllers", 1, 0, "FlightModesComponentController"); - qmlRegisterType("QGroundControl.Controllers", 1, 0, "AirframeComponentController"); - qmlRegisterType("QGroundControl.Controllers", 1, 0, "SensorsComponentController"); - qmlRegisterType("QGroundControl.Controllers", 1, 0, "PowerComponentController"); - qmlRegisterType("QGroundControl.Controllers", 1, 0, "RadioComponentController"); -#ifndef __mobile__ - qmlRegisterType("QGroundControl.Controllers", 1, 0, "FirmwareUpgradeController"); -#endif - - //-- Create QML Singleton Interfaces - qmlRegisterSingletonType("QGroundControl.ScreenTools", 1, 0, "ScreenTools", screenToolsSingletonFactory); - qmlRegisterSingletonType("QGroundControl.MavManager", 1, 0, "MavManager", mavManagerSingletonFactory); - - //-- Register Waypoint Interface - qmlRegisterInterface("Waypoint"); } bool QGCApplication::_initForNormalAppBoot(void) @@ -656,10 +647,12 @@ void QGCApplication::_loadCurrentStyle(void) } // Now that we have the styles loaded we need to adjust the font sizes. - - QString fSmall = QString("%1px;").arg(ScreenTools::font10_s()); - QString fNormal = QString("%1px;").arg(ScreenTools::defaultFontPizelSize_s()); - QString fLarge = QString("%1px;").arg(ScreenTools::largeFontPixelSize_s()); + + QString fSmall = QString("%1px;").arg(ScreenToolsController::smallFontPixelSize_s()); + QString fNormal = QString("%1px;").arg(ScreenToolsController::defaultFontPixelSize_s()); + QString fLarge = QString("%1px;").arg(ScreenToolsController::largeFontPixelSize_s()); + + qDebug() << fSmall << fNormal << fLarge; styles.replace("FONT_SMALL", fSmall); styles.replace("FONT_NORMAL", fNormal); diff --git a/src/QGCPalette.cc b/src/QGCPalette.cc index dfc6deb0c88e4e81dbbb7e7841210cceea0e8ec4..c693cd99d1f988f30613b2666fd2cfc299988bb3 100644 --- a/src/QGCPalette.cc +++ b/src/QGCPalette.cc @@ -25,7 +25,6 @@ /// @author Don Gagne #include "QGCPalette.h" -#include "ScreenTools.h" #include #include diff --git a/src/QmlControls/ParameterEditor.qml b/src/QmlControls/ParameterEditor.qml index 0250b87fe6c22bb63c0c50565052cba64639a8e0..8d9db803db4d74cf0d0edc961e967c81f25f11aa 100644 --- a/src/QmlControls/ParameterEditor.qml +++ b/src/QmlControls/ParameterEditor.qml @@ -63,10 +63,10 @@ QGCView { x: __leftMargin QGCLabel { - height: defaultTextHeight + (ScreenTools.pixelSizeFactor * (9)) + height: defaultTextHeight + (ScreenTools.defaultFontPizelSize * 0.5) text: group verticalAlignment: Text.AlignVCenter - font.pixelSize: ScreenTools.font16; + font.pixelSize: ScreenTools.mediumFontPixelSize } Rectangle { @@ -84,7 +84,7 @@ QGCView { Item { x: __leftMargin width: parent.width - height: defaultTextHeight + (ScreenTools.pixelSizeFactor * (9)) + height: defaultTextHeight + (ScreenTools.defaultFontPixelSize * 0.5) QGCLabel { id: nameLabel @@ -142,7 +142,7 @@ QGCView { height: firstButton.height QGCLabel { - font.pixelSize: ScreenTools.font20; + font.pixelSize: ScreenTools.largeFontPixelSize visible: fullMode text: "PARAMETER EDITOR" } @@ -199,10 +199,10 @@ QGCView { readonly property int componentId: parseInt(modelData) QGCLabel { - height: contentHeight + (ScreenTools.pixelSizeFactor * (9)) + height: contentHeight + (ScreenTools.defaultFontPixelHeight * 0.5) text: "Component #: " + componentId.toString() verticalAlignment: Text.AlignVCenter - font.pixelSize: ScreenTools.font16; + font.pixelSize: ScreenTools.mediumFontPixelSize } Repeater { @@ -224,7 +224,7 @@ QGCView { Item { width: 1 - height: ScreenTools.pixelSizeFactor * (3) + height: ScreenTools.defaultFontPixelSize * 0.25 } } // Column - Group } // Repeater - Groups diff --git a/src/QmlControls/QGCButton.qml b/src/QmlControls/QGCButton.qml index 02ba38d3765f75edad40daaa4696631a2fc40890..9a84a844d09852757016cd3cb347259a1ee29f08 100644 --- a/src/QmlControls/QGCButton.qml +++ b/src/QmlControls/QGCButton.qml @@ -26,12 +26,12 @@ Button { Connections { target: __behavior onMouseXChanged: { - __lastGlobalMouseX = ScreenTools.mouseX - __lastGlobalMouseY = ScreenTools.mouseY + __lastGlobalMouseX = ScreenTools.mouseX() + __lastGlobalMouseY = ScreenTools.mouseY() } onMouseYChanged: { - __lastGlobalMouseX = ScreenTools.mouseX - __lastGlobalMouseY = ScreenTools.mouseY + __lastGlobalMouseX = ScreenTools.mouseX() + __lastGlobalMouseY = ScreenTools.mouseY() } onEntered: { __forceHoverOff; false; hoverTimer.start() } onExited: { __forceHoverOff; false; hoverTimer.stop() } @@ -43,7 +43,7 @@ Button { repeat: true onTriggered: { - if (__lastGlobalMouseX != ScreenTools.mouseX || __lastGlobalMouseY != ScreenTools.mouseY) { + if (__lastGlobalMouseX != ScreenTools.mouseX() || __lastGlobalMouseY != ScreenTools.mouseY()) { __forceHoverOff = true } else { __forceHoverOff = false @@ -104,7 +104,7 @@ Button { id: text antialiasing: true text: control.text - font.pixelSize: ScreenTools.defaultFontPizelSize + font.pixelSize: ScreenTools.defaultFontPixelSize anchors.verticalCenter: parent.verticalCenter diff --git a/src/QmlControls/QGCCheckBox.qml b/src/QmlControls/QGCCheckBox.qml index 84f990bae54b121314d29915f26a3bca75dba0f5..c68d40fbe1eda82273867f6a571a99fb827a376f 100644 --- a/src/QmlControls/QGCCheckBox.qml +++ b/src/QmlControls/QGCCheckBox.qml @@ -29,7 +29,7 @@ CheckBox { id: text text: control.text antialiasing: true - font.pixelSize: ScreenTools.defaultFontPizelSize + font.pixelSize: ScreenTools.defaultFontPixelSize anchors.centerIn: parent diff --git a/src/QmlControls/QGCComboBox.qml b/src/QmlControls/QGCComboBox.qml index e9849ec6529ff2f7fe3481b42d8599d3805f74d9..9163aa35441374926fae73874e5406cdab04be61 100644 --- a/src/QmlControls/QGCComboBox.qml +++ b/src/QmlControls/QGCComboBox.qml @@ -11,7 +11,7 @@ ComboBox { property bool __showHighlight: pressed | hovered style: ComboBoxStyle { - font.pixelSize: ScreenTools.defaultFontPizelSize + font.pixelSize: ScreenTools.defaultFontPixelSize textColor: __showHighlight ? control.__qgcPal.buttonHighlightText : control.__qgcPal.buttonText diff --git a/src/QmlControls/QGCLabel.qml b/src/QmlControls/QGCLabel.qml index 0b3eafdd509bfcf757e4aa549c496089f0ff24f5..070e7c7baebdd823c63300772c15933714e75708 100644 --- a/src/QmlControls/QGCLabel.qml +++ b/src/QmlControls/QGCLabel.qml @@ -10,7 +10,7 @@ Text { property bool enabled: true - font.pixelSize: ScreenTools.defaultFontPizelSize + font.pixelSize: ScreenTools.defaultFontPixelSize color: __qgcPal.text antialiasing: true } diff --git a/src/QmlControls/QGCMovableItem.qml b/src/QmlControls/QGCMovableItem.qml index b16f20c7ca281510ed10a543a38d1b7c93e0364a..0c363b22ee8e10c09fd7922b808161b897eec17f 100644 --- a/src/QmlControls/QGCMovableItem.qml +++ b/src/QmlControls/QGCMovableItem.qml @@ -9,8 +9,8 @@ import QGroundControl.ScreenTools 1.0 Item { id: root property bool allowDragging: true - property real minimumWidth: ScreenTools.pixelSizeFactor * (60) - property real minimumHeight: ScreenTools.pixelSizeFactor * (60) + property real minimumWidth: ScreenTools.defaultFontPixelSize * (5) + property real minimumHeight: ScreenTools.defaultFontPixelSize * (5) property alias tForm: tform signal resetRequested() transform: Scale { diff --git a/src/QmlControls/QGCRadioButton.qml b/src/QmlControls/QGCRadioButton.qml index 099038fb65810f108cacac2c75392bb90533e0bb..1894bd93a7cfa49f2286a15751b21368c9b4584f 100644 --- a/src/QmlControls/QGCRadioButton.qml +++ b/src/QmlControls/QGCRadioButton.qml @@ -28,7 +28,7 @@ RadioButton { Text { id: text text: control.text - font.pixelSize: ScreenTools.defaultFontPizelSize + font.pixelSize: ScreenTools.defaultFontPixelSize antialiasing: true anchors.centerIn: parent diff --git a/src/QmlControls/QGCTextField.qml b/src/QmlControls/QGCTextField.qml index a5c2d1c1613ad8072cd697f7910dcd0f40412284..ba3f678f7dbd886f2e6315027fdd18e478de14d0 100644 --- a/src/QmlControls/QGCTextField.qml +++ b/src/QmlControls/QGCTextField.qml @@ -50,7 +50,7 @@ TextField { width: unitsLabelWidthGenerator.width text: control.unitsLabel - font.pixelSize: ScreenTools.defaultFontPizelSize + font.pixelSize: ScreenTools.defaultFontPixelSize antialiasing: true color: control.textColor diff --git a/src/QmlControls/qmldir b/src/QmlControls/QGroundControl.Controls.qmldir similarity index 100% rename from src/QmlControls/qmldir rename to src/QmlControls/QGroundControl.Controls.qmldir diff --git a/src/QmlControls/QGroundControl.ScreenTools.qmldir b/src/QmlControls/QGroundControl.ScreenTools.qmldir new file mode 100644 index 0000000000000000000000000000000000000000..5b057e914f76023866fc5e7a7a47b960eed55b6f --- /dev/null +++ b/src/QmlControls/QGroundControl.ScreenTools.qmldir @@ -0,0 +1,3 @@ +Module QGroundControl.ScreenTools + +singleton ScreenTools 1.0 ScreenTools.qml diff --git a/src/QmlControls/ScreenTools.cc b/src/QmlControls/ScreenTools.cc deleted file mode 100644 index 70326f967bf7875c866b69c4859d6b459e6d9f6d..0000000000000000000000000000000000000000 --- a/src/QmlControls/ScreenTools.cc +++ /dev/null @@ -1,92 +0,0 @@ -/*===================================================================== - - QGroundControl Open Source Ground Control Station - - (c) 2009, 2015 QGROUNDCONTROL PROJECT - - This file is part of the QGROUNDCONTROL project - - QGROUNDCONTROL is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - QGROUNDCONTROL is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with QGROUNDCONTROL. If not, see . - - ======================================================================*/ - -/// @file -/// @author Gus Grubba - -#include "ScreenTools.h" -#include "MainWindow.h" - -// Pixel size, instead of a physical thing is actually a philosophical question when -// it comes to Qt. -// The values below came from actually measuring the elements on the screen on these -// devices. I have yet to find a constant from Qt so these things can be properly -// computed at runtime. - -#if defined(Q_OS_OSX) -double ScreenTools::_pixelFactor = 1.0; -#elif defined(__ios__) -double ScreenTools::_pixelFactor = 0.75; -#elif defined(Q_OS_WIN) -double ScreenTools::_pixelFactor = 0.86; -#elif defined(__android__) -double ScreenTools::_pixelFactor = 2.5; -#elif defined(Q_OS_LINUX) -double ScreenTools::_pixelFactor = 1.0; -#endif - -#if defined(__android__) -#define FONT_FACTOR 2 -#else -#define FONT_FACTOR 1 -#endif - -int ScreenTools::_font8 = 8 * FONT_FACTOR; -int ScreenTools::_font9 = 9 * FONT_FACTOR; -int ScreenTools::_font10 = 10 * FONT_FACTOR; -int ScreenTools::_font11 = 11 * FONT_FACTOR; -int ScreenTools::_font12 = 12 * FONT_FACTOR; -int ScreenTools::_font13 = 13 * FONT_FACTOR; -int ScreenTools::_font14 = 14 * FONT_FACTOR; -int ScreenTools::_font15 = 15 * FONT_FACTOR; -int ScreenTools::_font16 = 16 * FONT_FACTOR; -int ScreenTools::_font17 = 17 * FONT_FACTOR; -int ScreenTools::_font18 = 18 * FONT_FACTOR; -int ScreenTools::_font19 = 19 * FONT_FACTOR; -int ScreenTools::_font20 = 20 * FONT_FACTOR; -int ScreenTools::_font21 = 21 * FONT_FACTOR; -int ScreenTools::_font22 = 22 * FONT_FACTOR; - -ScreenTools::ScreenTools() -{ - MainWindow* mainWindow = MainWindow::instance(); - // Unit tests can run Qml without MainWindow - if (mainWindow) { - connect(mainWindow, &MainWindow::repaintCanvas, this, &ScreenTools::_updateCanvas); - } -} - -qreal ScreenTools::adjustPixelSize(qreal pixelSize) -{ - return adjustPixelSize_s(pixelSize); -} - -qreal ScreenTools::adjustPixelSize_s(qreal pixelSize) -{ - return pixelSize * _pixelFactor; -} - -void ScreenTools::_updateCanvas() -{ - emit repaintRequestedChanged(); -} diff --git a/src/QmlControls/ScreenTools.h b/src/QmlControls/ScreenTools.h deleted file mode 100644 index 2f73ae8f7c3f316362a84bf0c13ae4dde701c2d4..0000000000000000000000000000000000000000 --- a/src/QmlControls/ScreenTools.h +++ /dev/null @@ -1,206 +0,0 @@ -/*===================================================================== - - QGroundControl Open Source Ground Control Station - - (c) 2009, 2015 QGROUNDCONTROL PROJECT - - This file is part of the QGROUNDCONTROL project - - QGROUNDCONTROL is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - QGROUNDCONTROL is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with QGROUNDCONTROL. If not, see . - - ======================================================================*/ - -/// @file -/// @author Gus Grubba - -#ifndef SCREENTOOLS_H -#define SCREENTOOLS_H - -#include -#include - -/*! - @brief Screen helper tools for QML widgets - To use its functions, you need to import the module with the following line: - @code - import QGroundControl.ScreenTools 1.0 - @endcode -*/ - -/// This Qml control is used to return screen parameters -class ScreenTools : public QObject -{ - Q_OBJECT -public: - ScreenTools(); - - Q_PROPERTY(bool isAndroid READ isAndroid CONSTANT) - Q_PROPERTY(bool isiOS READ isiOS CONSTANT) - Q_PROPERTY(bool isMobile READ isMobile CONSTANT) - - //! Returns the global mouse X position - Q_PROPERTY(int mouseX READ mouseX) - //! Returns the global mouse Y position - Q_PROPERTY(int mouseY READ mouseY) - //! Used to trigger a \c Canvas element repaint. - /*! - There is a bug as of Qt 5.4 where a Canvas element defined within a QQuickWidget does not receive - repaint events. QGC's main window will emit these signals when a \c Canvas element needs to be - repainted. - If you use a \c Canvas element inside some QML widget, you can use this code to handle repaint: - @code - import QGroundControl.ScreenTools 1.0 - ... - Canvas { - id: myCanvas - height: 40 - width: 40 - Connections { - target: ScreenTools - onRepaintRequestedChanged: { - myCanvas.requestPaint(); - } - } - onPaint: { - var context = getContext("2d"); - ... - } - } - @endcode - */ - - //! Font sizes - Q_PROPERTY(int font22 READ font22 CONSTANT) - Q_PROPERTY(int font21 READ font21 CONSTANT) - Q_PROPERTY(int font20 READ font20 CONSTANT) - Q_PROPERTY(int font19 READ font19 CONSTANT) - Q_PROPERTY(int font18 READ font18 CONSTANT) - Q_PROPERTY(int font17 READ font17 CONSTANT) - Q_PROPERTY(int font16 READ font16 CONSTANT) - Q_PROPERTY(int font15 READ font15 CONSTANT) - Q_PROPERTY(int font14 READ font14 CONSTANT) - Q_PROPERTY(int font13 READ font13 CONSTANT) - Q_PROPERTY(int font12 READ font12 CONSTANT) - Q_PROPERTY(int font11 READ font11 CONSTANT) - Q_PROPERTY(int font10 READ font10 CONSTANT) - Q_PROPERTY(int font9 READ font9 CONSTANT) - Q_PROPERTY(int font8 READ font8 CONSTANT) - - //! Returns the system wide default font point size (properly scaled) - Q_PROPERTY(int defaultFontPizelSize READ defaultFontPizelSize CONSTANT) - //! Returns the system wide default font point size (properly scaled) - Q_PROPERTY(int mediumFontPixelSize READ mediumFontPixelSize CONSTANT) - //! Returns the system wide default font point size (properly scaled) - Q_PROPERTY(int largeFontPixelSize READ largeFontPixelSize CONSTANT) - - Q_PROPERTY(bool repaintRequested READ repaintRequested NOTIFY repaintRequestedChanged) - //! Returns the pixel size factor - Q_PROPERTY(double pixelSizeFactor READ pixelSizeFactor CONSTANT) - - //! Utility for adjusting pixel size. Not dynamic (no signals) - Q_INVOKABLE qreal adjustPixelSize(qreal pixelSize); - - /// Static version of adjustPixelSize of use in C++ code - static qreal adjustPixelSize_s(qreal pixelSize); - - int mouseX () { return QCursor::pos().x(); } - int mouseY () { return QCursor::pos().y(); } - bool repaintRequested () { return true; } - double pixelSizeFactor () { return _pixelFactor; } - - int font22 () { return _font22; } - int font21 () { return _font21; } - int font20 () { return _font20; } - int font19 () { return _font19; } - int font18 () { return _font18; } - int font17 () { return _font17; } - int font16 () { return _font16; } - int font15 () { return _font15; } - int font14 () { return _font14; } - int font13 () { return _font13; } - int font12 () { return _font12; } - int font11 () { return _font11; } - int font10 () { return _font10; } - int font9 () { return _font9; } - int font8 () { return _font8; } - - int defaultFontPizelSize () { return _font12; } - int mediumFontPixelSize () { return _font16; } - int largeFontPixelSize () { return _font20; } - - /// Static version for use in C++ code - static int font22_s () { return _font22; } - static int font21_s () { return _font21; } - static int font20_s () { return _font20; } - static int font19_s () { return _font19; } - static int font18_s () { return _font18; } - static int font17_s () { return _font17; } - static int font16_s () { return _font16; } - static int font15_s () { return _font15; } - static int font14_s () { return _font14; } - static int font13_s () { return _font13; } - static int font12_s () { return _font12; } - static int font11_s () { return _font11; } - static int font10_s () { return _font10; } - static int font9_s () { return _font9; } - static int font8_s () { return _font8; } - - static int defaultFontPizelSize_s () { return _font12; } - static int mediumFontPixelSize_s () { return _font16; } - static int largeFontPixelSize_s () { return _font20; } - - static double pixelSizeFactor_s () { return _pixelFactor; } - -#if defined (__android__) - bool isAndroid () { return true; } - bool isiOS () { return false; } - bool isMobile () { return true; } -#elif defined(__ios__) - bool isAndroid () { return false; } - bool isiOS () { return true; } - bool isMobile () { return true; } -#else - bool isAndroid () { return false; } - bool isiOS () { return false; } - bool isMobile () { return false; } -#endif - -signals: - void repaintRequestedChanged(); - -private slots: - void _updateCanvas(); - -private: - // Font Sizes - static int _font8; - static int _font9; - static int _font10; - static int _font11; - static int _font12; - static int _font13; - static int _font14; - static int _font15; - static int _font16; - static int _font17; - static int _font18; - static int _font19; - static int _font20; - static int _font21; - static int _font22; - // UI Dimension Factors - static double _pixelFactor; -}; - -#endif diff --git a/src/QmlControls/ScreenTools.qml b/src/QmlControls/ScreenTools.qml new file mode 100644 index 0000000000000000000000000000000000000000..97e26a95fe384d2e6ffa58c42290f2b2911e5130 --- /dev/null +++ b/src/QmlControls/ScreenTools.qml @@ -0,0 +1,39 @@ +pragma Singleton + +import QtQuick 2.2 +import QtQuick.Controls 1.2 + +import QGroundControl.ScreenToolsController 1.0 + +Item { + signal repaintRequested + + readonly property real defaultFontPixelSize: _textMeasure.contentHeight * 0.8 + readonly property real defaultFontPixelHeight: defaultFontPixelSize + readonly property real defaultFontPixelWidth: _textMeasure.contentWidth + readonly property real smallFontPixelSize: defaultFontPixelSize * ScreenToolsController.smallFontPixelSizeRatio + readonly property real mediumFontPixelSize: defaultFontPixelSize * ScreenToolsController.mediumFontPixelSizeRatio + readonly property real largeFontPixelSize: defaultFontPixelSize * ScreenToolsController.largeFontPixelSizeRatio + + property bool isAndroid: ScreenToolsController.isAndroid + property bool isiOS: ScreenToolsController.isiOS + property bool isMobile: ScreenToolsController.isMobile + + function mouseX() { + return ScreenToolsController.mouseX() + } + + function mouseY() { + return ScreenToolsController.mouseY() + } + + Text { + id: _textMeasure + text: "X" + } + + Connections { + target: ScreenToolsController + onRepaintRequested: repaintRequested() + } +} diff --git a/src/QmlControls/ScreenToolsController.cc b/src/QmlControls/ScreenToolsController.cc new file mode 100644 index 0000000000000000000000000000000000000000..4d5629bb5cc688cdca6ef6f6d2ce3eb6ed2ee3d1 --- /dev/null +++ b/src/QmlControls/ScreenToolsController.cc @@ -0,0 +1,59 @@ +/*===================================================================== + + QGroundControl Open Source Ground Control Station + + (c) 2009, 2015 QGROUNDCONTROL PROJECT + + This file is part of the QGROUNDCONTROL project + + QGROUNDCONTROL is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + QGROUNDCONTROL is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with QGROUNDCONTROL. If not, see . + + ======================================================================*/ + +/// @file +/// @author Gus Grubba + +#include "ScreenToolsController.h" +#include "MainWindow.h" + +int ScreenToolsController::_qmlDefaultFontPixelSize = -1; + +const double ScreenToolsController::_smallFontPixelSizeRatio = 0.75; +const double ScreenToolsController::_mediumFontPixelSizeRatio = 1.22; +const double ScreenToolsController::_largeFontPixelSizeRatio = 1.66; + +ScreenToolsController::ScreenToolsController() +{ + MainWindow* mainWindow = MainWindow::instance(); + // Unit tests can run Qml without MainWindow + if (mainWindow) { + connect(mainWindow, &MainWindow::repaintCanvas, this, &ScreenToolsController::_updateCanvas); + } +} + +void ScreenToolsController::_updateCanvas() +{ + emit repaintRequested(); +} + +double ScreenToolsController::getQmlDefaultFontPixelSize(void) +{ + if (_qmlDefaultFontPixelSize == -1) { + QGCQmlWidgetHolder qmlWidgetHolder; + + qmlWidgetHolder.setSource(QUrl::fromUserInput("qrc:/qml/ScreenToolsFontQuery.qml")); + } + + return _qmlDefaultFontPixelSize; +} diff --git a/src/QmlControls/ScreenToolsController.h b/src/QmlControls/ScreenToolsController.h new file mode 100644 index 0000000000000000000000000000000000000000..46e43fa04b10fd7f8e2b1819baaf2919e29a4b49 --- /dev/null +++ b/src/QmlControls/ScreenToolsController.h @@ -0,0 +1,127 @@ +/*===================================================================== + + QGroundControl Open Source Ground Control Station + + (c) 2009, 2015 QGROUNDCONTROL PROJECT + + This file is part of the QGROUNDCONTROL project + + QGROUNDCONTROL is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + QGROUNDCONTROL is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with QGROUNDCONTROL. If not, see . + + ======================================================================*/ + +/// @file +/// @author Gus Grubba + +#ifndef ScreenToolsController_H +#define ScreenToolsController_H + +#include "QGCApplication.h" + +#include +#include + +/*! + @brief Screen helper tools for QML widgets + To use its functions, you need to import the module with the following line: + @code + + @endcode +*/ + +/// This Qml control is used to return screen parameters +class ScreenToolsController : public QQuickItem +{ + Q_OBJECT +public: + ScreenToolsController(); + + Q_PROPERTY(bool isAndroid READ isAndroid CONSTANT) + Q_PROPERTY(bool isiOS READ isiOS CONSTANT) + Q_PROPERTY(bool isMobile READ isMobile CONSTANT) + + //! Used to trigger a \c Canvas element repaint. + /*! + There is a bug as of Qt 5.4 where a Canvas element defined within a QQuickWidget does not receive + repaint events. QGC's main window will emit these signals when a \c Canvas element needs to be + repainted. + If you use a \c Canvas element inside some QML widget, you can use this code to handle repaint: + @code + import QGroundControl.ScreenToolsController 1.0 + ... + Canvas { + id: myCanvas + height: 40 + width: 40 + Connections { + target: ScreenToolsController + onRepaintRequestedChanged: { + myCanvas.requestPaint(); + } + } + onPaint: { + var context = getContext("2d"); + ... + } + } + @endcode + */ + + // Returns current mouse position + Q_INVOKABLE int mouseX(void) { return QCursor::pos().x(); } + Q_INVOKABLE int mouseY(void) { return QCursor::pos().y(); } + + // Used to calculate font sizes based on default font size + Q_PROPERTY(double smallFontPixelSizeRatio MEMBER _smallFontPixelSizeRatio CONSTANT) + Q_PROPERTY(double mediumFontPixelSizeRatio MEMBER _mediumFontPixelSizeRatio CONSTANT) + Q_PROPERTY(double largeFontPixelSizeRatio MEMBER _largeFontPixelSizeRatio CONSTANT) + + Q_PROPERTY(double qmlDefaultFontPixelSize MEMBER _qmlDefaultFontPixelSize) + + static double getQmlDefaultFontPixelSize(void); + + static int defaultFontPixelSize_s() { return (int)getQmlDefaultFontPixelSize(); } + static int smallFontPixelSize_s() { return (int)((double)defaultFontPixelSize_s() * _smallFontPixelSizeRatio); } + static int mediumFontPixelSize_s() { return (int)((double)defaultFontPixelSize_s() * _mediumFontPixelSizeRatio); } + static int largeFontPixelSize_s() { return (int)((double)defaultFontPixelSize_s() * _largeFontPixelSizeRatio); } + +#if defined (__android__) + bool isAndroid () { return true; } + bool isiOS () { return false; } + bool isMobile () { return true; } +#elif defined(__ios__) + bool isAndroid () { return false; } + bool isiOS () { return true; } + bool isMobile () { return true; } +#else + bool isAndroid () { return false; } + bool isiOS () { return false; } + bool isMobile () { return false; } +#endif + +signals: + void repaintRequested(void); + +private slots: + void _updateCanvas(); + +private: + static const double _smallFontPixelSizeRatio; + static const double _mediumFontPixelSizeRatio; + static const double _largeFontPixelSizeRatio; + + static int _qmlDefaultFontPixelSize; +}; + +#endif diff --git a/src/QmlControls/ScreenToolsFontQuery.qml b/src/QmlControls/ScreenToolsFontQuery.qml new file mode 100644 index 0000000000000000000000000000000000000000..887605f9522cf9460ce410485a22203008a4d4e4 --- /dev/null +++ b/src/QmlControls/ScreenToolsFontQuery.qml @@ -0,0 +1,9 @@ +import QtQuick 2.2 +import QtQuick.Controls 1.2 + +import QGroundControl.ScreenTools 1.0 +import QGroundControl.ScreenToolsController 1.0 + +Item { + Component.onCompleted: ScreenToolsController.qmlDefaultFontPixelSize = ScreenTools.defaultFontPixelSize +} diff --git a/src/QmlControls/SubMenuButton.qml b/src/QmlControls/SubMenuButton.qml index 97e2a476283805763f2425f21ab955cbba657170..34c29d093f3ab7f09f0405ff93fa247a1f9e7154 100644 --- a/src/QmlControls/SubMenuButton.qml +++ b/src/QmlControls/SubMenuButton.qml @@ -40,7 +40,7 @@ Button { horizontalAlignment: TextEdit.AlignHCenter text: control.text - font.pixelSize: ScreenTools.defaultFontPizelSize + font.pixelSize: ScreenTools.defaultFontPixelSize antialiasing: true color: __showHighlight ? __qgcPal.buttonHighlightText : __qgcPal.buttonText diff --git a/src/QmlControls/VehicleRotationCal.qml b/src/QmlControls/VehicleRotationCal.qml index e70ead7f1acee07fc4859d7953599e217e693908..a61eff4bc2fb6123dec0417785e47a4a8ecafb1d 100644 --- a/src/QmlControls/VehicleRotationCal.qml +++ b/src/QmlControls/VehicleRotationCal.qml @@ -70,7 +70,7 @@ Rectangle { height: parent.height horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignBottom - font.pixelSize: ScreenTools.font22; + font.pixelSize: ScreenTools.mediumFontPixelSize font.bold: true color: "black" text: parent.calText @@ -80,7 +80,7 @@ Rectangle { height: parent.height horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignBottom - font.pixelSize: ScreenTools.font22; + font.pixelSize: ScreenTools.mediumFontPixelSize color: calInProgress ? "yellow" : "white" text: parent.calText } diff --git a/src/VehicleSetup/FirmwareUpgrade.qml b/src/VehicleSetup/FirmwareUpgrade.qml index c726ea4953190566a09dd32361c92c7ccbc062f9..f5ed9f980dc059d85fef840d4c7dcd580d630f86 100644 --- a/src/VehicleSetup/FirmwareUpgrade.qml +++ b/src/VehicleSetup/FirmwareUpgrade.qml @@ -74,7 +74,7 @@ QGCView { QGCLabel { text: "FIRMWARE UPDATE" - font.pixelSize: ScreenTools.font20; + font.pixelSize: ScreenTools.largeFontPixelSize } Item { @@ -177,7 +177,7 @@ QGCView { height: 300 readOnly: true frameVisible: false - font.pixelSize: ScreenTools.defaultFontPizelSize + font.pixelSize: ScreenTools.defaultFontPixelSize text: qsTr("Please disconnect all vehicles from QGroundControl before selecting Upgrade.") diff --git a/src/VehicleSetup/VehicleSummary.qml b/src/VehicleSetup/VehicleSummary.qml index 339c671068f585cda79c01bc80032fae13cc8ab0..55c3d3f9158a18fae2e3be9ad46fa99fcda4ea82 100644 --- a/src/VehicleSetup/VehicleSummary.qml +++ b/src/VehicleSetup/VehicleSummary.qml @@ -45,8 +45,8 @@ Rectangle { anchors.fill: parent QGCLabel { - text: "VEHICLE SUMMARY" - font.pixelSize: ScreenTools.font20; + text: "VEHICLE SUMMARY" + font.pixelSize: ScreenTools.largeFontPixelSize } Item { @@ -59,7 +59,7 @@ Rectangle { width: parent.width wrapMode: Text.WordWrap color: setupComplete ? qgcPal.text : "red" - font.pixelSize: setupComplete ? ScreenTools.defaultFontPizelSize : ScreenTools.font20 + font.pixelSize: setupComplete ? ScreenTools.defaultFontPixelSize : ScreenTools.mediumFontPixelSize text: setupComplete ? "Below you will find a summary of the settings for your vehicle. To the left are the setup menus for each component." : "WARNING: Your vehicle requires setup prior to flight. Please resolve the items marked in red using the menu on the left." diff --git a/src/ui/flightdisplay/FlightDisplay.cc b/src/ui/flightdisplay/FlightDisplay.cc index 076255dd0517422a5526ca9142796c643af5a60b..c23514964930df8930279f0f334c283a1cd299b8 100644 --- a/src/ui/flightdisplay/FlightDisplay.cc +++ b/src/ui/flightdisplay/FlightDisplay.cc @@ -31,7 +31,7 @@ This file is part of the QGROUNDCONTROL project #include #include -#include "ScreenTools.h" +#include "ScreenToolsController.h" #include "FlightDisplay.h" #include "UASManager.h" @@ -48,8 +48,8 @@ FlightDisplay::FlightDisplay(QWidget *parent) pl->setContentsMargins(0,0,0,0); } #ifndef __android__ - setMinimumWidth( 380 * ScreenTools::pixelSizeFactor_s()); - setMinimumHeight(400 * ScreenTools::pixelSizeFactor_s()); + setMinimumWidth( 31 * ScreenToolsController::defaultFontPixelSize_s()); + setMinimumHeight(33 * ScreenToolsController::defaultFontPixelSize_s()); #endif setContextPropertyObject("flightDisplay", this); setSource(QUrl::fromUserInput("qrc:/qml/FlightDisplay.qml")); diff --git a/src/ui/flightdisplay/FlightDisplay.qml b/src/ui/flightdisplay/FlightDisplay.qml index 2a3f28a8986e2c80565594c0164e7cbcb64ea157..034bf86ed42390337d5a4ef1e86b3e0642673104 100644 --- a/src/ui/flightdisplay/FlightDisplay.qml +++ b/src/ui/flightdisplay/FlightDisplay.qml @@ -118,17 +118,17 @@ Item { } contentItem: Rectangle { color: __qgcPal.window - implicitWidth: ScreenTools.pixelSizeFactor * (360) - implicitHeight: ScreenTools.pixelSizeFactor * (300) + implicitWidth: ScreenTools.defaultFontPixelSize * (30) + implicitHeight: ScreenTools.defaultFontPixelSize * (30) Column { id: dialogColumn anchors.centerIn: parent - spacing: ScreenTools.adjustPixelSize(10) + spacing: ScreenTools.defaultFontPixelSize width: parent.width Grid { columns: 2 - spacing: ScreenTools.pixelSizeFactor * (8) - rowSpacing: ScreenTools.pixelSizeFactor * (10) + spacing: ScreenTools.defaultFontPixelSize * (0.66) + rowSpacing: ScreenTools.defaultFontPixelSize * (0.83) anchors.horizontalCenter: parent.horizontalCenter QGCCheckBox { text: "Map Background" @@ -432,25 +432,25 @@ Item { QGCHudMessage { id: hudMessage - y: ScreenTools.pixelSizeFactor * (5) + y: ScreenTools.defaultFontPizelSize * (0.42) width: (parent.width - 520 > 200) ? parent.width - 520 : 200 - height: ScreenTools.pixelSizeFactor * (30) + height: ScreenTools.defaultFontPizelSize * (2.5) anchors.horizontalCenter: parent.horizontalCenter z: mapBackground.z + 1 } QGCCompassInstrument { id: compassInstrument - y: ScreenTools.pixelSizeFactor * (5) - x: ScreenTools.pixelSizeFactor * (85) - size: ScreenTools.pixelSizeFactor * (160) + y: ScreenTools.defaultFontPixelSize * (0.42) + x: ScreenTools.defaultFontPixelSize * (7.1) + size: ScreenTools.defaultFontPixelSize * (13.3) heading: isNaN(MavManager.heading) ? 0 : MavManager.heading visible: mapBackground.visible && showCompass z: mapBackground.z + 2 onResetRequested: { - y = ScreenTools.pixelSizeFactor * (5) - x = ScreenTools.pixelSizeFactor * (85) - size = ScreenTools.pixelSizeFactor * (160) + y = ScreenTools.defaultFontPixelSize * (0.42) + x = ScreenTools.defaultFontPixelSize * (7.1) + size = ScreenTools.defaultFontPixelSize * (13.3) tForm.xScale = 1 tForm.yScale = 1 } @@ -458,20 +458,20 @@ Item { QGCAttitudeInstrument { id: attitudeInstrument - y: ScreenTools.pixelSizeFactor * (5) - size: ScreenTools.pixelSizeFactor * (160) + y: ScreenTools.defaultFontPixelSize * (0.42) + size: ScreenTools.defaultFontPixelSize * (13.3) rollAngle: roll pitchAngle: pitch showPitch: showPitchIndicator visible: mapBackground.visible && showAttitudeIndicator anchors.right: root.right - anchors.rightMargin: ScreenTools.pixelSizeFactor * (85) + anchors.rightMargin: ScreenTools.defaultFontPixelSize * (7.1) z: mapBackground.z + 2 onResetRequested: { - y = ScreenTools.pixelSizeFactor * (5) + y = ScreenTools.defaultFontPixelSize * (0.42) anchors.right = root.right - anchors.rightMargin = ScreenTools.pixelSizeFactor * (85) - size = ScreenTools.pixelSizeFactor * (160) + anchors.rightMargin = ScreenTools.defaultFontPixelSize * (7.1) + size = ScreenTools.defaultFontPixelSize * (13.3) tForm.xScale = 1 tForm.yScale = 1 } @@ -490,8 +490,8 @@ Item { rollAngle: roll pitchAngle: pitch visible: !mapBackground.visible && showAttitudeIndicator - width: ScreenTools.pixelSizeFactor * (260) - height: ScreenTools.pixelSizeFactor * (260) + width: ScreenTools.defaultFontPixelSize * (21.7) + height: ScreenTools.defaultFontPixelSize * (21.7) z: 20 } @@ -502,15 +502,15 @@ Item { pitchAngle: pitch rollAngle: roll color: Qt.rgba(0,0,0,0) - size: ScreenTools.pixelSizeFactor * (120) + size: ScreenTools.defaultFontPixelSize * (10) z: 30 } QGCAltitudeWidget { id: altitudeWidget anchors.right: parent.right - width: ScreenTools.pixelSizeFactor * (60) - height: parent.height * 0.65 > ScreenTools.pixelSizeFactor * (280) ? ScreenTools.pixelSizeFactor * (280) : parent.height * 0.65 + width: ScreenTools.defaultFontPixelSize * (5) + height: parent.height * 0.65 > ScreenTools.defaultFontPixelSize * (23.4) ? ScreenTools.defaultFontPixelSize * (23.4) : parent.height * 0.65 altitude: MavManager.altitudeWGS84 z: 30 } @@ -518,8 +518,8 @@ Item { QGCSpeedWidget { id: speedWidget anchors.left: parent.left - width: ScreenTools.pixelSizeFactor * (60) - height: parent.height * 0.65 > ScreenTools.pixelSizeFactor * (280) ? ScreenTools.pixelSizeFactor * (280) : parent.height * 0.65 + width: ScreenTools.defaultFontPixelSize * (5) + height: parent.height * 0.65 > ScreenTools.defaultFontPixelSize * (23.4) ? ScreenTools.defaultFontPixelSize * (23.4) : parent.height * 0.65 speed: MavManager.groundSpeed z: 40 } @@ -527,7 +527,7 @@ Item { QGCCurrentSpeed { id: currentSpeed anchors.left: parent.left - width: ScreenTools.pixelSizeFactor * (75) + width: ScreenTools.defaultFontPixelSize * (6.25) airspeed: MavManager.airSpeed groundspeed: MavManager.groundSpeed showAirSpeed: true @@ -539,7 +539,7 @@ Item { QGCCurrentAltitude { id: currentAltitude anchors.right: parent.right - width: ScreenTools.pixelSizeFactor * (75) + width: ScreenTools.defaultFontPixelSize * (6.25) altitude: MavManager.altitudeWGS84 vertZ: MavManager.climbRate showAltitude: true @@ -551,9 +551,9 @@ Item { QGCCompass { id: compassIndicator y: root.height * 0.7 - x: root.width * 0.5 - ScreenTools.pixelSizeFactor * (60) - width: ScreenTools.pixelSizeFactor * (120) - height: ScreenTools.pixelSizeFactor * (120) + x: root.width * 0.5 - ScreenTools.defaultFontPixelSize * (5) + width: ScreenTools.defaultFontPixelSize * (10) + height: ScreenTools.defaultFontPixelSize * (10) heading: isNaN(MavManager.heading) ? 0 : MavManager.heading visible: !mapBackground.visible && showCompass z: 70 diff --git a/src/ui/mapdisplay/QGCMapDisplay.cc b/src/ui/mapdisplay/QGCMapDisplay.cc index 23e63aa6e3925cf07ac04ce1a2ed30634d65f7d6..192427e03f79defd435dd31626b211681bd323c8 100644 --- a/src/ui/mapdisplay/QGCMapDisplay.cc +++ b/src/ui/mapdisplay/QGCMapDisplay.cc @@ -31,7 +31,7 @@ This file is part of the QGROUNDCONTROL project #include #include -#include "ScreenTools.h" +#include "ScreenToolsController.h" #include "QGCMapDisplay.h" #include "UASManager.h" @@ -48,8 +48,8 @@ QGCMapDisplay::QGCMapDisplay(QWidget *parent) pl->setContentsMargins(0,0,0,0); } #ifndef __android__ - setMinimumWidth( 380 * ScreenTools::pixelSizeFactor_s()); - setMinimumHeight(400 * ScreenTools::pixelSizeFactor_s()); + setMinimumWidth( 32 * ScreenToolsController::defaultFontPixelSize_s()); + setMinimumHeight(33 * ScreenToolsController::defaultFontPixelSize_s()); #endif setContextPropertyObject("mapEngine", this); setSource(QUrl::fromUserInput("qrc:/qml/MapDisplay.qml")); diff --git a/src/ui/qmlcommon/QGCAltitudeWidget.qml b/src/ui/qmlcommon/QGCAltitudeWidget.qml index b46d87bc0271300fa95d818274bf2616baec7f1b..9b2cf7ef85ca7ec2c215efaa58219df6f23bf6f6 100644 --- a/src/ui/qmlcommon/QGCAltitudeWidget.qml +++ b/src/ui/qmlcommon/QGCAltitudeWidget.qml @@ -34,8 +34,8 @@ import QGroundControl.ScreenTools 1.0 Rectangle { id: root property real altitude: 50 - property real _reticleSpacing: ScreenTools.pixelSizeFactor * (16) - property real _reticleHeight: ScreenTools.pixelSizeFactor * (2) + property real _reticleSpacing: ScreenTools.defaultFontPixelSize * (1.33) + property real _reticleHeight: ScreenTools.defaultFontPixelSize * (0.166) property real _reticleSlot: _reticleSpacing + _reticleHeight property var _speedArray: [] property int _currentCenter: 0 @@ -64,7 +64,7 @@ Rectangle { anchors.verticalCenter: parent.verticalCenter smooth: true - radius: ScreenTools.pixelSizeFactor * (5) + radius: ScreenTools.defaultFontPixelSize * (0.42) border.color: Qt.rgba(1,1,1,0.25) gradient: Gradient { GradientStop { position: 0.0; color: Qt.rgba(0,0,0,0.65) } @@ -73,7 +73,7 @@ Rectangle { } Rectangle { id: clipRect - height: parent.height - ScreenTools.pixelSizeFactor * (5) + height: parent.height - ScreenTools.defaultFontPixelSize * (0.42) width: parent.width clip: true color: Qt.rgba(0,0,0,0); @@ -88,12 +88,12 @@ Rectangle { anchors.left: parent.left Rectangle { property int _alt: modelData - width: (_alt % 10 === 0) ? ScreenTools.pixelSizeFactor * (10) : ScreenTools.pixelSizeFactor * (15) + width: (_alt % 10 === 0) ? ScreenTools.defaultFontPixelSize * (0.83) : ScreenTools.defaultFontPixelSize * (1.25) height: _reticleHeight color: Qt.rgba(1,1,1,0.35) QGCLabel { visible: (_alt % 10 === 0) - x: ScreenTools.pixelSizeFactor * (20) + x: ScreenTools.defaultFontPixelSize * (1.66) anchors.verticalCenter: parent.verticalCenter antialiasing: true font.weight: Font.DemiBold diff --git a/src/ui/qmlcommon/QGCCompass.qml b/src/ui/qmlcommon/QGCCompass.qml index 5ce4d1932f95cfedb288ab380869a5a682dd9607..827cec7ea7b116b2e3a14ddf2deaf35fee1ca37f 100644 --- a/src/ui/qmlcommon/QGCCompass.qml +++ b/src/ui/qmlcommon/QGCCompass.qml @@ -58,8 +58,8 @@ Item { } Rectangle { anchors.centerIn: compass - width: ScreenTools.pixelSizeFactor * (40) - height: ScreenTools.pixelSizeFactor * (25) + width: ScreenTools.defaultFontPixelSize * (3.33) + height: ScreenTools.defaultFontPixelSize * (2.08) border.color: Qt.rgba(1,1,1,0.15) color: Qt.rgba(0,0,0,0.25) QGCLabel { diff --git a/src/ui/qmlcommon/QGCCompassInstrument.qml b/src/ui/qmlcommon/QGCCompassInstrument.qml index 0a4c973739548a25e381869c1258983a9db51d90..778be3353e4ce81ea01026a01875f8c93a29fb59 100644 --- a/src/ui/qmlcommon/QGCCompassInstrument.qml +++ b/src/ui/qmlcommon/QGCCompassInstrument.qml @@ -34,8 +34,8 @@ import QGroundControl.ScreenTools 1.0 QGCMovableItem { id: root property real heading: 0 - property real size: ScreenTools.pixelSizeFactor * (120) - property int _fontSize: ScreenTools.font12 + property real size: ScreenTools.defaultFontPixelSize * (10) + property int _fontSize: ScreenTools.defaultFontPixelSize width: size height: size Rectangle { diff --git a/src/ui/qmlcommon/QGCCurrentAltitude.qml b/src/ui/qmlcommon/QGCCurrentAltitude.qml index c38ac307685b5fcdf56042d0755eac9112f3ace3..6b7076796bbe4dc267da334f5b09888e9c13a756 100644 --- a/src/ui/qmlcommon/QGCCurrentAltitude.qml +++ b/src/ui/qmlcommon/QGCCurrentAltitude.qml @@ -39,13 +39,13 @@ Rectangle { property bool showClimbRate: true anchors.verticalCenter: parent.verticalCenter width: parent.width - height: (showAltitude && showClimbRate) ? ScreenTools.pixelSizeFactor * (50) : ScreenTools.pixelSizeFactor * (25) + height: (showAltitude && showClimbRate) ? ScreenTools.defaultFontPixelSize * (4.16) : ScreenTools.defaultFontPixelSize * (2.08) color: "black" border.color: Qt.rgba(1,1,1,0.25) opacity: 1.0 Column{ anchors.centerIn: parent - spacing: ScreenTools.pixelSizeFactor * (4) + spacing: ScreenTools.defaultFontPixelSize * (0.33) QGCLabel { text: 'h: ' + altitude.toFixed(0) font.weight: Font.DemiBold diff --git a/src/ui/qmlcommon/QGCCurrentSpeed.qml b/src/ui/qmlcommon/QGCCurrentSpeed.qml index 22e6e7fbb69688dee697139e5f861032601c2ef3..a9b1e263b4d0b28b14145c9a0aaf2a28da909dcc 100644 --- a/src/ui/qmlcommon/QGCCurrentSpeed.qml +++ b/src/ui/qmlcommon/QGCCurrentSpeed.qml @@ -39,13 +39,13 @@ Rectangle { property bool showGroundSpeed: true anchors.verticalCenter: parent.verticalCenter width: parent.width - height: (showAirSpeed && showGroundSpeed) ? ScreenTools.pixelSizeFactor * (50) : ScreenTools.pixelSizeFactor * (25) + height: (showAirSpeed && showGroundSpeed) ? ScreenTools.defaultFontPixelSize * (4.16) : ScreenTools.defaultFontPixelSize * (2.08) color: "black" border.color: Qt.rgba(1,1,1,0.25) opacity: 1.0 Column{ anchors.centerIn: parent - spacing: ScreenTools.pixelSizeFactor * (4) + spacing: ScreenTools.defaultFontPixelSize * (0.33) QGCLabel { text: 'GS: ' + groundspeed.toFixed(0) font.weight: Font.DemiBold diff --git a/src/ui/qmlcommon/QGCMapBackground.qml b/src/ui/qmlcommon/QGCMapBackground.qml index bb731fb4ea8af3486cd18a42d2f888984b28f13b..a20e8aa8a69ab50b185c149ac63f62c99e6cb646 100644 --- a/src/ui/qmlcommon/QGCMapBackground.qml +++ b/src/ui/qmlcommon/QGCMapBackground.qml @@ -307,9 +307,9 @@ Item { z: 1000 anchors { bottom: parent.bottom; - bottomMargin: ScreenTools.pixelSizeFactor * (15) - rightMargin: ScreenTools.pixelSizeFactor * (20) - leftMargin: ScreenTools.pixelSizeFactor * (20) + bottomMargin: ScreenTools.defaultFontPixelSize * (1.25) + rightMargin: ScreenTools.defaultFontPixelSize * (1.66) + leftMargin: ScreenTools.defaultFontPixelSize * (1.66) left: parent.left } width: parent.width - anchors.rightMargin - anchors.leftMargin @@ -330,9 +330,9 @@ Item { opacity: 1 anchors { bottom: zoomSlider.top; - bottomMargin: ScreenTools.pixelSizeFactor * (8); + bottomMargin: ScreenTools.defaultFontPixelSize * (0.66); left: zoomSlider.left - leftMargin: ScreenTools.pixelSizeFactor * (4) + leftMargin: ScreenTools.defaultFontPixelSize * (0.33) } Image { id: scaleImageLeft @@ -359,7 +359,7 @@ Item { horizontalAlignment: Text.AlignHCenter anchors.bottom: parent.bottom anchors.left: parent.left - anchors.bottomMargin: ScreenTools.pixelSizeFactor * (10) + anchors.bottomMargin: ScreenTools.defaultFontPixelSize * (0.83) text: "0 m" } Component.onCompleted: { diff --git a/src/ui/qmlcommon/QGCMapToolButton.qml b/src/ui/qmlcommon/QGCMapToolButton.qml index 49948fe4fa60f50635d9b36ee619a0c62d16485a..ea26e991439cca190f35aef836c7c9e29e92a1ef 100644 --- a/src/ui/qmlcommon/QGCMapToolButton.qml +++ b/src/ui/qmlcommon/QGCMapToolButton.qml @@ -23,12 +23,12 @@ Button { Connections { target: __behavior onMouseXChanged: { - __lastGlobalMouseX = ScreenTools.mouseX - __lastGlobalMouseY = ScreenTools.mouseY + __lastGlobalMouseX = ScreenTools.mouseX() + __lastGlobalMouseY = ScreenTools.mouseY() } onMouseYChanged: { - __lastGlobalMouseX = ScreenTools.mouseX - __lastGlobalMouseY = ScreenTools.mouseY + __lastGlobalMouseX = ScreenTools.mouseX() + __lastGlobalMouseY = ScreenTools.mouseY() } onEntered: { __forceHoverOff; false; hoverTimer.start() } onExited: { __forceHoverOff; false; hoverTimer.stop() } @@ -39,7 +39,7 @@ Button { interval: 250 repeat: true onTriggered: { - if (__lastGlobalMouseX != ScreenTools.mouseX || __lastGlobalMouseY != ScreenTools.mouseY) { + if (__lastGlobalMouseX != ScreenTools.mouseX() || __lastGlobalMouseY != ScreenTools.mouseY()) { __forceHoverOff = true } else { __forceHoverOff = false diff --git a/src/ui/qmlcommon/QGCPitchWidget.qml b/src/ui/qmlcommon/QGCPitchWidget.qml index e0ae9420602c3d08d31b05ca094464bafa23b04c..3e7c938089520280fa0a4d98b7ed5dd3340fdf11 100644 --- a/src/ui/qmlcommon/QGCPitchWidget.qml +++ b/src/ui/qmlcommon/QGCPitchWidget.qml @@ -40,10 +40,10 @@ Rectangle { property real _reticleSlot: _reticleSpacing + _reticleHeight property real _longDash: size * 0.40 property real _shortDash: size * 0.25 - property real _fontSize: ScreenTools.font11 + property real _fontSize: ScreenTools.defaultFontPixelSize height: size * 0.9 width: size - radius: ScreenTools.pixelSizeFactor * (8) + radius: ScreenTools.defaultFontPixelSize * (0.66) anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter clip: true diff --git a/src/ui/qmlcommon/QGCSlider.qml b/src/ui/qmlcommon/QGCSlider.qml index c5b4da37e5e89a884d6592cb00ac69367557a2df..65781dac44a8b2b671ed541bbe04f800d2babd99 100644 --- a/src/ui/qmlcommon/QGCSlider.qml +++ b/src/ui/qmlcommon/QGCSlider.qml @@ -52,15 +52,15 @@ Item { Rectangle { anchors.fill: parent - radius: ScreenTools.pixelSizeFactor * (6) + radius: ScreenTools.defaultFontPixelSize * (0.5) color: Qt.rgba(0,0,0,0.65); } Rectangle { anchors.left: parent.left - anchors.leftMargin: ScreenTools.pixelSizeFactor * (4) - radius: ScreenTools.pixelSizeFactor * (4) - height: ScreenTools.pixelSizeFactor * (4) + anchors.leftMargin: ScreenTools.defaultFontPixelSize * (0.33) + radius: ScreenTools.defaultFontPixelSize * (0.33) + height: ScreenTools.defaultFontPixelSize * (0.33) width: handle.x - x color: "#69bb17" anchors.verticalCenter: parent.verticalCenter @@ -69,14 +69,14 @@ Item { Rectangle { id: labelRect width: label.width - height: label.height + ScreenTools.pixelSizeFactor * (4) - radius: ScreenTools.pixelSizeFactor * (4) + height: label.height + ScreenTools.defaultFontPixelSize * (0.33) + radius: ScreenTools.defaultFontPixelSize * (0.33) smooth: true color: Qt.rgba(1,1,1,0.75); - border.width: ScreenTools.pixelSizeFactor * (1) + border.width: ScreenTools.defaultFontPixelSize * (0.083) border.color: Qt.rgba(0,0,0,0.45); anchors.bottom: handle.top - anchors.bottomMargin: ScreenTools.pixelSizeFactor * (4) + anchors.bottomMargin: ScreenTools.defaultFontPixelSize * (0.33) visible: mouseRegion.pressed x: Math.max(Math.min(handle.x + (handle.width - width ) / 2, slider.width - width), 0) QGCLabel{ @@ -93,7 +93,7 @@ Item { Rectangle { id: handle; smooth: true - width: ScreenTools.pixelSizeFactor * (26); + width: ScreenTools.defaultFontPixelSize * (2.16); y: (slider.height - height) / 2; x: (slider.value - slider.minimum) * slider.length / (slider.maximum - slider.minimum) diff --git a/src/ui/qmlcommon/QGCSpeedWidget.qml b/src/ui/qmlcommon/QGCSpeedWidget.qml index 08666a06908a5975d3c8259d909fdc78b52bf25a..000c48d01e468146dfeb4f17fe7eab5f1452e2ac 100644 --- a/src/ui/qmlcommon/QGCSpeedWidget.qml +++ b/src/ui/qmlcommon/QGCSpeedWidget.qml @@ -34,13 +34,13 @@ import QGroundControl.Controls 1.0 Rectangle { id: root property real speed: 0 - property real _reticleSpacing: ScreenTools.pixelSizeFactor * (10) - property real _reticleHeight: ScreenTools.pixelSizeFactor * (2) + property real _reticleSpacing: ScreenTools.defaultFontPixelSize * (0.83) + property real _reticleHeight: ScreenTools.defaultFontPixelSize * (0.166) property real _reticleSlot: _reticleSpacing + _reticleHeight anchors.verticalCenter: parent.verticalCenter z:10 smooth: true - radius: ScreenTools.pixelSizeFactor * (5) + radius: ScreenTools.defaultFontPixelSize * (0.42) border.color: Qt.rgba(1,1,1,0.25) gradient: Gradient { GradientStop { position: 0.0; color: Qt.rgba(0,0,0,0.65) } @@ -49,7 +49,7 @@ Rectangle { } Rectangle { id: clipRect - height: parent.height - ScreenTools.pixelSizeFactor * (5) + height: parent.height - ScreenTools.defaultFontPixelSize * (0.42) width: parent.width clip: true color: Qt.rgba(0,0,0,0); @@ -63,14 +63,14 @@ Rectangle { model: 40 Rectangle { property int _speed: -(index - 20) - width: (_speed % 5 === 0) ? ScreenTools.pixelSizeFactor * (10) : ScreenTools.pixelSizeFactor * (15) + width: (_speed % 5 === 0) ? ScreenTools.defaultFontPixelSize * (0.83) : ScreenTools.defaultFontPixelSize * (1.25) anchors.right: parent.right height: _reticleHeight color: Qt.rgba(1,1,1,0.35) QGCLabel { visible: (_speed % 5 === 0) anchors.horizontalCenter: parent.horizontalCenter - anchors.horizontalCenterOffset: ScreenTools.pixelSizeFactor * (-30) + anchors.horizontalCenterOffset: ScreenTools.defaultFontPixelSize * (-2.5) anchors.verticalCenter: parent.verticalCenter antialiasing: true font.weight: Font.DemiBold diff --git a/src/ui/toolbar/MainToolBar.cc b/src/ui/toolbar/MainToolBar.cc index 845662df04e1db7cb4674d09762fa4c421ae2f37..390634fd53acd2a3015a27a413a608642d5f8912 100644 --- a/src/ui/toolbar/MainToolBar.cc +++ b/src/ui/toolbar/MainToolBar.cc @@ -31,7 +31,7 @@ This file is part of the QGROUNDCONTROL project #include #include "MainToolBar.h" -#include "ScreenTools.h" +#include "ScreenToolsController.h" #include "MainWindow.h" #include "UASMessageView.h" #include "UASMessageHandler.h" @@ -64,8 +64,8 @@ MainToolBar::MainToolBar(QWidget* parent) if(pl) { pl->setContentsMargins(0,0,0,0); } - setMinimumHeight(40 * ScreenTools::pixelSizeFactor_s()); - setMaximumHeight(40 * ScreenTools::pixelSizeFactor_s()); + setMinimumHeight(ScreenToolsController::defaultFontPixelSize_s() * 3); + setMaximumHeight(ScreenToolsController::defaultFontPixelSize_s() * 3); // Tool Bar Preferences QSettings settings; settings.beginGroup(TOOL_BAR_SETTINGS_GROUP); diff --git a/src/ui/toolbar/MainToolBar.qml b/src/ui/toolbar/MainToolBar.qml index 5acd18f9105374b46132a65fb3eb8ed7f6dcf6ac..78d845e160f6c302b5267ef60cf60d1c99eda7cf 100644 --- a/src/ui/toolbar/MainToolBar.qml +++ b/src/ui/toolbar/MainToolBar.qml @@ -197,7 +197,7 @@ Rectangle { visible: !ScreenTools.isMobile Connections { target: ScreenTools - onRepaintRequestedChanged: { + onRepaintRequested: { setupButton.repaintChevron = true; planButton.repaintChevron = true; flyButton.repaintChevron = true; @@ -338,7 +338,7 @@ Rectangle { QGCLabel { id: messageText text: (MavManager.messageCount > 0) ? MavManager.messageCount : '' - font.pixelSize: ScreenTools.font14 + font.pixelSize: ScreenTools.smallFontPixelSize font.weight: Font.DemiBold anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter @@ -424,7 +424,7 @@ Rectangle { QGCLabel { id: satelitteText text: MavManager.satelliteCount >= 0 ? MavManager.satelliteCount : 'NA' - font.pixelSize: MavManager.satelliteCount >= 0 ? ScreenTools.font14 : ScreenTools.font10 + font.pixelSize: MavManager.satelliteCount >= 0 ? ScreenTools.defaultFontPixelSize : ScreenTools.smallFontPixelSize font.weight: Font.DemiBold anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right @@ -459,7 +459,7 @@ Rectangle { anchors.rightMargin: getProportionalDimmension(6) anchors.verticalCenter: parent.verticalCenter horizontalAlignment: Text.AlignRight - font.pixelSize: ScreenTools.font12 + font.pixelSize: ScreenTools.smallFontPixelSize font.weight: Font.DemiBold color: colorWhite } @@ -492,7 +492,7 @@ Rectangle { anchors.right: parent.right QGCLabel { text: 'R ' - font.pixelSize: ScreenTools.font11 + font.pixelSize: ScreenTools.smallFontPixelSize font.weight: Font.DemiBold color: colorWhite } @@ -500,7 +500,7 @@ Rectangle { text: mainToolBar.telemetryRRSSI + 'dB' width: getProportionalDimmension(30) horizontalAlignment: Text.AlignRight - font.pixelSize: ScreenTools.font11 + font.pixelSize: ScreenTools.smallFontPixelSize font.weight: Font.DemiBold color: colorWhite } @@ -509,7 +509,7 @@ Rectangle { anchors.right: parent.right QGCLabel { text: 'L ' - font.pixelSize: ScreenTools.font11 + font.pixelSize: ScreenTools.smallFontPixelSize font.weight: Font.DemiBold color: colorWhite } @@ -517,7 +517,7 @@ Rectangle { text: mainToolBar.telemetryLRSSI + 'dB' width: getProportionalDimmension(30) horizontalAlignment: Text.AlignRight - font.pixelSize: ScreenTools.font11 + font.pixelSize: ScreenTools.smallFontPixelSize font.weight: Font.DemiBold color: colorWhite } @@ -548,7 +548,7 @@ Rectangle { QGCLabel { visible: batteryStatus.visible && MavManager.batteryConsumed < 0.0 text: MavManager.batteryVoltage.toFixed(1) + 'V'; - font.pixelSize: ScreenTools.font11 + font.pixelSize: ScreenTools.smallFontPixelSize font.weight: Font.DemiBold anchors.right: parent.right anchors.rightMargin: getProportionalDimmension(6) @@ -566,7 +566,7 @@ Rectangle { text: MavManager.batteryVoltage.toFixed(1) + 'V'; width: getProportionalDimmension(30) horizontalAlignment: Text.AlignRight - font.pixelSize: ScreenTools.font11 + font.pixelSize: ScreenTools.smallFontPixelSize font.weight: Font.DemiBold color: colorWhite } @@ -574,7 +574,7 @@ Rectangle { text: MavManager.batteryConsumed.toFixed(0) + 'mA'; width: getProportionalDimmension(30) horizontalAlignment: Text.AlignRight - font.pixelSize: ScreenTools.font11 + font.pixelSize: ScreenTools.smallFontPixelSize font.weight: Font.DemiBold color: colorWhite } @@ -599,7 +599,7 @@ Rectangle { QGCLabel { id: armedStatusText text: (MavManager.systemArmed) ? qsTr("ARMED") : qsTr("DISARMED") - font.pixelSize: ScreenTools.font12 + font.pixelSize: ScreenTools.smallFontPixelSize font.weight: Font.DemiBold anchors.centerIn: parent color: (MavManager.systemArmed) ? colorOrangeText : colorGreenText @@ -618,7 +618,7 @@ Rectangle { QGCLabel { id: stateStatusText text: MavManager.currentState - font.pixelSize: ScreenTools.font12 + font.pixelSize: ScreenTools.smallFontPixelSize font.weight: Font.DemiBold anchors.centerIn: parent color: (MavManager.currentState === "STANDBY") ? colorGreenText : colorRedText @@ -639,7 +639,7 @@ Rectangle { QGCLabel { id: modeStatusText text: MavManager.currentMode - font.pixelSize: ScreenTools.font12 + font.pixelSize: ScreenTools.smallFontPixelSize font.weight: Font.DemiBold anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter @@ -660,7 +660,7 @@ Rectangle { QGCLabel { id: connectionStatusText text: qsTr("CONNECTION LOST") - font.pixelSize: ScreenTools.font14 + font.pixelSize: ScreenTools.defaultFontPixelSize font.weight: Font.DemiBold anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter