Changeset View
Changeset View
Standalone View
Standalone View
applets/digital-clock/package/contents/ui/DigitalClock.qml
Show First 20 Lines • Show All 149 Lines • ▼ Show 20 Line(s) | 148 | AnchorChanges { | |||
---|---|---|---|---|---|
150 | 150 | | |||
151 | anchors.top: labelsGrid.bottom | 151 | anchors.top: labelsGrid.bottom | ||
152 | anchors.horizontalCenter: labelsGrid.horizontalCenter | 152 | anchors.horizontalCenter: labelsGrid.horizontalCenter | ||
153 | } | 153 | } | ||
154 | 154 | | |||
155 | PropertyChanges { | 155 | PropertyChanges { | ||
156 | target: sizehelper | 156 | target: sizehelper | ||
157 | 157 | | |||
158 | height: Math.min(main.showDate || timezoneLabel.visible ? 0.56 * main.height : main.height, 3 * theme.defaultFont.pixelSize) | 158 | /* | ||
159 | * The value 0.71 was picked by testing to give the clock the right | ||||
160 | * size (aligned with tray icons). | ||||
161 | * Value 0.56 seems to be chosen rather arbitrary as well such that | ||||
162 | * the time label is slightly larger than the date or timezone label | ||||
163 | * and still fits well into the panel with all the applied margins. | ||||
164 | */ | ||||
165 | height: Math.min(main.showDate || timezoneLabel.visible ? main.height * 0.56 : main.height * 0.71, | ||||
166 | 3 * theme.defaultFont.pixelSize) | ||||
159 | 167 | | |||
160 | font.pixelSize: sizehelper.height | 168 | font.pixelSize: sizehelper.height | ||
161 | } | 169 | } | ||
162 | }, | 170 | }, | ||
163 | 171 | | |||
164 | State { | 172 | State { | ||
165 | name: "horizontalPanelSmall" | 173 | name: "horizontalPanelSmall" | ||
166 | when: plasmoid.formFactor == PlasmaCore.Types.Horizontal && main.oneLineMode | 174 | when: plasmoid.formFactor == PlasmaCore.Types.Horizontal && main.oneLineMode | ||
▲ Show 20 Lines • Show All 290 Lines • ▼ Show 20 Line(s) | 464 | Rectangle { | |||
457 | height: 0.8 * sizehelper.height | 465 | height: 0.8 * sizehelper.height | ||
458 | width: 1 | 466 | width: 1 | ||
459 | visible: main.showDate && main.oneLineMode | 467 | visible: main.showDate && main.oneLineMode | ||
460 | 468 | | |||
461 | color: theme.textColor | 469 | color: theme.textColor | ||
462 | opacity: 0.4 | 470 | opacity: 0.4 | ||
463 | } | 471 | } | ||
464 | 472 | | |||
465 | Components.Label { | 473 | Components.Label { | ||
Zren: We use `font.pixelSize` to avoid the size "jumping" when it fits to a smaller panel the size… | |||||
466 | id: timeLabel | 474 | id: timeLabel | ||
467 | 475 | | |||
468 | font { | 476 | font { | ||
469 | family: plasmoid.configuration.fontFamily || theme.defaultFont.family | 477 | family: plasmoid.configuration.fontFamily || theme.defaultFont.family | ||
470 | weight: plasmoid.configuration.boldText ? Font.Bold : theme.defaultFont.weight | 478 | weight: plasmoid.configuration.boldText ? Font.Bold : theme.defaultFont.weight | ||
471 | italic: plasmoid.configuration.italicText | 479 | italic: plasmoid.configuration.italicText | ||
472 | pixelSize: 1024 | 480 | pixelSize: 1024 | ||
473 | } | 481 | } | ||
▲ Show 20 Lines • Show All 208 Lines • Show Last 20 Lines |
We use font.pixelSize to avoid the size "jumping" when it fits to a smaller panel the size can fit.
https://bugs.kde.org/show_bug.cgi?id=370156
Use font.pixelSize: plasmoid.configuration.fontSize * units.devicePixelRatio