[kcmkwin] Use QtQuick.Controls 2.0 for Label and TextField
ClosedPublic

Authored by bosimonsen on Jul 30 2018, 5:48 PM.

Details

Summary

Using QtQuick.Controls for Label and TextField can result in blurry font rendering for a fractional scaling (e.g. 1,5). There is a work around for QtQuick.Controls 2.x therefore using QtQuick.Controls 2.0 for Label and TextField resolves the problem

BUG: 366451

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
bosimonsen created this revision.Jul 30 2018, 5:48 PM
Restricted Application added a project: KWin. · View Herald TranscriptJul 30 2018, 5:48 PM
Restricted Application added a subscriber: kwin. · View Herald Transcript
bosimonsen requested review of this revision.Jul 30 2018, 5:48 PM
davidedmundson accepted this revision.Jul 31 2018, 10:46 AM
davidedmundson added a subscriber: davidedmundson.

Using QtQuick.Controls 1.0 for Label results in blurry font rendering for a fractional scaling (e.g. 1,5)

Using QQC1 or 2 is irrelevant, using native text rendering or not is the difference.
It just so happens that our particular QQC2 desktop theme sets that as a hacky workaround for fixing the real problem.

Please reflect this in the commit message.

This revision is now accepted and ready to land.Jul 31 2018, 10:46 AM
zzag added a subscriber: zzag.Jul 31 2018, 12:53 PM

Also, please prepend "[kcmkwin]" to the title, so it looks like

[kcmkwin] Use QtQuick.Controls 2.0 for Label

bosimonsen retitled this revision from Use QtQuick.Controls 2.0 for Label to [kcmkwin] Use QtQuick.Controls 2.0 for Label.Jul 31 2018, 5:23 PM
bosimonsen edited the summary of this revision. (Show Details)

@davidedmundson @zzag changed title and summary.

zzag added a comment.Aug 1 2018, 7:18 AM

Do you have commit access?

In D14495#301697, @zzag wrote:

Do you have commit access?

No, it is only my 2nd patch.

zzag added a comment.Aug 1 2018, 6:37 PM

Could you please provide your real name and email address? Also, you made this patch against Plasma/5.12, right?

In D14495#301903, @zzag wrote:

Could you please provide your real name and email address? Also, you made this patch against Plasma/5.12, right?

Bo Simonsen <bo@geekworld.dk> and yes the patch is made against 5.12

Thanks

zzag added a comment.EditedAug 2 2018, 9:16 AM

I've tested this patch and it seems like it introduces a visual regression:

Name of each effect and category(Accessibility, Appearance, etc) have to be bold. Is it a bug in Qt?

Also, "Search" placeholder looks bad.

bosimonsen added a comment.EditedAug 2 2018, 4:03 PM
In D14495#302073, @zzag wrote:

Name of each effect and category(Accessibility, Appearance, etc) have to be bold. Is it a bug in Qt?

Seems so! According to the documentation "font.bold" should be perfectly valid.

bosimonsen updated this revision to Diff 38965.Aug 2 2018, 4:08 PM

Use TextField from QtQuick.Controls 2 (has the same workaround) to avoid blurry search field.

In D14495#302073, @zzag wrote:

Also, "Search" placeholder looks bad.

Fixed in diff update.

In D14495#302073, @zzag wrote:

Name of each effect and category(Accessibility, Appearance, etc) have to be bold. Is it a bug in Qt?

Just checked plasma-nm, they workaround the bug by using text: "<b>" + ... + "</b>". Just check it worked here as well,
will you guys accept that workaround?

bosimonsen retitled this revision from [kcmkwin] Use QtQuick.Controls 2.0 for Label to [kcmkwin] Use QtQuick.Controls 2.0 for Label and TextField.Aug 2 2018, 4:24 PM
bosimonsen edited the summary of this revision. (Show Details)

Seems so! According to the documentation "font.bold" should be perfectly valid.

Not in this case

font.weight has precedent over font.bold
Our QtQuickControls2 Desktop style explicitly sets it to

font.weight: Kirigami.Theme.defaultFont.weight

If you also set font.weight it'll override that property and work.

This comment was removed by bosimonsen.
ngraham added a subscriber: ngraham.Aug 3 2018, 4:34 AM
bosimonsen updated this revision to Diff 38995.Aug 3 2018, 4:35 AM

Use font.weight instead of font.bold, since it has precedence.

bosimonsen updated this revision to Diff 38996.Aug 3 2018, 4:37 AM

Thanks for the patch! But it doesn't apply cleanly for me on top of KWin master:

Created and checked out branch arcpatch-D14495.
Checking patch kcmkwin/kwindecoration/qml/Buttons.qml...
error: while searching for:
                        Layout.fillWidth: true
                        anchors.centerIn: parent
                        height: titlebar.implicitHeight
                        Label {
                            id: titlebar
                            anchors.centerIn: parent
                            font: titleFont

error: patch failed: kcmkwin/kwindecoration/qml/Buttons.qml:70
Hunk #3 succeeded at 160 (offset -6 lines).
error: while searching for:
                ColumnLayout {
                    anchors.centerIn: parent
                    visible: leftButtonsView.dragging || rightButtonsView.dragging
                    Label {
                        text: i18n("Drop here to remove button")
                        font.bold: true
                    }
                    KQuickControlsAddons.QIconItem {
                        id: icon

error: patch failed: kcmkwin/kwindecoration/qml/Buttons.qml:212
Checking patch kcmkwin/kwincompositing/qml/EffectView.qml...
Checking patch kcmkwin/kwincompositing/qml/Effect.qml...
Applying patch kcmkwin/kwindecoration/qml/Buttons.qml with 2 rejects...
Hunk #1 applied cleanly.
Rejected hunk #2.
Hunk #3 applied cleanly.
Rejected hunk #4.
Applied patch kcmkwin/kwincompositing/qml/EffectView.qml cleanly.
Applied patch kcmkwin/kwincompositing/qml/Effect.qml cleanly.

 Patch Failed! 
Usage Exception: Unable to apply patch!

Can you re-base on master?

zzag added a comment.EditedAug 3 2018, 4:07 PM

Thanks for the patch! But it doesn't apply cleanly for me on top of KWin master:
...
Can you re-base on master?

You have to apply it to Plasma/5.12 and then fix 2 merge conflicts (when merging Plasma/5.12 into Plasma/5.13).

@zzag can you do that merging/resolving

zzag added a comment.Aug 15 2018, 7:09 AM

@davidedmundson @bosimonsen forgot to change font.bold in kcmkwin/kwincompositing/qml/EffectView.qml:44 to font.weight. If you don't mind, I would like to change it before push.

Sure, change whatever.
We have a review process, but its not meant to be overly bureaucratic and block changes.

This revision was automatically updated to reflect the committed changes.