Skip to content

Commit

Permalink
fix rich text size mismatch on windows with HiDPI
Browse files Browse the repository at this point in the history
  • Loading branch information
ddennedy committed Sep 24, 2020
1 parent 4e68773 commit a143ffd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/qml/filters/richtext/ui.qml
Expand Up @@ -34,6 +34,9 @@ Item {

Component.onCompleted: {
filter.blockSignals = true
if (application.OS === 'Windows') {
filter.set('pixel_ratio', application.devicePixelRatio)
}
filter.set(middleValue, Qt.rect(0, 0, profile.width, profile.height))
filter.set(startValue, Qt.rect(0, 0, profile.width, profile.height))
filter.set(endValue, Qt.rect(0, 0, profile.width, profile.height))
Expand Down
7 changes: 6 additions & 1 deletion src/qmltypes/qmlapplication.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2019 Meltytech, LLC
* Copyright (c) 2013-2020 Meltytech, LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -154,3 +154,8 @@ bool QmlApplication::isProjectFolder()
return (!MLT.projectFolder().isEmpty() && dir.exists());
}

qreal QmlApplication::devicePixelRatio()
{
return MAIN.devicePixelRatioF();
}

4 changes: 3 additions & 1 deletion src/qmltypes/qmlapplication.h
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019 Meltytech, LLC
* Copyright (c) 2014-2020 Meltytech, LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -38,6 +38,7 @@ class QmlApplication : public QObject
Q_PROPERTY(QString OS READ OS CONSTANT)
Q_PROPERTY(QRect mainWinRect READ mainWinRect);
Q_PROPERTY(bool hasFiltersOnClipboard READ hasFiltersOnClipboard NOTIFY filtersCopied)
Q_PROPERTY(qreal devicePixelRatio READ devicePixelRatio CONSTANT)

public:
static QmlApplication& singleton();
Expand All @@ -54,6 +55,7 @@ class QmlApplication : public QObject
Q_INVOKABLE static int audioChannels();
Q_INVOKABLE static QString getNextProjectFile(const QString& filename);
Q_INVOKABLE static bool isProjectFolder();
static qreal devicePixelRatio();

signals:
void paletteChanged();
Expand Down

0 comments on commit a143ffd

Please sign in to comment.