Commit edb1367a authored by Nate Graham's avatar Nate Graham 🔩

[Weather] Make compact representation temperature text match size of clock text

Summary:
Right now, the Weather widget's compact representation's temperature text is not the same
size as the text for the clock, which looks especially awkward when both are placed
adjacent to one another. In addition, the text size has no upper bound, so it can become
absolutely gigantic with a tall panel.

This patch fixes both issues by using the same size logic used in the digital clock,
ensuring that the text sizes are identical.

I know that this uses a magic value, and that this is bad and I should feel bad.
However it's the same one used in the digital clock. Once more than one widget is using
this "height * 0.7" value, it becomes feasible to factor it out into something in
plasma-framework maybe so we can use it to get consistent text size everywhere.

Hopefully that can be material for a subsequent patch though.

Test Plan:
No change for vertical panels.

Before, default horizontal panel: {F7772047}

After, default horizontal panel: {F7772044}

Before: double-height horizontal panel: {F7772046}

After, double-height horizontal panel: {F7772045}

Before, absurdly humongous horizontal panel: {F7772048}

After, absurdely humongous horizontal panel: {F7772049}

Reviewers: #vdg, #plasma, spstarr

Reviewed By: #plasma, spstarr

Subscribers: spstarr, filipf, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D25413
parent e8402b9a
......@@ -83,10 +83,12 @@ GridLayout {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
anchors {
fill: parent
leftMargin: units.smallSpacing
rightMargin: units.smallSpacing
}
// This magic value of 0.7 is taken from the digital clock, so that the
// text sizes are identical
height: Math.min (parent.height * 0.7, 3 * theme.defaultFont.pixelSize)
visible: false
// pattern to reserve some constant space TODO: improve and take formatting/i18n into account
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment