Fix rendering on non HiDPI screens #646

Closed
sacredbanana wants to merge 1 commits from rendering-fix-for-non-HiDPI-screens into master
5 changed files with 14 additions and 9 deletions
-2
View File
@@ -97,8 +97,6 @@ int main(int argc, char *argv[])
engine.rootContext()->setContextProperty("fileIO", &fileIO); engine.rootContext()->setContextProperty("fileIO", &fileIO);
engine.rootContext()->setContextProperty("monospaceSystemFonts", monospaceFontManager.retrieveMonospaceFonts()); engine.rootContext()->setContextProperty("monospaceSystemFonts", monospaceFontManager.retrieveMonospaceFonts());
engine.rootContext()->setContextProperty("devicePixelRatio", app.devicePixelRatio());
// Manage import paths for Linux and OSX. // Manage import paths for Linux and OSX.
QStringList importPathList = engine.importPathList(); QStringList importPathList = engine.importPathList();
importPathList.prepend(QCoreApplication::applicationDirPath() + "/qmltermwidget"); importPathList.prepend(QCoreApplication::applicationDirPath() + "/qmltermwidget");
+1
View File
@@ -42,6 +42,7 @@ QtObject{
property int y: 100 property int y: 100
property int width: 1024 property int width: 1024
property int height: 768 property int height: 768
property real pixelRatio: 1.0
property bool fullscreen: false property bool fullscreen: false
property bool showMenubar: Qt.platform.os === "osx" ? true : false property bool showMenubar: Qt.platform.os === "osx" ? true : false
+2 -2
View File
@@ -28,7 +28,7 @@ QtObject{
property bool lowResolutionFont: _font.lowResolutionFont property bool lowResolutionFont: _font.lowResolutionFont
property int pixelSize: lowResolutionFont property int pixelSize: lowResolutionFont
? _font.pixelSize ? _font.pixelSize * 2.0 / appSettings.pixelRatio
: _font.pixelSize * scaling : _font.pixelSize * scaling
Swordfish90 commented 2021-07-01 23:05:28 +02:00 (Migrated from github.com)
Review

With the lowResolutionFont size should be static (like when scanlines are applied), this created some issues in my tests. Does it behave differently in your tests if you revert this line?

With the lowResolutionFont size should be static (like when scanlines are applied), this created some issues in my tests. Does it behave differently in your tests if you revert this line?
property int lineSpacing: lowResolutionFont property int lineSpacing: lowResolutionFont
@@ -36,7 +36,7 @@ QtObject{
: pixelSize * _font.lineSpacing : pixelSize * _font.lineSpacing
property real screenScaling: lowResolutionFont property real screenScaling: lowResolutionFont
? _font.baseScaling * scaling ? _font.baseScaling * scaling / 2.0 / appSettings.pixelRatio
: 1.0 : 1.0
property real defaultFontWidth: fontlist.get(selectedFontIndex).fontWidth property real defaultFontWidth: fontlist.get(selectedFontIndex).fontWidth
+3 -3
View File
@@ -71,7 +71,7 @@ Item{
QMLTermWidget { QMLTermWidget {
id: kterminal id: kterminal
property int textureResolutionScale: appSettings.lowResolutionFont ? devicePixelRatio : 1 property int textureResolutionScale: appSettings.lowResolutionFont ? appSettings.pixelRatio : 1
property int margin: appSettings.margin / screenScaling property int margin: appSettings.margin / screenScaling
property int totalWidth: Math.floor(parent.width / (screenScaling * fontWidth)) property int totalWidth: Math.floor(parent.width / (screenScaling * fontWidth))
property int totalHeight: Math.floor(parent.height / screenScaling) property int totalHeight: Math.floor(parent.height / screenScaling)
@@ -81,8 +81,8 @@ Item{
textureSize: Qt.size(width / textureResolutionScale, height / textureResolutionScale) textureSize: Qt.size(width / textureResolutionScale, height / textureResolutionScale)
width: ensureMultiple(rawWidth, devicePixelRatio) width: ensureMultiple(rawWidth, appSettings.pixelRatio)
height: ensureMultiple(rawHeight, devicePixelRatio) height: ensureMultiple(rawHeight, appSettings.pixelRatio)
/** Ensure size is a multiple of factor. This is needed for pixel perfect scaling on highdpi screens. */ /** Ensure size is a multiple of factor. This is needed for pixel perfect scaling on highdpi screens. */
function ensureMultiple(size, factor) { function ensureMultiple(size, factor) {
+8 -2
View File
@@ -30,8 +30,14 @@ ApplicationWindow{
height: 768 height: 768
// Save window properties automatically // Save window properties automatically
onXChanged: appSettings.x = x onXChanged: {
onYChanged: appSettings.y = y appSettings.x = x
appSettings.pixelRatio = Window.devicePixelRatio
}
onYChanged: {
Swordfish90 commented 2021-07-01 23:08:28 +02:00 (Migrated from github.com)
Review

In my tests with Qt 5.12 this always returns undefined. Did you mean something like "terminalWindow.screen.devicePixelRatio"?

In my tests with Qt 5.12 this always returns undefined. Did you mean something like "terminalWindow.screen.devicePixelRatio"?
appSettings.y = y
appSettings.pixelRatio = Window.devicePixelRatio
}
onWidthChanged: appSettings.width = width onWidthChanged: appSettings.width = width
onHeightChanged: appSettings.height = height onHeightChanged: appSettings.height = height