diff --git a/applets/digital-clock/package/contents/ui/DigitalClock.qml b/applets/digital-clock/package/contents/ui/DigitalClock.qml --- a/applets/digital-clock/package/contents/ui/DigitalClock.qml +++ b/applets/digital-clock/package/contents/ui/DigitalClock.qml @@ -124,7 +124,7 @@ height: sizehelper.height width: sizehelper.contentWidth - font.pixelSize: timeLabel.height + font.pointSize: Math.min(plasmoid.configuration.fontSize || theme.defaultFont.pointSize, Math.round(timeLabel.height * 72 / 96)) } PropertyChanges { @@ -133,7 +133,7 @@ height: main.showDate ? 0.7 * timeLabel.height : 0.8 * timeLabel.height width: main.showDate ? timezoneLabel.paintedWidth : timeLabel.width - font.pixelSize: timezoneLabel.height + font.pointSize: Math.min(plasmoid.configuration.fontSize || theme.defaultFont.pointSize, Math.round(timezoneLabel.height * 72 / 96)) } PropertyChanges { @@ -142,7 +142,7 @@ height: 0.8 * timeLabel.height width: dateLabel.paintedWidth - font.pixelSize: dateLabel.height + font.pointSize: Math.min(plasmoid.configuration.fontSize || theme.defaultFont.pointSize, Math.round(dateLabel.height * 72 / 96)) } AnchorChanges { @@ -265,7 +265,6 @@ height: sizehelper.contentHeight width: main.width - font.pixelSize: Math.min(timeLabel.height, 3 * theme.defaultFont.pixelSize) fontSizeMode: Text.HorizontalFit } @@ -469,7 +468,7 @@ family: plasmoid.configuration.fontFamily || theme.defaultFont.family weight: plasmoid.configuration.boldText ? Font.Bold : theme.defaultFont.weight italic: plasmoid.configuration.italicText - pixelSize: 1024 + pointSize: plasmoid.configuration.fontSize || theme.defaultFont.pointSize } minimumPixelSize: 1 @@ -494,7 +493,7 @@ font.weight: timeLabel.font.weight font.italic: timeLabel.font.italic - font.pixelSize: 1024 + font.pixelSize: timeLabel.font.pixelSize minimumPixelSize: 1 visible: text.length > 0 @@ -511,7 +510,7 @@ font.family: timeLabel.font.family font.weight: timeLabel.font.weight font.italic: timeLabel.font.italic - font.pixelSize: 1024 + font.pixelSize: timeLabel.font.pixelSize minimumPixelSize: 1 horizontalAlignment: Text.AlignHCenter diff --git a/applets/digital-clock/package/contents/ui/configAppearance.qml b/applets/digital-clock/package/contents/ui/configAppearance.qml --- a/applets/digital-clock/package/contents/ui/configAppearance.qml +++ b/applets/digital-clock/package/contents/ui/configAppearance.qml @@ -33,6 +33,7 @@ signal configurationChanged property string cfg_fontFamily + property string cfg_fontSize property alias cfg_boldText: boldCheckBox.checked property string cfg_timeFormat: "" property alias cfg_italicText: italicCheckBox.checked @@ -72,6 +73,20 @@ } } + ListModel { + id: fontSizesModel + Component.onCompleted: { + var arr = [] // use temp array to avoid constant binding stuff + arr.push({text: i18n("Default"), value: ""}) + + var sizes = [6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72] + for (var i = 0, j = sizes.length; i < j; ++i) { + arr.push({text: sizes[i], value: sizes[i]}) + } + append(arr) + } + } + QtLayouts.ColumnLayout { anchors.left: parent.left QtControls.GroupBox { @@ -107,6 +122,24 @@ } } + QtControls.ComboBox { + id: fontSizeComboBox + QtLayouts.Layout.fillWidth: true + // ComboBox's sizing is just utterly broken + QtLayouts.Layout.minimumWidth: units.gridUnit * 10 + model: fontSizesModel + // doesn't autodeduce from model because we manually populate it + textRole: "text" + + onCurrentIndexChanged: { + var current = model.get(currentIndex) + if (current) { + cfg_fontSize = current.value + appearancePage.configurationChanged() + } + } + } + // spacer, cannot do Qt.AlignTop on the font style label + rowSpan 3, otherwise looks odd Item { QtLayouts.Layout.fillWidth: true