Browse Source

Bump font size on Windows

QGC4.4
Don Gagne 10 years ago
parent
commit
b4ac871c17
  1. 2
      src/QmlControls/ScreenTools.qml
  2. 5
      src/QmlControls/ScreenToolsController.cc
  3. 4
      src/QmlControls/ScreenToolsController.h

2
src/QmlControls/ScreenTools.qml

@ -8,7 +8,7 @@ import QGroundControl.ScreenToolsController 1.0
Item { Item {
signal repaintRequested signal repaintRequested
readonly property real defaultFontPixelSize: _textMeasure.contentHeight * 0.8 readonly property real defaultFontPixelSize: _textMeasure.contentHeight * ScreenToolsController.defaultFontPixelSizeRatio
readonly property real defaultFontPixelHeight: defaultFontPixelSize readonly property real defaultFontPixelHeight: defaultFontPixelSize
readonly property real defaultFontPixelWidth: _textMeasure.contentWidth readonly property real defaultFontPixelWidth: _textMeasure.contentWidth
readonly property real smallFontPixelSize: defaultFontPixelSize * ScreenToolsController.smallFontPixelSizeRatio readonly property real smallFontPixelSize: defaultFontPixelSize * ScreenToolsController.smallFontPixelSizeRatio

5
src/QmlControls/ScreenToolsController.cc

@ -29,6 +29,11 @@
int ScreenToolsController::_qmlDefaultFontPixelSize = -1; int ScreenToolsController::_qmlDefaultFontPixelSize = -1;
#ifdef Q_OS_WIN
const double ScreenToolsController::_defaultFontPixelSizeRatio = 1.0;
#else
const double ScreenToolsController::_defaultFontPixelSizeRatio = 0.8;
#endif
const double ScreenToolsController::_smallFontPixelSizeRatio = 0.75; const double ScreenToolsController::_smallFontPixelSizeRatio = 0.75;
const double ScreenToolsController::_mediumFontPixelSizeRatio = 1.22; const double ScreenToolsController::_mediumFontPixelSizeRatio = 1.22;
const double ScreenToolsController::_largeFontPixelSizeRatio = 1.66; const double ScreenToolsController::_largeFontPixelSizeRatio = 1.66;

4
src/QmlControls/ScreenToolsController.h

@ -82,6 +82,9 @@ public:
Q_INVOKABLE int mouseX(void) { return QCursor::pos().x(); } Q_INVOKABLE int mouseX(void) { return QCursor::pos().x(); }
Q_INVOKABLE int mouseY(void) { return QCursor::pos().y(); } Q_INVOKABLE int mouseY(void) { return QCursor::pos().y(); }
// Used to adjust default font size on an OS basis
Q_PROPERTY(double defaultFontPixelSizeRatio MEMBER _defaultFontPixelSizeRatio CONSTANT)
// Used to calculate font sizes based on default font size // Used to calculate font sizes based on default font size
Q_PROPERTY(double smallFontPixelSizeRatio MEMBER _smallFontPixelSizeRatio CONSTANT) Q_PROPERTY(double smallFontPixelSizeRatio MEMBER _smallFontPixelSizeRatio CONSTANT)
Q_PROPERTY(double mediumFontPixelSizeRatio MEMBER _mediumFontPixelSizeRatio CONSTANT) Q_PROPERTY(double mediumFontPixelSizeRatio MEMBER _mediumFontPixelSizeRatio CONSTANT)
@ -117,6 +120,7 @@ private slots:
void _updateCanvas(); void _updateCanvas();
private: private:
static const double _defaultFontPixelSizeRatio;
static const double _smallFontPixelSizeRatio; static const double _smallFontPixelSizeRatio;
static const double _mediumFontPixelSizeRatio; static const double _mediumFontPixelSizeRatio;
static const double _largeFontPixelSizeRatio; static const double _largeFontPixelSizeRatio;

Loading…
Cancel
Save