Commit 890833b3 authored by DoinLakeFlyer's avatar DoinLakeFlyer

parent 0121a26a
pragma Singleton
import QtQuick 2.3
import QtQuick 2.12
import QtQuick.Controls 1.2
import QtQuick.Window 2.2
......@@ -43,6 +43,9 @@ Item {
/// your ui elements will reposition themselves appropriately on varying screen sizes and resolutions.
property real defaultFontPixelWidth: 10
/// QFontMetrics::descent for default font at default point size
property real defaultFontDescent: 0
property real smallFontPointSize: 10
property real mediumFontPointSize: 10
property real largeFontPointSize: 10
......@@ -134,6 +137,7 @@ Item {
defaultFontPointSize = pointSize
defaultFontPixelHeight = Math.round(_textMeasure.fontHeight/2.0)*2
defaultFontPixelWidth = Math.round(_textMeasure.fontWidth/2.0)*2
defaultFontDescent = ScreenToolsController.defaultFontDescent(defaultFontPointSize)
smallFontPointSize = defaultFontPointSize * _screenTools.smallFontPointRatio
mediumFontPointSize = defaultFontPointSize * _screenTools.mediumFontPointRatio
largeFontPointSize = defaultFontPointSize * _screenTools.largeFontPointRatio
......
......@@ -73,3 +73,8 @@ ScreenToolsController::boldFontFamily() const
return QString("opensans-demibold");
}
}
double ScreenToolsController::defaultFontDescent(int pointSize) const
{
return QFontMetrics(QFont(normalFontFamily(), pointSize)).descent();
}
......@@ -47,6 +47,9 @@ public:
Q_INVOKABLE int mouseX(void) { return QCursor::pos().x(); }
Q_INVOKABLE int mouseY(void) { return QCursor::pos().y(); }
// QFontMetrics::descent for default font
Q_INVOKABLE double defaultFontDescent(int pointSize) const;
#if defined(__mobile__)
bool isMobile () const { return true; }
#else
......@@ -103,8 +106,7 @@ public:
bool isDebug () { return false; }
#endif
bool hasTouch() const;
bool hasTouch () const;
QString iOSDevice () const;
QString fixedFontFamily () const;
QString normalFontFamily () const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment