Add a qt.highdpi setting

See #1585
This commit is contained in:
Florian Bruhin 2017-11-06 07:02:07 +01:00
parent 4857374fb0
commit 341e8ca864
3 changed files with 25 additions and 0 deletions

View File

@ -157,6 +157,19 @@ qt.force_platform:
using the XCB plugin when running QtWebEngine on Wayland.
qt.highdpi:
type: Bool
default: false
desc: >-
Turn on Qt HighDPI scaling.
This is equivalent to setting QT_AUTO_SCREEN_SCALE_FACTOR=1 in the
environment.
It's off by default as it can cause issues with some bitmap fonts.
As an alternative to this, it's possible to set font sizes and the
`zoom.default` setting.
## auto_save
auto_save.interval:

View File

@ -94,6 +94,9 @@ def _init_envvars():
else:
os.environ.pop('QT_WAYLAND_DISABLE_WINDOWDECORATION', None)
if config.val.qt.highdpi:
os.environ['QT_AUTO_SCREEN_SCALE_FACTOR'] = '1'
@config.change_filter('fonts.monospace', function=True)
def _update_monospace_fonts():

View File

@ -288,6 +288,15 @@ class TestEarlyInit:
configinit._init_envvars()
assert os.environ[envvar] == 'toaster'
def test_highdpi(self, monkeypatch, config_stub):
envvar = 'QT_AUTO_SCREEN_SCALE_FACTOR'
monkeypatch.delenv(envvar, raising=False)
config_stub.val.qt.highdpi = True
configinit._init_envvars()
assert os.environ[envvar] == '1'
@pytest.mark.parametrize('old', ['1', '0', None])
@pytest.mark.parametrize('configval', [True, False])
def test_hide_wayland_decoration(self, monkeypatch, config_stub,