diff --git a/app/main.cpp b/app/main.cpp index da8c24138..cecaf5745 100755 --- a/app/main.cpp +++ b/app/main.cpp @@ -222,21 +222,24 @@ int main(int argc, char *argv[]) { settings.setValue("dev_always_use_generic_external_decode_service",true); } } - const int screen_custom_font_dpi = settings.value("screen_custom_font_dpi").toInt(); - if (screen_custom_font_dpi) { + if(screen_custom_font_dpi<0){ + // Disabled + QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling); + }else if(screen_custom_font_dpi==0){ + // Enabled (whatever qt thinks it wanna do on auto). Works on android, on other devices, meh + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + }else{ + // Custom font dpi set by the user QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling); const std::string font_dpi_s = std::to_string(screen_custom_font_dpi); qputenv("QT_FONT_DPI", QByteArray(font_dpi_s.c_str(), font_dpi_s.length())); - } else { - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); } //QCoreApplication::setAttribute(Qt::AA_UseOpenGLES); //QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling); const double global_scale = settings.value("global_scale", 1.0).toDouble(); const std::string global_scale_s = std::to_string(global_scale); - QByteArray scaleAsQByteArray(global_scale_s.c_str(), global_scale_s.length()); - qputenv("QT_SCALE_FACTOR", scaleAsQByteArray); + qputenv("QT_SCALE_FACTOR", QByteArray(global_scale_s.c_str(), global_scale_s.length())); // https://doc.qt.io/qt-6/qtquick-visualcanvas-scenegraph-renderer.html //qputenv("QSG_VISUALIZE", "overdraw"); diff --git a/qml/ui/configpopup/qopenhd_settings/AppScreenSettingsView.qml b/qml/ui/configpopup/qopenhd_settings/AppScreenSettingsView.qml index f1f3c130b..aa8e27fa1 100755 --- a/qml/ui/configpopup/qopenhd_settings/AppScreenSettingsView.qml +++ b/qml/ui/configpopup/qopenhd_settings/AppScreenSettingsView.qml @@ -128,7 +128,7 @@ ScrollView { anchors.horizontalCenter: parent.horizonatalCenter width: 320 model: ListModel { - id: font_dpi + ListElement { text: qsTr("-1 Disable") ; value: -1 } ListElement { text: qsTr("0 Auto (Recommended)") ; value: 0 } ListElement { text: qsTr("50 (ultra small)") ; value: 50 } ListElement { text: qsTr("72 (smaller)") ; value: 72 } @@ -145,12 +145,14 @@ ScrollView { } } } - onCurrentIndexChanged: { - const value_fdpi = font_dpi.get(currentIndex).value + onActivated:{ + const value_fdpi = model.get(currentIndex).value if(settings.screen_custom_font_dpi != value_fdpi){ + console.log("font dpi changed from :"+settings.screen_custom_font_dpi+" to:"+value_fdpi); _restartqopenhdmessagebox.show(); + settings.screen_custom_font_dpi = value_fdpi } - settings.screen_custom_font_dpi = value_fdpi + } } }