plasma-framework/examples/applets/testtheme/contents/ui/FontGizmo.qml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

60 lines
1.6 KiB
QML
Raw Normal View History

2014-03-26 00:11:30 +01:00
/*
SPDX-FileCopyrightText: 2014 Sebastian Kügler <sebas@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
2014-03-26 00:11:30 +01:00
import QtQuick 2.1
Fix text scaling with non-integer scale factors when PLASMA_USE_QT_SCALING=1 is set Summary: When `PLASMA_USE_QT_SCALING=1` is set, Plasma uses native Qt scaling. This works fine for integer scale factors, and fixes a lot of bugs (see [[https://bugs.kde.org/show_bug.cgi?id=356446|Bug 356446]]) but it introduces a new one: with non-integer scale factors, text becomes blurry and pixellated because of a bug in `Text.NativeRendering`: https://bugreports.qt.io/browse/QTBUG-67007 QQC2-desktop-style forces the use of `Text.QtRendering` rendering for non-integer scale factors, successfully working around the problem. But PlasmaComponents QML objects don't implement the same workaround, so we see the issue in Plasma. This patch fixes that, and gets us one step closer to being able to use Qt scaling in Plasmashell. There is no effect when `PLASMA_USE_QT_SCALING=1` is not being used. FIXED-IN 5.13 BUG: 391691 BUG: 384031 CCBUG: 386216 CCBUG: 391695 CCBUG: 391694 CCBUG: 385547 CCBUG: 391692 CCBUG: 356446 Test Plan: Before: `PLASMA_USE_QT_SCALING=1` set, 1.2 scale factor: Plasma text looks awful: {F5749797} After: `PLASMA_USE_QT_SCALING=1` set, 1.2 scale factor: Plasma text looks amazing! {F5749798} Note that we still get sub-pixel anti-aliasing and good kerning. There appear to be no layout regressions. Without both `PLASMA_USE_QT_SCALING=1` and a non-integer scale factor set, there is no visual change compared to the status quo. Reviewers: #plasma, davidedmundson Reviewed By: #plasma, davidedmundson Subscribers: mart, broulik, #frameworks Tags: #frameworks Differential Revision: https://phabricator.kde.org/D11244
2018-03-13 14:46:14 +01:00
import QtQuick.Window 2.2
import QtQuick.Controls 1.0
import QtQuick.Controls.Private 1.0 as QtQuickControlsPrivate
2014-03-26 00:11:30 +01:00
import org.kde.plasma.core 2.0 as PlasmaCore
//import org.kde.plasma.components 2.0 as PlasmaComponents
//import org.kde.plasma.extras 2.0 as PlasmaExtras
//import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons
Text {
Fix text scaling with non-integer scale factors when PLASMA_USE_QT_SCALING=1 is set Summary: When `PLASMA_USE_QT_SCALING=1` is set, Plasma uses native Qt scaling. This works fine for integer scale factors, and fixes a lot of bugs (see [[https://bugs.kde.org/show_bug.cgi?id=356446|Bug 356446]]) but it introduces a new one: with non-integer scale factors, text becomes blurry and pixellated because of a bug in `Text.NativeRendering`: https://bugreports.qt.io/browse/QTBUG-67007 QQC2-desktop-style forces the use of `Text.QtRendering` rendering for non-integer scale factors, successfully working around the problem. But PlasmaComponents QML objects don't implement the same workaround, so we see the issue in Plasma. This patch fixes that, and gets us one step closer to being able to use Qt scaling in Plasmashell. There is no effect when `PLASMA_USE_QT_SCALING=1` is not being used. FIXED-IN 5.13 BUG: 391691 BUG: 384031 CCBUG: 386216 CCBUG: 391695 CCBUG: 391694 CCBUG: 385547 CCBUG: 391692 CCBUG: 356446 Test Plan: Before: `PLASMA_USE_QT_SCALING=1` set, 1.2 scale factor: Plasma text looks awful: {F5749797} After: `PLASMA_USE_QT_SCALING=1` set, 1.2 scale factor: Plasma text looks amazing! {F5749798} Note that we still get sub-pixel anti-aliasing and good kerning. There appear to be no layout regressions. Without both `PLASMA_USE_QT_SCALING=1` and a non-integer scale factor set, there is no visual change compared to the status quo. Reviewers: #plasma, davidedmundson Reviewed By: #plasma, davidedmundson Subscribers: mart, broulik, #frameworks Tags: #frameworks Differential Revision: https://phabricator.kde.org/D11244
2018-03-13 14:46:14 +01:00
// Work around Qt bug where NativeRendering breaks for non-integer scale factors
// https://bugreports.qt.io/browse/QTBUG-70481
Fix text scaling with non-integer scale factors when PLASMA_USE_QT_SCALING=1 is set Summary: When `PLASMA_USE_QT_SCALING=1` is set, Plasma uses native Qt scaling. This works fine for integer scale factors, and fixes a lot of bugs (see [[https://bugs.kde.org/show_bug.cgi?id=356446|Bug 356446]]) but it introduces a new one: with non-integer scale factors, text becomes blurry and pixellated because of a bug in `Text.NativeRendering`: https://bugreports.qt.io/browse/QTBUG-67007 QQC2-desktop-style forces the use of `Text.QtRendering` rendering for non-integer scale factors, successfully working around the problem. But PlasmaComponents QML objects don't implement the same workaround, so we see the issue in Plasma. This patch fixes that, and gets us one step closer to being able to use Qt scaling in Plasmashell. There is no effect when `PLASMA_USE_QT_SCALING=1` is not being used. FIXED-IN 5.13 BUG: 391691 BUG: 384031 CCBUG: 386216 CCBUG: 391695 CCBUG: 391694 CCBUG: 385547 CCBUG: 391692 CCBUG: 356446 Test Plan: Before: `PLASMA_USE_QT_SCALING=1` set, 1.2 scale factor: Plasma text looks awful: {F5749797} After: `PLASMA_USE_QT_SCALING=1` set, 1.2 scale factor: Plasma text looks amazing! {F5749798} Note that we still get sub-pixel anti-aliasing and good kerning. There appear to be no layout regressions. Without both `PLASMA_USE_QT_SCALING=1` and a non-integer scale factor set, there is no visual change compared to the status quo. Reviewers: #plasma, davidedmundson Reviewed By: #plasma, davidedmundson Subscribers: mart, broulik, #frameworks Tags: #frameworks Differential Revision: https://phabricator.kde.org/D11244
2018-03-13 14:46:14 +01:00
renderType: QtQuickControlsPrivate.Settings.isMobile || Screen.devicePixelRatio % 1 !== 0 ? Text.QtRendering : Text.NativeRendering
2014-03-26 00:11:30 +01:00
font.pointSize: 22
//font.family: PlasmaCore.Theme.defaultFont.family
font.family: fontCheck.text
font.weight: lightCheck.checked ? Font.Light : Font.Normal
text: "Lesley 40:83 - (" + font.family + ")"
2014-03-26 00:11:30 +01:00
height: paintedHeightCheck.checked ? paintedHeight : 22
//anchors.fill: parent
//spacing: PlasmaCore.Units.smallSpacing/2
2014-03-26 00:11:30 +01:00
verticalAlignment: Text.AlignTop
Rectangle {
color: "yellow"
visible: boxesCheck.checked
height: 1
width: paintedWidth
anchors {
verticalCenter: parent.verticalCenter
left: parent.left
}
}
2014-03-26 00:11:30 +01:00
Rectangle {
color: "transparent"
border.width: 1
border.color: "green"
visible: boxesCheck.checked
height: parent.paintedHeight
width: paintedWidth
anchors {
top: parent.top
left: parent.left
}
}
}